Table of Contents

DIY Automatic Chocolate Dispenser: A Festive Project for Sharing Treats with Santa

Project Description
Learn how to make an automatic chocolate dispenser to delight Santa this Christmas. All components can be found in the evive Starter Kit. Let’s begin!


‘Tis the season of joy, giving gifts, and sharing sweets and treats! How about doing something special for Satns this time? Learn how to make your own automatic chocolate dispenser a.k.a. a chocolate vending machine and make your Christmas sweeter than ever before by sharing treats with dear Santa! All the electronic components that you need to make the chocolate dispenser is available in the evive Starter Kit. And you can program it without any kind of hassle in PictoBlox – a Scratch block based graphical programming software. You can download PictoBlox from HERE.

What is more, is that the automatic chocolate dispenser can also act a beautiful piece of Christmas decor!

So, are you ready for some “sweet” DIY?

Let’s begin!

Collecting the 3D Printed Parts

Before we begin the assembly of our chocolate vending machine, we need to 3D printed some of the components.

You can directly download the STL files from Thingiverse

Setting the Servo Angle

Once, we have all the 3D printed parts ready!

We can start the assembly, but there is just one more thing that we need to make sure. i.e the metal servo angle should be 0°.

Thus, to ensure that we’ll check the angle using evive– an Arduino embedded all-in-one prototyping platform.

  1. Take a metal servo and connect it to evive’s Servo Channel 1 i.e. S1.
  2. Then, switch ON evive.
  3. From the menu select Controls.
  4. Then navigate to Servos.Control Menu Servo Selected
  5. Finally, select Servo 1 as we have connected our servo to Servo Channel 1.Servo Select Menu
  6. Now, set the angle to 0° using potentiometer 1.

Making the Dispensing Mechanism

Let’s begin by making the chocolate dispensing mechanism with the metal servo and the 3D printed parts.

  1. First, take the 3D printed gear, slider and the baseplate.
  2. Next, mount the servo motor onto the baseplate using M3 bolts of 12mm length such that the servo head faces outwards.Making Automatic Chocolate Dispenser
  3. Then, place the slider inside the slot given on the baseplate.
  4. Finally, fix the gear onto the servo head such that the teeth of the gear match the teeth on the slider.Making Automatic Chocolate Dispenser

Making the Structure of the Chocolate Dispenser

Now that the dispensing mechanism is ready, it’s time to make the chocolate/candy dispenser.

evive Notes Icon
We’ll be using a combination of red and white corrugated sheets, the Christmas colours, for making the box. You can even make the dispenser using the colour of your choice or even using thick cardboard.

We will first make the structure of the box i.e. the top and the bottom plate and the sidewalls and then add the details in them in the later steps.

  1. For making the top and bottom side of the dispenser box. Take a white corrugated sheet and cut two squares of 17 cm * 17 cm each. Making the Candy Dispenser
  2. Next, are the sidewalls. Take the red corrugated sheet of 60 cm * 15 cm.
  3. Now, mark three lines 15cm apart from each other along the 60 cm side to make the four sides of the box.
  4. Next, cut along those lines and fold it into a box to make the sidewalls of the dispenser.Making the Candy Dispenser
    evive Notes Icon
    Make sure that you only cut through the first layer so that the sheet can be folded easily.
  5. With this, the basic structure of the candy dispenser is ready.

Making the Candy Collector Box

Now, we would need a box i.e. the collector or the storage box to collect the dispensed box, if you don’t want your chocolates to fall on the ground.

  1. Take a piece of white corrugated sheet of size 10 cm * 18 cm.
  2. Now mark two lines leaving 5cm from both the edges.
  3. Cut along the lines marked and fold it along.
    evive Notes Icon
    Make sure to cut through the first layer of the sheet only. 
  4. With this, we have a pair of two opposite sides and the bottom of the box.
  5. Next, take two rectangles of size 5 cm * 8 cm from the red corrugated sheets to make the remaining sidewalls.Making the Vending Machine

With this, your collector box is ready.

Making the Globe to Hold the Chocolates

Now, comes the globe, that is the container for holding the chocolates into your chocolate vending machine. This is where all your chocolates/candies will be hidden before being dispersed.

  1. Take a white corrugated sheet of 10 cm * 24 cm.
  2. Next, mark three lines at 4 cm, 12 cm and 16 cm along the longer side i.e. along the 24 cm side.Making the Vending Machine
  3. Next, cut along the first layer of the marked lines.
  4. Fold along the lines and glue them together to make the globe.
  5. Next, take a red corrugated sheet of 8 cm *3 cm, the chocolate support plate that will give appropriate level to the chocolates so that it could be dispensed easily. 

