Candy Machine

Introduction: Candy Machine

I really like to eat sweets, especially chocolates, so I decided to make a candy machine. On one side, it can control me from eating too much candy a day, and on the other side, it can make me more willing to do housework and getting a good grade. When I do the right things, like cleaning the house, or getting a good grade. My mom will give me a special ball, and with this ball, I can get chocolate from the candy machine!

Step 1: Prepare the Materials

- Arduino Leonardo (Arduino)

- Arduino Breadboard (Amazon)

- Micro Arduino Servo Motor SG90 (Amazon)

- Male to Male Breadboard Jump Wires (Amazon)

- Male to Female Breadboard Jump Wires (Amazon)

- USB Cable for Arduino Leonardo (Sparkfun)

- Charger (Amazon)

- Switch Push Button for Arduino x1 (Amazon)

- LED - red x1, green x5 [you can choose your own color] (Amazon)

- 100-ohm Resistor Kits x6 (SpikenzieLabs)

- 1K-ohm Resistor Kits x1 (Amazon)

- Hot Glue Gun (Amazon)

- Coil-spring x2 (Amazon)

- Super Glue Gel (Amazon)

- Popsicle Sticks x3 (Amazon)

- Disposable Round Chopsticks (Amazon)

- Paper Tape (Amazon)

- Cardboard (Amazon)

- Transparency Paper Film (Amazon)

- Lock (Amazon)

- M&M Chocolate (Amazon)

- Ball

- Plastic Cup

Step 2: Code

Step 3: The Circuit

  1. Plug in all the wires into the Arduino Breadboard following the circuit picture on top.

  2. Remember to plug the 5V on the Arduino Leonardo into the positive part of the breadboard, and the GND on the Arduino Leonardo into the negative part of the breadboard.

  3. D-pin 9, 10, 11, 12, 13 are for the green LEDs, d-pin 8 is for the red LEDs, and d-pin 2 is for the button.

  4. D-pin 4 is for the servo, it must be the white wire on the servo to connect the D-pin, neither red nor black wire will work, because red wire on the servo is for the positive part of the breadboard, and the black wire on the servo is for the negative part of the breadboard.

  5. LED's longer leg must connect with d-pin and the shorter leg must connect with a 100-ohm resistor kit, or else LED won't light.

Step 4: Create the Candy Machine

1. Follow the pictures on top, draw it on to the cardboard, be sure that the length you draw on the cardboard is the same as the picture on top, there will have several pictures of the whole machine down the bottom, when you are making it, you can look at those pictures too, to see if you do it correctly or not, or else your machine might not succeed.

2. Cut out all the pieces you draw, you can label the board you cut out just like what I use in the picture, using alphabet or word, which is easier for you to know which board is which one.

3. Do not throw the board "X" away, it will turn into the cap of the place where you put candy into, the cap is pretty small, which people's hands can not enters, to prevent people from stealing the candy from the machine. Also, stick board "Y" onto the middle of board "X", forming a handle of the cap, which is easier for you to open and putting candy in.

4. Cut a popsicle stick vertically into half (pic 10: the vertical and horizontal of a popsicle stick), stick one of the halves onto the board "F" using either a hot glue gun or a super glue gel just like pic 11.

5. While waiting for it to dry, cut another popsicle stick horizontally into half, remember to cut out the front and the end part of the popsicle stick, make it look like a rectangle shape, the length of the popsicle stick you cut must be 12 cm long, it need to be about the same size as the board "G", since the cut-out popsicle stick needs to stick on to the top of board "G", after cutting out the popsicle stick, stick it onto board "G" using either a hot glue gun or a super glue gel, just like pic 12. Also, stick both coil-spring on both sides of the board "G" using super glue gel, about the same position as board "H" which the two side protruding should be the place where the coil-spring should be, don't use too much glue on the coil-spring, or else, when the glue dry, the coil-spring will become hard, losing elasticity, stick it just like pic 12.

6. Cutting another popsicle stick horizontally into half, just like step 5, turn the popsicle stick into a rectangle shape with the length of 10 cm, you need to make two of it, one for board "D", and another for board "E", then stick both popsicle stick on to both boards by using either a hot glue gun or a super glue gel just like pic 13.

