First Ever in All of the Universe - Nixie Tube Slot Machine Game. (Not a Clock)
by BobC123 in Circuits > Microcontrollers
685 Views, 11 Favorites, 0 Comments
First Ever in All of the Universe - Nixie Tube Slot Machine Game. (Not a Clock)
A Nixie Tube Project That Isn’t a Clock.
In all of my ramblings around the internet I have encountered few nixie tube projects that aren’t a clock or some variation of one. I found no projects that use nixie symbol tubes. So, I created one – The Handheld Nixie Tube Slot Machine Game. Symbol nixie tubes have been around since the beginning. There are many variations used to display electrical and other unit-of-measure symbols such as Volts, Amps, Ohms, etc.. Nixie symbol tubes are readily available usually at a lower cost than their respective numeric tubes.
So, I claim the first viable game project for symbol nixie tubes. It’s OK with me if someone proves me wrong. The purpose of this instructable is to present a concept born out of my junk box and readily available resources. What I am presenting here is my initial implementation (actually a prototype) of a slot machine using nixie symbol tubes as the slot machine wheels. I do not have a 3D printer so the execution is pretty plain. It is my hope that others will take this idea to the next level.
The nixie slot machine is an Arduino based game with three IN-7 symbol nixies, four IN-12 numerical nixie tubes for score keeping and four NE-2 type neon flashing lights. The symbol nixies have blue LED backlighting. The game is portable and has rechargeable batteries. The IN-7 symbol tubes are used for the slot machine wheels. They have ten discrete symbol characters. IN-15A nixies can be used as well. Not all symbol nixies have ten discrete symbols. The IN-7A and IN-7B only have eight symbols. The ten IN-7 symbol characters are :
П + m A V M Ω ~ K -
How It Works
The overall design is very similar to a nixie clock. The Arduino Nano directly controls the symbol nixie “wheels” via 74141/k155idl BCD-to-decimal decoders. The Arduino serial port feeds two serial to parallel converters that control the four score keeping nixies. The score value is retained in Arduino EEPROM when power is off.
The mapping of the 74141/k155idl BCD-to-decimal decoders to the nixie symbol tubes is different for each “wheel”. For example, Q0 of the left nixie driver is mapped to the “M” symbol, Q0 of the middle nixie driver is mapped to the “Ω” symbol, and Q0 of the right nixie driver is mapped to the “V” symbol and so forth. This is so the random number generator doesn’t have to generate the same random number three times consecutively to get a payout. Although this is probable, it isn’t very likely. The score keeping nixies are mapped normally. Refer to the schematic for I/O mapping of the nixie drivers to the nixie tubes. This specific mapping is not required as long as the three nixie wheels are mapped differently.
The CC/CV (Constant Current/Constant Voltage) power supply maintains a constant charging current for the battery cells until they reach their terminal voltage. The BMS (Battery Management System) keeps the cells from over-charging and over discharging. The high voltage boost converter provides the high voltage DC for the nixie tubes. The flashing neon lights are controlled by Arduino output bits via transistors.
How To Play
Pressing the PLAY button will “Spin” the nixie wheels. They stop in succession left to right just like a slot machine. If they come up three-of-a-kind there is a payout to the coin counter. The game starts with 25 coins. The coin count will decrement by one for each play and increment for coins paid out for a win. The orange and green NE-2 lamps will flash as the coins are paid out. Coin count is retained in EEPROM when the power is off. If the coin count goes to zero the player goes broke. If the coin count builds to 9999 the player breaks the bank. In either case, turning the game off and back on will start a new game with 25 coins.
If the Play button is held down for five seconds, the game will reset to 25 coins. If the slot machine is left on and not used for 20 minutes, the nixie tubes will cycle through their characters for 5 seconds to prevent cathode poisoning (dimming of a character). Nixie clocks do this – oddly enough, it’s called the "slot machine" feature !
Supplies
The parts for this project came from a number of sources including my personal lifelong junk-box. None of the parts are specific to any particular vendor or source except as noted. Other than the nixies, all of the parts are common electronic project parts. Search your Junk-Box or use your favorite suppliers. Because eBay sellers come and go, I provided a search string to find eBay sellers for the nixie tubes. I have had no issues purchasing from Europe or Russia.
(Qty) Description
- (3) eBay IN-7 Symbol Nixie Tubes (Search “IN-7 Nixie”)
- (4) eBay IN-12 Nixie Tubes (Search “IN-12 Nixie”)
- (7) eBay/Amazon 74141 or k155idl Decoder ICs (Search “k155idl” or “74141”)
- (1) Amazon 15V Power Supply Wall Wort
- (1) Amazon High Voltage Boost Power Supply
- (1) Amazon CC/CV Power Supply
- (1) Amazon 3 Cell BMS Battery Management System
- (10) Amazon 2 Pin Connectors & Pigtails
- (1) Amazon Enclosure 7.8” x 4.7” x 2.2”
- (90) Amazon Nixie Tube PCB Mounting Pins
- (9) Amazon 16 Pin IC Sockets
- (1) Amazon Arduino Nano
- (2) Amazon 74HC595 Serial to Parallel Converter IC
- (4) Amazon MPSA42 NPN Transistor
- (1) Amazon 1N4007 Diode (or similar 1A diode)
- (1) Amazon 1N5804 3A Diode (or similar 3A Diode)
- (3) Amazon Blue 5 mm LEDs (backlight for symbol nixies)
- (3) Amazon 18650 Lithium-Ion Rechargeable Batteries
- (1) Amazon 3 Cell 18650 Battery Holder
The rest of the parts are commonly available from Amazon and other electronic suppliers or your personal electronics junk-box.
- (8) 10K Ohm ¼ Watt resistor
- (4) 1K Ohm ¼ Watt resistor
- (4) 470 Ohm ¼ Watt resistor
- (1) 200 Ohm 2 Watt resistor
- (1) SPST Play Pushbutton
- (1) SPST Power Switch
- (1) Power Input Receptacle 5.5/2.1 mm
- (2) NE-2 Type (or similar) Neon Bulbs (Standard Orange)
- (2) NE-2 Type (or similar) Neon Bulbs (Green)
- Misc. Shrink tubing, wire, hardware, etc.
Building the Nixie Slot Machine
The main PCB (Printed Circuit Board) was manually laid out with ExpressPCB. All external devices plug into the main PCB. As you can see, I designed it “Old School” with all through-hole components and socketed ICs. There is room for improvement in the routing and layout of the external connections to the PCB. The nixie tubes are mounted on the bottom of the PCB with mounting pins in-lieu-of sockets. All of the modules plug into the main circuit board using 2 pin connectors. The four flashing NE-2 light bulbs, play button and power switch plug into the main circuit board as well. There are two “hacks” on the PCB. They are design changes not layout errors. The schematic and layout have been updated to reflect these changes. The modules are held in place with double-sided foam tape. The BMS and battery pack are wrapped in shrink tubing. The high voltage boost converter is set to 170 VDC. The CC/CV DC-DC converter current adjustment is set to 1.5 Amps. The voltage adjustment is set to maximum. With a 15 volt power input from the wall wort, the batteries will be charged to about 12.5 volts (12.6 is fully charged). The NE-2 neon bulbs are glued in place.
Misc. Details
Diode D1 prevents the batteries from back feeding into the CC/CV power supply when the wall wort is not connected. The nominal battery output voltage is about 12.6 Volts when fully charged. D2 drops about 0.6 Volts to reduce the power to the Arduino to 12 Volts. The Arduino supplies the 5.0 Volt Vcc to the digital chips.
When the battery runs low the game will simply shut down. To recharge the batteries, plug in the power adapter (15 Volt, 3 Amp). The batteries and CC/CV power supply will get warm while recharging. It will take up to 3 – 4 hours to fully recharge the batteries, the game can be played while the batteries are recharging however, the time to fully recharge the batteries will be longer. I used 2500 mAH (milli-Amp Hour) batteries. Longer play time can be realized with higher mAH batteries.
The nixies will become slightly warm while playing, this is normal. The enclosure is an off-the-shelf simple box. I don’t have a 3D printer. I encourage all creative nixie lovers to devise a better enclosure. The power switch and recharging port are located on the right side.
The file type for an ExpressPCB layout can not be uploaded to an instructable. The "PCB Layout.pdf" file below contains the ExpressPCB layout file embedded within. Open the .pdf file and save the attachment (ExpressPCB - Nixie Slot Machine With Score .pcb). Goto ExpressPCB to download the free editing software to edit the layout. ExpressPCB files can be converted to Gerber files.
Software
The slot machine software is written in C++. I have written many thousands of lines of Visual Basic, Assembly and Ladder Logic but this is my first C++ program. It will be obvious when you look at the code. It is heavily commented to help you understand the code and for me to remember what I was thinking. I am sure there are more elegant and efficient ways to write this code. None-the-less here it is.
Random Number Generator
The random number is seeded by a combination of the saves score, noise input fron an analog pin and a random amount of time. There are 103 (1,000) possible combinations of three symbols, ten of which will be three of a kind. This makes the probability of a pay off one in one hundred. Even casino odds are better than that. I created a payoff algorithm similar to a real slot machine. The pseudo-random number generator is seeded by a variable seed at startup. It generates two pseudo-random numbers.
- First, the number of plays until the next payoff.
- Second, which of the ten symbols will display as three of a kind.
- Pay out of coins is according to the table to the right.
All other Plays will display three random symbols. If three of a kind shows up randomly on a non-payoff play, it is a natural, one in one hundred, random three of a kind. It will pay off a random jackpot that is 35 – 50 coins. The coin payout will count faster (and longer) than a regular payout.
EEPROM Write Cycle Management
The Arduino EEPROM is officially rated for 100,000 write cycles. The coin count is updated on every play. The number of write cycles are counted and stored. When the write cycle count gets to 100,000 it moves the stored data to the next EEPROM locations. Score keeping uses six bytes of EEPROM storage plus two bytes for the pointer.
- Address Pointer
- Address (0 to 1) -- 2 Bytes -- Unsigned Integer - Pointer to address “n”. Updated once every 100,000 writes
- Scorekeeping
- Address (n to n + 1) -- 2 Bytes Unsigned Integer - Coin Count. Updates every play
- Address (n + 2 to n + 5) -- 4 Bytes Unsigned long - Write Counter. Updates every play.
This will last about 17 million plays. When the pointer gets to the end of the EEPROM to will start over at address 0. Independent testing has indicated the EEPROM can tolerate well over one million write cycles before it fails. If true, the EEPROM would last over 170 million write cycles. Eventually the Arduino will fail to keep the coin count but the "warranty" and I will have long expired.
Further Development and Improvements
This is where you come in. A lot of things could be done better or differently. How about adding sound or a mechanical “one-arm” to spin the wheels, or bells and whistles, or a video display for the coin counter, or a better way to retain the coin count, or integrate all of the external modules into one PCB, or … you get the idea. I am sure there are a lot of creative minds out there that can make this a great project. Who knows, someday there might be a plethora of nixie tube slot machine projects out there. Let me know in the comments.