Eat too many cookies? These are some guidelines for how you can add a few security features to an ordinary box of cookies – or at least have a fun toy.
The runaway cookie box will roll away when objects approach it and sound an alarm when it is picked up.
What you need for the craft side of things:
-empty cookie box
-Legos (axles, gears, basic)
-popsicle sticks, colorful straws, googly eyes, or whatever you want to give your box some character
Step 1: The Circuitry
During this step, you’ll set up all the circuitry required for the project.
First, connect the Arduino’s 5V power and ground pins to the bus strips of the breadboard.
Second, connect the tilt sensor to the breadboard. Connect the wires on one side to the power strip and the wires on the other side to a 100K& resistor going to ground as well as to digital ins on the Arduino (in this case I used 3 and 4).
Third, connect the three distance sensor wires: red to power, black to ground, and yellow to an analog in on the Arduino (in this case, I used A0).
Fourth, connect one of the speaker’s wires to ground and the other to a 100& resistor connected to a PWM digital in on the Arduino (in this case, I used 5).
Last, connect one of the hacked servo’s wires to ground and the other to another digital in (in this case I used 9).
Step 2: The Box
During this step, you’ll construct your moving cookie box monster that will hold all the circuitry from the last step.
For ease in assembling the project, you can cut a rectangular hole on the bottom of each side.
Hot glue the sides of the breadboard to the space just above this hole.
Hot glue the head of your hacked servo directly to a Lego wheel.
Now construct a Lego chassis for the box with a regular front axle and only one wheel connected in the back. One of the rear wheels is, as you may have noticed, currently attached to your servo. Tape down your Arduino and your servo so that the fourth wheel is oriented in the right direction.
Now you can hot glue your distance sensor to the top back of the box so that your box will spy its enemies coming from behind. You can let the speaker simply rest on top of the breadboard.
Last, attach whatever crafty materials you want! As you can see with my project, I gave it popsicle antenna eyes with a colorful straw mohawk.
For more detail: How to make a runaway cookie box using Arduino