7. Stick board "A1, B1, C1" together into a "ㄇ" shape, the two sides of the "ㄇ" shape use "A1 and B1" they are in the same size, and the middle uses "C1", which the length is a bit longer. After sticking those three boards into a "ㄇ" shape, stick the two boards you made on step 6 (board 'D and E") on to the inside of the both "A1 and B1" down at the bottom just like pic 14.

8. Stick the board "G" onto the "ㄇ" shape you make on step 7 using super glue gel, remember to cut two short pieces of disposable round chopsticks, a bit longer than the coil-spring, and stick it into the coil-spring, to maintain the coil-sping move in the right direction.

9. Stick board "A1" with "A2", "B1" with "B2", and "C1" with "C2", to make the length longer, so that you don't need to let the place candy come out hanging on the machine, by making the length longer, it can make it more stable by connecting on to the ground.

10. Stick board "H" on to board "G", and stuck in the board "F" into the disposable round chopsticks of board "G" which forms the place where the candy comes out.

11. Stick board "front, bottom, top, left, and right" together forming a box, remember not to stick the board "back" before finish the whole machine, because it is the place where you place Ardunio in.

12. Stick the things you made in step 10 where candy comes out, on to left front top inside the box, which is the place you cut a hollow in the board "front", the top 12x10 hollow. Also, stick a transparency paper film on the hollow in the board "front", the top 12x10 hollow one, so you can see the amount of candy inside the machine.

13. Stick board "K, L and M" into a "ㄇ" shape but a long one like a track, and board "K and L" will be the two sides, and board "M" will be the middle. After sticking it, stick the whole track into the right side of the machine which the hollow in the board "front", the top 3x3 hollow one, the place where you throw your ball in.

14. Stuck the button onto board "J", and stick board "I and J" right down the track, which when you throw the ball in, it will follow the track and hit the button down below which is board "I", and board "J" is just to guide the ball to go to place using the board "N" to make, prevent the balls to go around the machine.

15. Stick board "O, P, and Q" together, remember to separate the thing on top of the servo and stick it on to board "O", just like pic 15, forming a fence, prevent people from eating the candy secretly.

16. Plug the LEDs into the circle's holes in the broad "front", and make sure the order of LED turns dark is correct, you can look back at the code to check if you plug in the wrong holes.

17. Plug the servo into the rectangle hole 3.5x7 of the board "front", and stuck the fence you made in step 15 onto the servo, stuck it tight, making sure that when the servo moves, the fence will not falls off.

18. Put Arduino into the machine, remember to make sure that all things are stable tightly. Stick the board "back" using high tensile paper tape on to the machine, using tape instead of glue, and stick a lock on to it, because the machine's door would like to be can either open or close, for you to take out the ball, but the door has a lock which only if you know the password you can open the box to take out the ball.

19. Put in the M&M!!!! And put the cup into the machine. (Your machine should be like pic 16)

20. Decorate your Machine!

Step 5: How to Operate

1. Put the special ball into the machine.

2. The red LED lights, showing the machine starts.

3. The fence will open.

4. Press the button for candy to come out.

4. The 5 green LED lights, showing the people who use it only have five seconds to get as many M&M he or she can, and as one second pass, one of the green LED will turn dark, two second pass, another green LED will turn dark and so on.

5. As all green LED turns dark, the fence will close.

6. As the fence close completely, the red LED will turn dark too, showing the machine closes.

7. Eat M&Ms~~~!!!

Be the First to Share

    Recommendations

    • Metal Contest

      Metal Contest
    • Fruit and Veggies Speed Challenge

      Fruit and Veggies Speed Challenge
    • DIY Summer Camp Contest

      DIY Summer Camp Contest

    4 Comments

    0
    梁秉毅
    梁秉毅

    2 months ago

    不好意思,請問創作者是否有此糖果機內部的構造圖供我參考嗎?因為上面那幾張圖片有點看不太懂⋯⋯還有那個鎖是要用在哪個地方,如果沒有鎖可以嗎?

    0
    梁秉毅
    梁秉毅

    Reply 2 months ago

    裡面的構造

    0
    gavthelegoman
    gavthelegoman

    6 months ago

    so cool i wish i could make this!

    0
    Vanessa Lee
    Vanessa Lee

    Reply 4 months ago

    You should try! It's very fun!