Toy Globe Arduino Project

by PHS_Engineering in Circuits > Arduino

213 Views, 1 Favorites, 0 Comments

Toy Globe Arduino Project

2D9F45A4-589D-42F0-8304-A6D9F2480E46.jpeg
image.jpg

Our simple Arduino project is an easy first project to get used to circuit building and coding. We will be setting up a circuit and using code to turn on the snow globe. The code will let us control a the globe normally or by using a potentiometer.

Supplies

Materials:

Toy Globe

Screwdriver

Saw

Wire Stripper

Alligator Clips


Coding Materials:

Audrino

Breadboard

_ Wires

1k resistor

relay

(Optional) Potentiometer

Build the Circuit

43794054-5763-4BFB-8219-C391696F9732.jpeg
We needed to build a simple circuit that would that would allow electricity to flow through the audrino and into our globe. We have a relay installed so that we can control the the code better. You simply need 6 wires, a 1k resistor, and you’re relay. Install everything as seen in the photos attached.

Potentiometer

image.jpg

You can decide whether you want to add a potentiometer to you’re project. This would allow you to control the globe with a knob that turns it on and off. Our code will read the values of the potentiometer and turn it on when it’s higher than a certain value. See how to attach the potentiometer and 3 more wires needed in the attached photo.

Disassemble the Snow Globe

97EEA9AA-A208-40E7-A083-6219B7E1A641.jpeg
To be able to have a connection with the globe to our audrino, we need to have a circuit connection between the two. You will need to use the screw driver and wire strippers to get open the mechanism and open up a few raw wires. There are two yellow wires that are connected to the on button on the globe. See the attached photo for more.

Cut a Hole for the Alligator Clips.

082F1548-92ED-45C8-A71D-AE56835795CA.jpeg
To be able to put our globe back together after setting up all the wiring. We need to cut a hole in the bottom frame so that wires can be fed through the cut. If not then we wouldn’t be able to put the bottom back on after connecting our wires.

Connect the Globe to Your Audrino

EF5B1C0C-46F1-4658-AB28-CF31C316980A.jpeg
9C761526-C204-4551-8046-9394343179E2.jpeg
After finding the two yellow wires that connect to the on button, and opening a connection on one side of the wires. We can now connect the wires to our alligator clips. Connect the two yellow wires to one clip each, then we can connect two wires from our breadboard to the other sides of the clips. You can see the wires that need to be connected in the photos attached.

Code

const int relayPin = 12; //this is the relay pin const int potPin = A0; //this is the potentiometer pin int soundVal = 10; //this is the soiund pin int analogPin; //this is a analog pin int threshold = 300 ; //When the potentiometer reads this value ir turns on void setup () { pinMode (relayPin, OUTPUT); //This means that the relay pin is for output pinMode (potPin, INPUT); //This means that the potentiometer pin is for input Serial.begin(9600); //this is the frequency the serial pin is useing } void loop (){ // read the value of the potentiometer: int analogValue = analogRead(analogPin); // if the analog value is high enough, turn on the LED: if (analogValue > threshold){ digitalWrite (relayPin,HIGH); } else { digitalWrite(potPin, LOW); //if the potentiometer reads a value less than 300 id will not turn on } // print the analog value: Serial.println(analogValue); delay(1); // delay in between reads for stability soundVal = analogRead(potPin); // Serial.println(soundVal); delay(10); }