Lazy 301 Dart Buddy!
My college roommates and I recently inherited a beaten up dart board...
We started exploring games like 301, in which each player starts at 301 points get their way down to zero points over the course of a few rounds. This was fun, however writing on the (small) whiteboard provided next to the board was time consuming, and prevented the next player from shooting until the previous player was out of the way.
SO, I thought it would be a fun afternoon project to whip together an arduino-based calculator that could help us out.
In an hour or so I had a rough working prototype on a breadboard. However with w couple more hours of work I removed the breadboard and fastened everything to a cheap box that I hung from the wall.
Supplies
Arduino Nano
Any Cheap Adafruit/Amazon version of the following:
16x2 LCD screen
Keypad
Potentiometer (assorted resistors will work)
Male-male, male-female, female-female assorted jumper wires
Piezo speaker
Breadboard
Code and Planning
The code was extremely easy and basic. I wasn't going for anything fancy here since it was a quick project, but you can mess with the code to your liking. I planned the game for anywhere from one to four players.
I wrote an arduino function to satisfy four players. I called it "game4p". I then copy and pasted it three more times and renamed the functions "game1P", "game2P", etc. and deleted extra code accordingly. The basic idea was follows:
1) Print Scores, prompt player 1 to go
2) When player enters score, advance to next player if there is one
3) repeat (2) until all players go, then start back at at (1)
4) if a player's score reaches zero, end the game and prompt for a new game
You can look at the code to see how I handled stuff like
-Entering stuff into the keypad
-Ensuring good input
-Allowing both addition and subtraction using the bottom left and right keys respectively
Downloads
Keypad
I used a cheap keypad to handle my input.
Arduino's keypad library takes care of all the cool behind the scenes stuff beautifully explained here. Basically you need one pin per row and one pin per column free on your arduino.
In my case, I used the bottom right key to trigger a subtraction action (to subtract your score from 301) and the bottom left key for addition(in case someone messed up, the game wouldn't be ruined). Pressing these keys without entering in a number first simply advanced to the next player.
After a couple minutes of playing around with the Serial monitor and the provided example code that comes with the keypad library, I was ready to integrate the LCD screen to display the keypresses.
LCD Screen
Once again, arduino has a build in library for this component as well. The LCD library handles all of the shenanigans that LCD screens use. A great pinout resource can be found here. All of the LCD screens I've ever used follow the same pinout explained in that link.
At the time of the rough prototype, I could not find a potentiometer, which is needed to adjust the contrast of the text on the screen with the backlight (needed for pin 3). So I used a bunch of resistors to create a voltage divider and probed a spot I seemed reasonable.
After a couple more minutes messing with the serial monitor, I was ready to put it all together!
Final (Rough) Working Product!
Here is a video of the breadboard product in action. Everything works as expected.
You can stop here after your hour of work, or you can spend another few hours and package it up to look (slightly) nicer like I did...
All the Bells and Whistles
No, it's not a bomb. This looks pretty rough, but it gets the job done!
I added a speaker for some pleasing feedback corresponding to good/bad keypresses. With a small plastic box I had laying around and some zip ties, I was able to package this thing up and hang it on the wall!
Thanks for reading, please rate and consider voting for me in the "1 Hour Challenge" in which this projected is submitted.
Feel free to ask questions in the comments!