Introduction of the machine:
This is a toy collection reward machine. If you put the toy in the toy box. The reward machine will sense that something is put in the box and then give lighting and sound feedback for reward. Kids would be inspire by the machine that they should always clean up the toys and place them in the toy box.
Let's Start to build the machine.
Step 1: Prepare the Materials Listed
- Arduino Leonardo X1
- Ultrasonic Distance Sensor X1
- LCD screen (16 x 2 character) X1
- Breadboard X1
- Dupont Lines
- Jumper Wires
- USB cable X1
- LED(red) X1
- 82 Ohm resistance X1
- Cardboard box (24 x 18.5 x 9.5cm ) X1
- Speaker X1
Step 2: Assemble the Breadboard
- Attach the Ultrasonic Distance Sensor on the breadboard
- Use Jumper wires to connect Ultrasonic Distance Sensor breadboard to the Arduino Leonardo (as the picture shown below)
Gnd should connect to Gnd on Arduino Leonardo
Echo should connect to A4 on Arduino Leonardo
Trig should connect to A5 on Arduino Leonardo
Ucc should connect to 5V on Arduino Leonardo
- Attach the LCD screen on the breadboard
- Use the Jumper wires to connect LCD screen breadboard to Arduino Leonardo (as the picture shown below)
GND should connect to (-) on Breadboard
VCC should connect to (+) on Breadboard
SDA should connect to SDA on Arduino Leonardo
SCL should connect to SCL on Arduino Leonardo
- Attach the (-) on Breadboard to GND on Arduino Leonardo (power)
- Attach the (+) on Breadboard to 5V on Arduino Leonardo (power)
- Attach the LED light on the breadboard by using Dupont lines
Connect the (+), which is the longer base of the LED light that connect to the Dupont line, on the Breadboard
Connect the Dupont line on Breadboard to digital pin 13 on Arduino Leonardo by using jumper wire
Connect the (-), which is the shorter base of the LED light that connect to the Dupont line, on the Breadboard
Connect the Dupont line on Breadboard by using 82 Ohm resistance to (-) on the Breadboard
- Attach the speaker
Connect (-) of the speaker, which is the black line to GND on Arduino Leonardo
Connect (+) of the speaker, which is the red line to digital pin 11 on Arduino Leonardo
Step 3: Write the Code. the Code Is Provided.
Step 4: Test the Machine. It Should Be Successfully Functioning.
Plug in the USB cable, which connected from the computer you wrote the code to Arduino Leonardo, so you can upload your code.
Step 5: Design the Cardboard Box.
- Cut a 3X2 hild at the side of the box. It will be the hole that the USB cable can pass through. (Caution: The USB cable is use to connect Arduino Leonardo and a powerbank).
Paint the Cardboard box with any color you like. For the case, I use Acrylic paint to paint the Cardboard box.
Stick the LED light at the cover of the Cardboard box. In order to make the the machine more favorable, you could find a Matte cap to cover the LED light, so the light would not be that dazzling.
Stick the Ultrasonic Distance Sensor at the outside of the Cardboard box. It should be stick at the same side as the LED light.