In this project, we will use the 4Duino-24 and Infrared sensors to create a candy dispenser. 4Duino-24 checks whether a food tray contains enough candy or not. Once the button on the display is touched it will send command to the servo motor to rotate, thus dispensing of the candy is done.
You can also add IR Sensor. Infrared sensor detects if there’s an object beneath the mouth of the dispenser. Once detected it will turn the rotating container 180 degree to dispense candies. The rotating container will then automatically go back to its initial position. The dispensing of candies can also be done manually by touching a button on the display.
- Connecting Wires
- Servo Motor
- Arcylic Boards
- IR sensor
- microUSB Cable
- 5V 1A External DC power supply
Step 1: Build
Build the circuit as shown in the following diagram.
Step 2: Program
Workshop 4 – 4Duino Basic Graphics environment is used to program this project.
This project requires the Arduino IDE to be installed as Workshop calls the Arduino IDE for compiling the Arduino sketches. The Arduino IDE however is not required to be opened or modified to program the 4Duino-24.
Open this file using Workshop 4.
Note: Download the code here.
Step 3: Compile
Click on the “Compile” button.
Note: This step could be skipped. However, compiling is essential for debugging purposes.
Step 4: Comms Port
Connect the 4Duino to the PC using μUSB cable.
Then navigate to the Comms tab and select the Comms port to which the 4Duino connected.
Step 5: Compile and Upload
Finally, go back to “Home” tab. This time, click on the “Comp’nLoad” button.
The Workshop 4 IDE will prompt you to insert a μSD card to the PC in order to save the widget images.
Insert μSD card, select the appropriate drive and press button “OK”.
If the μSD card has the widget images you can click button “No Thanks”.
Step 6: Insert μSD card
After uploading the program in to the 4Duino, it will try to mount the μSD card. If the μSD card is not
present it will prints an error message.
All you need to do is insert the μSD card you saved the image files to into the 4Duino.
After uploading, you can now interface your circuit to the candy dispenser case. You can create your own Candy Dispenser using a simple box, 3D printer or acrylic boards.