Small Potentiometer Game
by RickvanLeeuwenHKU in Circuits > Arduino
220 Views, 0 Favorites, 0 Comments
Small Potentiometer Game
This is a simple game where you quickly adjust a potentiometer to match the given number.
The screen shows the player the value they have to reach on the top left. By turning the potentiometer you can adjust the number on the bottom left until it matches the goal. The top right number indicates the amount of seconds you have left. Lastly the score is written on the bottom right. The score is also displayed when the player loses.
Supplies
Materials:
- 1x Arduino Uno
- 1x Digital LCD 16x2 screen with i2c adapter (adapter pictured above)
- 1x Potentiometer
- Several simple Arduino compatible wires (male to male works fine if you strip some of the ends)
- Light cardboard
Tools:
- Hot glue gun
- Hobby knife
- Screwdriver (very small)
- Soldering kit
- Cutting board or other surface you can work on
Setting Up the Code
- Open the Arduino IDE application and download the LiquidCrystal I2C library by Frank de Brabander.
- Connect the I2C adapter as shown on the diagram above.
- Upload the I2C scanner under File > Examples > Wire > i2c_scanner
- Take note of the address in the serial monitor.
- Load PotGameScreen.ino found under this paragraph.
- Replace [HERE] with your scanned address.
- Upload the code to your Arduino Uno.
Downloads
Wiring
- Use the schematic for reference.
- Connect the screen and potentiometer to ground. I did this by combining the cables into one and soldering them together.
- Connect the screen and potentiometer to positive (5V). This uses the same method as step 2.
- Connect the potentiometer's output to A0.
- Connect the screen's remaining pins to the unmarked slots on the Arduino Uno. Use the schematic for reference.
- Plug the contraption in and adjust the small blue potentiometer on the back of your screen until the text is readable. This can be done with a screwdriver as pictured above.
Constructing the Box
- Cut a long strip of cardboard and divide it into 4 panels 12cm long by slicing undeep vertical grooves leaving an extra few cm on one side.
- Fold the 4 panels and fold the extra bit inward.
- Glue the inward bit to the outer wall to construct a square. Optionally reinforce if the cardboard has other folds.
- Place the Arduino in the corner and sketch the inlet's edges onto the cardboard
- Cut a small rectangle for the inlet to stick out of using the outline.
- Cut a 12cm x 12cm cardboard square with extra pieces jutting out separated by a groove. These will serve the same purpose as the glue flap from earlier.
- Measure out your screen's outline and slice a hole into the square to fit it.
- Poke a circular hole for the potentiometer. This can simply be done with a pencil or other tool.
- Attach the screen and potentiometer by using separate cardboard supports and/or glueing them directly. Make sure the potentiometer knob can still be twisted without moving the potentiometer itself.
- Glue the lid in place using the flaps around the edges.
- Make another identical square but without the holes and attach it to the bottom. If prefered the flaps can be glued on the inside for a seemless finish. Now all that's left is to plug and play. Have fun with your new creation!