CONTENTS

Home
Updates
Software
Electronics
Android / iOS
Videos
Music
Resume
Contact



HTTPS VERSION


Parallax Propeller Poker

Posted: April 9, 2009

Introduction

I got this Propeller development kit a while ago from http://www.parallax.com/, but never really had a chance to play with it. This is a pretty neat chip actually. It has eight 32 bit cores that run independently at speeds up to 80MHz. The devkit comes with VGA and PS/2 ports for keyboard and mouse and other stuff. It can be programmed in either assembly or a language called Spin and comes with a library of Spin objects for the keyboard, VGA, and other stuff.

So finally a couple days ago I thought of this idea of doing a video poker game for Propeller so here it is. I took a bit of the logic from a Java version of this game that I did and translated it to Spin. Unfortunately, the VGA library ended up being a bit restrictive. Every 32x32 pixel block could only have two unique colors (out of a palette of 64 colors). Also, all the text and images I drew using a small python program I wrote that turned "ascii art" into Spin code I could paste into the .spin source. This was quite time consuming and tiring, so due all this the graphics here are quite 1983 looking, which actually I kind of like :).

Anyway, to run the development version game (which can download below) the Propeller devkit is needed along with a PS/2 keyboard, and a VGA monitor (or flat screen as I have in the picture below). Load the two spin programs and build the PropellerPoker.spin as the top module. On the keyboard: b = bet, 1-5 = hold cards 1 to 5, space = deal, and capital A = add more credits.

Related Projects @mikekohn.net

VGA: FPGA VGA, SX VGA, Atmel VGA, Propeller Poker, Nexys2, Java VGA

The Final Product

So after getting the game working on the development board, I wanted to build something for it. I was thinking of building a full poker machine cabinet, but I couldn't find a cheap LCD display to take apart for it, so I decided on just mounting everything to a piece of wood in the shape of a little table. I cut a coin slot in the wood and put an IR emitter and detector on either side so it can detect a coin falling through it. I also added a little speaker which I ripped out of an old Juice Box media player. Finally I added some little sheets of metal for buttons using a cap-sense circuit/software. Basically what it does is, if a finger is touching the metal piece, it acts like a capacitor. So I set the input pin on the micro to output and set it's value to 0 creating a virtual ground and discharging the "finger capacitor" for 1ms. Then I set the I/O pin back as an input and wait 5us (actually the page I read how to do this on said 5us, but for my resistors and such I'm doing 10us) before testing the value of the input. If the input is a 0, then the finger capacitor is being charged (aka, there is a finger on the metal piece so detect it as a button push) otherwise if there is a 1 on the i/o pin then the capacitance of the line was next to nothing and no finger is there. Probably I should have use shielded wire from the resistors to the metal plates, but I didn't have any and I was too cheap/lazy to go out and buy some. Using object-oriented techniques, I made my PokerKeyboard.spin module directly pretend to be the stock Parallax Keyboard.spin module so they can be substituted for each other. Or at least, I think I did.. I forgot to test this :).

Video

Here's a video showing coins being inserted into the poker machine and the playing of a hand. https://youtu.be/0xinnBKeauM

Pictures

Parallax Propeller poker

Here's a screenshot of the game running. Since this time I've added a little more. It says "BET:" now next to the number on the right side and there is a $ next to the amount of credits the player has.

Parallax Propeller demo board

This is the little board that I originally developed the game for. I then created my own circuit based on the devkit but added a speaker, a coin slot, and cap-sense buttons.

Cap sense buttons

Here's the poker game from the top with the cap-sense buttons and a coin slot.

Parallax Propeller Poker circuit board

Here's the entire circuit all soldered together and mounted to the bottom of the little wooden table.

Schematic

Parallax Propeller Poker schematic

Download

For the propeller devkit: PropellerPoker.spin PokerDeck.spin
For my circuit above: PropellerPoker.spin PokerDeck.spin PokerKeyboard.spin

Copyright 1997-2018 - Michael Kohn