Now that we have the structure of all the parts of our vending machine ready, it’s time to add the details.

Adding the Details to our Vending Machine

It’s time to add small details into our vending machine. Make sure you follow each of them carefully.

  1. Take the globe, a.k.a the candy holder and cut out a small rectangle of 2 cm * 2 cm from one side of the globe for the slider.
  2. Next, cut another rectangle of 8 cm * 2 cm on the opposite side of the first rectangle on the globe for dispensing chocolates. 
  3. Then, glue the chocolate support plate at the bottom end of the globe.Making the Vending Machine
  4. Now, take the corrugated sheet with sidewalls and cut out a rectangle of 8 cm * 2 cm from the bottom left corner of the front sidewall leaving 1 cm from the left side for dispensing the chocolates.Making of the chocolate Dispenser

Decorating the Chocolate Vending Machine

Since ‘CHRISTMAS IS COMING‘. let’s make the chocolate dispenser more “Christmas-y”!

Glue the Santa cutout on the front plate i.e. on the plate with rectangle on it. You can decorate it the way you want it to.Making of the Automatic Chocolate Dispenser

Also, make two holes into the eyes of the Santa of the size of the ultrasonic sensor.Making of the Chocolate Dispenser 

Completing the Chocolate Dispenser Assembly

Now all the components are ready, it’s time to assemble the dispenser. 

  1. Firstly, let’s assemble the side walls.
  2. Take the base plate and draw a square of 15 cm * 15 cm on it.
  3. Next, take the sidewalls and glue them to the base plate on the markings using hot glue.
  4. Now, let’s attach the globe.
  5. Match the slots on the globe and sidewalls and carefully glue the globe to the bottom plate using hot glue.Making the Candy Dispenser
  6. Next, place the dispensary mechanism behind the globe and make sure that the slider fits into the slot on the globe perfectly.Making the Automatic Vending Machine
  7. Now, let’s make our vending machine automatic i.e. it’s time to add the ultrasonic sensor.
  8. Attach the ultrasonic sensor on the front wall behind Santa’s face. Make sure that it fits into the ultrasonic sensor perfectly.Fix the ultrasonic sensor into the dispenser
  9. Now, glue the storage box for catching the chocolates into the front of the vending machine using the hot glue. Again, make sure that the slots on the front side and the storage box.Candy Dispenser
  10. Finally, take the top/lid of the box.
  11. Now, draw a line 3 cm from one of the edges and cut along it only through the first layer. This makes the lid opening and closing easy.
  12. Finally, attach the lid to the top of the box.

With this, the assembly is done.

Don’t forget to fill the globe with delicious treats for you and your friends.

Making the Connections

We are going to connect the Metal Servo and the Ultrasonic Sensor to evive.

  • Connect Metal Servo to evive’s Servo Channel 1.
  • Connect Ultrasonic Sensor as:
    • VCC pin to evive’s +5V pin.
    • GND pin to evive’s GND pin.
    • TRIG pin to evive’s Digital pin 2.
    • ECHO pin to evive’s Digital pin 3.Chocolate Dispenser Connection Diagram

Coding your Chocolate Vending Machine

The program will start executing when evive starts up. It will continuously monitor the readings from the ultrasonic sensor whose trig and echo pins are connected to Digital Pins 2 and 3 respectively.

If the distance is less than 10cm, we’ll set the servo connected to Channel 1 to 180° so that the slider moves outwards, causing the chocolates to fall. Otherwise, the servo will remain in the default position, i.e. at 0°.

Chocolate Dispenser Code


With this, your DIY automatic chocolate dispenser is ready. Have a sweet Christmas! ????

Project Downloads - Code and Files

Circuit Diagram

Circuit Diagram DescriptionCircuit Diagram Fritzing Diagram

We are going to connect the Metal Servo and the Ultrasonic Sensor to evive.

  1. Connect Metal Servo to evive’s Servo Channel 1.
  2. Connect Ultrasonic Sensor as:
    1. VCC pin to evive’s +5V pin.
    2. GND pin to evive’s GND pin.
    3. TRIG pin to evive’s Digital pin 2.
    4. ECHO pin to evive’s Digital pin 3.

Explore Related Projects by STEMpedia

Level up your robot control skills by learning how to control a 2-Wheel Drive Robot with hand gestures using PictoBlox AI's Machine Learning extension. Get ready to channel your inner Jean Grey!
Learn how to make a two-wheel-drive robot and code on the go with PictoBlox's mobile app. Control your robot in real-time with your smartphone!

Explore Community Projects