Electric Magic Eight Ball
Are you interested in knowing the secrets of the Universe? Well the Magic Eight Ball might not be for you!
Able to answer yes or no questions, with the occasional maybe, the Magic Eight Ball can answer all of your questions with a 100% guarantee!*
Using an Atmega328P Arduino, some LED's, a Button, and several resistors, you too can build your own Magic Eight Ball!
If an Arduino Uno is not available to you, but you happen to have a voltage regulator and time crystal lying about, you too can build your own Magic Eight Ball!
*The Magic Eight Ball is not responsible for any consequences for your actions based on your decisions to act on what the Magic Eight Ball has decreed.
Parts List:
1 Atmega328p
4 Red LED's
1 1 K Ohm Resistor
4 560 Ohm Resistors
1 Momentary Pushbutton
1 LM7805 Voltage Regulator
1 16 MHz Time Crystal
2 .022 uF Capacitors
2 10 uF Capacitors
1 Breadboard
Code
The most difficult part of the code is keeping track of where variables are created and where they can be modified. Local variables like decision can only be modified within their method while class variables like delayLoop can be modified anywhere. It is also important to understand what variables are controlling your loop and what things are altered after your loop. It is difficult to run through the entire program if your loop runs the LEDs infinitely.
We used an existing ArduinoUno to move our code from the computer to the Arduino and to test our code before attaching it to our final circuit. This would probably be the easiest way to do it, but any method to get the code onto the Arduino would also work.
Build Arduino Setup
To start, we need to set up the necessary components for the arduino to run. To power the arduino, we use a 9V battery with a 5V voltage regulator. Two 10 uF capacitors attached to the input and output pins of the regulator lead to ground and a wire from the middle pin to ground.
The time crystal is attached to pins nine and ten of the arduino, where two .022 uF capacitors lead to ground for both pins.
Lastly, pin 8 on the Arduino needs to connect to ground.
Button
Place the button in an easily accessible part of your breadboard and wire it with the output pin of the voltage regulator to power it. Also, place your 1 KOhm resistor to this pin of the button and ground.
On the opposite side and lower half of the button, wire it to pin 4 on the arduino.
LED's
For this step, the four LED's need to be connected to pins 11, 14, 17, and 19. The other pin of each LED needs to connect to one of the 560 Ohm resistors, which each go to ground.
For this device we chose to have four LED's for four possible answers; the first LED for "yes", the second LED for "no", the third LED for "maybe", and the fourth LED for "ask again".
Improvements/Variations
Because it is a "Magic" eight ball the device could be concealed in some type of container, an Altoids tin for example. Just having the LED's sticking out of the container and having access to the button could give the Illusion that this magic Altoids container is answering questions.
Another option to improve this device would be to solder it to a perf-board to make it more permanent, and if it is soldered more compactly it could fit into smaller containers.
This device has the LED's for visual effect, but there is also the possibility of adding an audio component to the device. Maybe attaching a speaker to the device and playing the Jeopardy timer music could add to the aesthetics of the device. There is obviously the improvement of adding more LED's to give more decision options which would be fairly simple.