Small Potentiometer Game

by RickvanLeeuwenHKU in Circuits > Arduino

200 Views, 0 Favorites, 0 Comments

Small Potentiometer Game

20230807_163535.jpg
20230807_163548.jpg

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

i2c adapter.jpg

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

I2C Check.png
  1. Open the Arduino IDE application and download the LiquidCrystal I2C library by Frank de Brabander.
  2. Connect the I2C adapter as shown on the diagram above.
  3. Upload the I2C scanner under File > Examples > Wire > i2c_scanner
  4. Take note of the address in the serial monitor.
  5. Load PotGameScreen.ino found under this paragraph.
  6. Replace [HERE] with your scanned address.
  7. Upload the code to your Arduino Uno.

Downloads

Wiring

Wiring.png
20230806_134120.jpg
20230807_130453.jpg
  1. Use the schematic for reference.
  2. Connect the screen and potentiometer to ground. I did this by combining the cables into one and soldering them together.
  3. Connect the screen and potentiometer to positive (5V). This uses the same method as step 2.
  4. Connect the potentiometer's output to A0.
  5. Connect the screen's remaining pins to the unmarked slots on the Arduino Uno. Use the schematic for reference.
  6. 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

20230806_190257.jpg
20230806_190328.jpg
20230806_190941.jpg
20230806_191342.jpg
20230806_191328.jpg
20230807_151847.jpg
20230807_151853.jpg
20230807_151906.jpg
20230807_154608.jpg
20230807_161504.jpg
20230807_164905.jpg
20230807_161941.jpg
20230807_161946.jpg
20230807_161932.jpg
20230807_163538.jpg
20230807_163548.jpg
  1. 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.
  2. Fold the 4 panels and fold the extra bit inward.
  3. Glue the inward bit to the outer wall to construct a square. Optionally reinforce if the cardboard has other folds.
  4. Place the Arduino in the corner and sketch the inlet's edges onto the cardboard
  5. Cut a small rectangle for the inlet to stick out of using the outline.
  6. 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.
  7. Measure out your screen's outline and slice a hole into the square to fit it.
  8. Poke a circular hole for the potentiometer. This can simply be done with a pencil or other tool.
  9. 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.
  10. Glue the lid in place using the flaps around the edges.
  11. 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!