Introduction: Binary Switch Game
Inspired by Ben Heck's Hex Game
This is a binary game I made to teach my friends about binary. In the end I play with this in class to keep myself awake.
You convert random denary(0-255) or hexadecimal(0-ff) values on the screen to binary, and then use the 8 main switches to input that binary value. You can choose to convert values to binary forever, or within a 60 second time limit with high scores (Not stored in memory though).
There are also other features, like
- Spam game, where you spam the button in 60 seconds for high scores
- A conversion tool, to convert binary to denary, hexadecimal or ASCII
- An ASCII Text editor, where you enter binary values representing the ASCII character into the screen, and
- A Main menu, where you enter binary values to access the different features and modes
- Lack of Sound, so you can play in class( It's a feature, not a bug)
As for this Instructable:
- This is my first, so please guide me along
- I'm using a phone camera, so I'm sorry for any poor quality images
- I have a point and shoot, but it's too much of a hassle, so sorry for that
- I made this instructable and took most of my photos of the device after making it, not while making it, so I do not really have much photos or videos documenting the process. Sorry for that too
There is a similar Instructable Binary Game, which also guides you on how to play Binary
So let's get started!
Step 1: Materials and Tools
- An ATMega 328p (The chip in the Arduino Uno)
- 8 Switches (To input binary)
- 2 other switches(1 for power and 1 for mode)
- Nokia 5110/3110 LCD
- Circuit Board (Duh)
- Power Circuit
- 150mAh Lithium polymer Battery (Got for free from an event)
- Lithium Ion Battery Charger and protection Circuit (Also got for free from the same event)
- 3.3V Step down converter
- A soldering iron and solder
- A solder sucker (because you can make mistakes)
- ISP programmer for arduino (or an extra Arduino Uno, Raspberry Pi, etc.)
Step 2: Failures
Why a failure (2 failures)? Because this project is built on two.
I have originally wanted to build an LCD Toy like the one by The 8-Bit Guy. However, although I managed to get it sort of working, the character LCD was fried when it was put into the circuit board. I could never figure out why. The schematic is similar to the one by The 8-Bit Guy.
I have also wanted to build a DIY Gambuino. The screen, microcontroller board and the controls would be modular and detachable. However, I could not upload the bootloader and get the SD Card working using my Raspberry Pi back then, and I did not have an Arduino Uno then, so I gave up for school work.
When working on this project, I've decided to combine the main microcontroller board from the DIY Gamebuino and the LCD Toy board with switches to make the binary game.
Step 3: Soldering It Up
Essentially, the whole circuit involves:
- Connecting the Nokia LCD
- Connecting the 8 switches, button and mode switch (Pins 9-0, check arduino sketch for more information)
- The 8 switches are arranged in (2^7,2^6,2^5,2^4,2^3,2^2,2^1,2^0)
- Connecting up the 150 mAh Lithium Polymer battery and the charger circuit, along with the power switch in series
So take your time to solder it up. You could solder everything onto one board. however, with the ATmega328p board and a circuit board with switches handing around, I soldered up headers and wires to connect them together, along with an extension cable to extend the LCD from the main microcontroller board.
Step 4: Programming
You would have to use an ISP Programmer to upload. If you do not have an ISP programmer like me, you could use a spare Arduino Uno with the ArduinoISP sketch.
There are a few main things to program:
- The Main Menu
- Reading the binary value from switches (In the Arduino sketch)
- The Binary Game itself (timed is just using millis() to check if 60 seconds have past)
- SpamGame (Just counting the number of times a button is pressed and using millis() to check if 60 seconds have past)
- ASCII Text Editor
Tip: If you use an Arduino Uno to program it, Disconnect the Nokia 5110 LCD First. It may be fried by the 5 volts from the Arduino Uno. (Personally, I forgot to do this twice, but luckily my LCD still worked)
Step 5: Case
After programming it and bringing it around school, I've decided to make an Acrylic Case to protect the electronics inside it
I got 2 pieces of black acrylic is from another scrap project, and the clear piece of acrylic as scrap from school lessons. With a cheap 60W soldering iron,, I heated up the edges I wanted to bend, and then with the help of a wooden block, bent the acrylic to 90 degrees. For the mode switch, I used the soldering iron to melt a hole at the side of the case, so that it would be accessible. I also use the soldering iron to melt off some excess area of acrylic so that the case would fit. A Little filing would make the case smoother and not as rough around the edges.
However, with me having poor workmanship,
- I was too impatient and broke a piece of acrylic for the case. As a result, the bottom piece does not have a smooth and clean front edge.
- I did not get the acrylic to be bent as well as it could be, so next time, you could take this into account (Look at the slanted bend lines)
Using a soldering iron is not clean or nice, but it is a quick and dirty way to get stuff done, and it works!
After the acrylic pieces are bent, I used hot glue to secure the black pieces of acrylic together. With no idea for what to do for the clear top piece, I just taped it in place. When i ever need to fix anything, the tape and the top piece comes right off to access the circuitry for easy repairs. I also hot glue the power switch in place.
Oh, the pen cap on the upper edge of the circuit board is to prevent it from sliding around
Step 6: Done!
After a week's worth of hard work, I managed to salvage 2 (3 if you include scrap acrylic) broken projects into this Binary game. However, this little device broke down here and there, so to get to the process, I had to replace the power and mode switches, fix the solder on the circuit board of switches, and do some light touch up. The LCD screen may not work properly, sometimes I have to press down on it for it to show anything. But hey, it's the first thing I made that is actually useful and works!