Welcome to the Magic 8 ball that has an attitude. In this Instructable you will learn how to make a magic 8 ball that has a digital screen. If you do not desire to have one that has rude language coming out of it then it is an easy fix.
Hope you enjoy!
Step 1: What You Will Need
- (1) LCD screen 16x2
- (1) 10 K potentiometer (this will be used to control the contrast of the screen)
- (1) 9v battery
- (1) Barrel jack adaptor
- (1) Accelerometer
- (1) breadboard
- (1) Ardunio Uno
- (22) header pins
- Lots of wire
These parts are only needed if you want the same casing I have
- (1) Foam Ball (large enough to hold all of the parts)
- 1ft of rope
- black paint
Step 2: Getting Started - LCD
The first thing you should do solder headers to the LCD screen.
Step 3: Hooking Up the Accelerometer
First solder on the headers to the accelerometer.
Then hock the wires up:
- ST goes to the #4 digital pin on the Arduino
- Z goes to the A5 on the Arduino
- - goes to the GND on the digital side of the Arduino
- + goes to the a positive on the breadboard ( I used the far end with the less wires, see sketch)
NOTE: Check the schematics of your accelerometer if it is a different one then the one used in this project. It may change the wiring order.
Step 4: Hooking It Up
Place the LCD screen on the breadboard. Then began plugging in all of the wires in the correct spot. I have included a sketch of the wire placement since the photo is a little hard to follow. If the LCD is very dim or very bright turn the potentiometer. It will either dim the LCD or make it brighter depending on what you need to do.
NOTE: If you are having problems with LCD not working check the schematics of the LCD that you bought. They may differ from the one used in this project.
Then connect the barrel jack to the 9v battery. Plug it into the Arduino. The LCD screen should light up.
NOTE: Photo shows a wire in A0 this needs to be in A5. The diagram however is correct.
Step 5: Code
I have attached a file that has the code that I used. I originally used some code that was created before but there were bugs in it so I modified it.
The code is programed to pull random phases that I entered in to be displayed on the screen when the object is shaken. After it displays the text on the screen it will go black to being blank until shaken again.
Inside the code you can change the phrases to whatever you like.
Also inside the code under the void loop you will see:
if (z > 450 && Z < 598)
There are limits - these may need to be changed depending no the accelerometer.
I have to do a lot of trial and error in this section to find the correct numbers for my accelerometer. I also noticed the the accelerometer needs to be in an upright position or else the phrases will just continuously scroll and not stop.
If you have any problems here just keep trying it will work!
After you upload the code to the Arduino then it should be working. Play with the accelerometer and tilt it back and forth the text on the screen should change with your movements.
Step 6: Casing / Decoration
I chose to put my project into a foam ball and made it look like a cartoon bomb.
Used two halts of a foam ball. I added extra foam and plaster to form the top of the bomb. I then added in a 1ft of rope to the top. Part of the rope is in plaster so it would not come loose once the plaster dried. I cut out a hole in the top piece so that the LCD screen could show through one it was all together.
NOTE: Yours does not have to go into the same casing as I put mine in. Feel free to be creative!
No matter what you put your project in -be sure to secure your board, LCD, and Arduino to the inside. Remember this is be shaken so everything needs to be secured.