Handy Candy

by joeydocter in Craft > Cardboard

138 Views, 0 Favorites, 0 Comments

Handy Candy

20210527_192442.jpg

This is a school project where i needed to make a sort of robot . My idea was to make a funny game with a high risky to the player when he/she losses. In this document i gonna explain how i made it and how it works.

Rules of the game

- If you claim the price to early the guillotine falls
- If the timer hit zero the guillotine falls
- if the player hands are gone for a long time the guillotine falls
- by placing the potentiometer at the right value and pressing the button for a right amount of time the led lights will turn on, if all the 3 light are turned on you can claim your price

Supplies

supplies:

- 1x Arduino Mega 2560
- 1x PCB
- 1x servo motor
- 1x 9v battery
- 1x button
- 1x sonar
- 1x pressure sensor
- 1x nail
- 1x wooden box
- 1x Aluminum foil roll
- 1x 4 digit 7 segment display
- 2x potentiometer
- 2 of 3 cardboard boxes
- 3x green led lights
- 6x slats
- 13x resistors
- 25x pins
- lots of wires

Make the Box

First i used a cardboard box to make a foundation and placed the components on the box to look where i wanted these objects. When i knew where i wanted the components i made little holes big enough to put the ends from the components in the box. also i placed Aluminum foil roll to look where i could best place it.

Next i made the guillotine by using a other cardboard box and made it look Intimidating by cutting it sharp. Also i used an other little cardboard box which i pasted on the guillotine so that it wouldn't fall on it's own. after that i used the wooden box to paste slats. i made holes in it on the top side to put sticks in the middle and the right. In the middle i placed the guillotine and made there holes aswell putting the stick through it.

now the start foundation is done.

Place Components on a Breadboard

IMG-20210508-WA0000.jpeg

Now i placed all the components on breadboard('s) to create a setup and placed the wires in the Arduino mega to so it is ready to programming.

Coding

Now that all the components are i the arduino it was time to code. In this script i made 5 functions: Timer(); Weight(); Movement(); WheelCodes(); button.tick();

Timer() : In this function i created as the function name says creates a countdown that starts with 120 seconds(2 min). If the timer hits zero the servo moter will spin.

Weight() : in this function i created a force so it detect a object in gram and make it detect if there is a object heavier then 20 gram else if the game is not over and the in on object the servo motor will spin.

Movement() : here i created a function if it detect a players hand in centimeter. i have set it in 30cm. If the distance is greater than the servo will spin.

WheelCodes() : in this function i made sure to make te value of the potentiometer easy to read by giving it a a boundary. if the value is the same as the random value a led light will turn on.

button.tick() : In the button fuction i created 2 different functions. 1 is to count the amount of times the button is been pressed. if the times it is pressed the same as the random value a led light will turn on. the second function is a reset funtion. This wil be activated by holding the button for longer the 1 second and release. With this it will also create new random values and reset the timer and the servo moter.

Downloads

Soldering

20210528_154633.jpg
20210528_154647.jpg

After the coding and that all the components work as we wanted wecan start soldering. Frist fuse the wires and resistors with the components the same way as the were connected in the breadboard. when that is done put those wires through the holes we made earlier in the cardboard box when that is done use the pins and place it in the right outputs on the arduino, then place the PCB on the arduino. Also i recomment to use somesort of metal wire to place it against the GND and V5 each apart. also place the resistor for the pressure sensor against the wires on the GND. now place all the wires that's for the GND against the metaal wire that is connected to the GND. Do the same thing for the V5 but ofcource with the wires that is connected with the 5V. after that we can connect the remaining wires with the pins that are going through the PCB and solder this together, except the pressure sensor. place this output wire between the resistor and the output pin and fuse these 3 together.

When you are done with the soldering make sure to make attach the arduino in the box and the battary an the stick.

Play and Have Fun !!

If everthing is done the only thing that must be done is to place the servo motor on the right slat. put a wire through the servo and use a nail to hold the guillotine in place.

Now you can play the game !!!