Marshmallow Dispenser

Completed: November 25, 2025
What better way to warm up the winter holidays than with a marshmallow dispenser for hot chocolate! I was recently gifted the Bambu Lab A1, 3D printer for my birthday, and wanted to create a small project I could complete over Thanksgiving break while I was home. The marshmallow dispenser uses an Arduino Uno R3 microcontroller, an SG90 micro servo motor, and a joystick to release the perfect amount of marshmallows into a mug with hot chocolate.


Figure 1. Marshmallow Dispenser Final Product
Constraints & Goals
Constraints:
-
Be able to make the device with free parts and tools available in the house.
-
Make the device as small as possible (just big enough to fit the electronics and hold a coffee mug on the platform).
-
Keep all the electronics hidden.
-
No soldering involved.
Goals:
-
Pulling a lever should release marshmallows into a cup of hot chocolate.
-
Device should work universally with any mug or cup.
-
Make as few reprints as possible (to save money on PLA filament).
​
Constraints and goals were made with the premise that I have a larger project planned for winter break, and its bill of materials is turning out to be expensive. Because of this and the long timeline involved, I decided to create this smaller project to get my feet wet with 3D printing while making a fun device with an actual use case.
Electronics & Code
For the electronics, I used an Arduino Uno R3 microcontroller to control a servo motor, which opens and closes the marshmallow container. The servo motor is activated by pulling down on the joystick module mounted to the side of the device. I got these components from an Elegoo Uno starter kit I bought on Amazon a few weeks ago for around $30, so that I could start working on robotics projects and learn more C++.
​
A few key features of the electrical setup are the servo motor being connected to a PWM pin on the Arduino, which allows for the precise movement of the motor, and the joystick module being connected to A0, an analog pin that converts a variable voltage into a digital value between 0 and 1023. When the joystick is in the center, it reads (512, 512) representing the X and Y coordinates.​​​​​

Figure 2. Final Electrical Setup

Figure 3. Arduino IDE C++ Project Code
Due to the orientation of the joystick and only needing one degree of freedom, the X_pin was used to determine when the joystick was pulled down with the if loop on line 19. Through this, the servo moves to 60 degrees, opening the marshmallow storage to drop marshmallows. Meanwhile, when the joystick isn’t pulled down, the servo remains at approximately 90 degrees to ensure it fully covers the opening of the marshmallow dispenser. A video demonstration of this is shown below:
​
Figure 4. Electronics Demonstration
Computer Aided Design
Concept Design:
​
Something I always do when I start a new engineering project is mock up a concept design in Blender. Blender is an open-source computer-aided design software that focuses less on proper dimensioning and details and more on the overall look and flow of a design.
​
I use Blender as my version of a pen and notepad to quickly sketch designs until I have the concept fully visualized, and it’s great because it’s a 3D concept design I can interact with.

Figure 5: Blender Concept Design
SolidWorks CAD:​
​
After creating the 3D concept design in Blender, I move into SolidWorks to begin creating the final design.
On this project, I worked my way from the bottom up, as the bottom had the majority of the sizing constraints, such as how large the base needed to be for the coffee mug to rest and for the electronics to be stored internally.​
From there, I worked my way up into the second main feature, which was the pillar that would store the servo motor and joystick lever. I implemented features to properly house these two components, with the joystick using spacers and two nuts and bolts to mount it to the inside of the side wall. Mounting the servo motor was a lot more challenging, as I wanted to minimize the size and spacing, yet the servo had no easy-to-use mounting features. In future projects, I will create a separate housing unit with two screw holes and then mount the bottom of the housing into threaded inserts, but for the scope of this project, I decided to stick with a simple solution of super-gluing the servo motor onto an internal beam within the pillar.
​
Just prior to 3D printing, I made sure to measure the full packaging of electronics and ensure they would properly fit in the base. I double-checked the scale of the project in real life and measured a variety of coffee mugs in the house to make sure it would work universally. The goal with this was to minimize the number of design changes and iterations I would have to make once manufacturing began.
​
​


Figure 6: Prototype Design
Manufacturing
The manufacturing and iteration process took a total of two days. Similar to the CAD process, I started by breaking down the printing, assembly, and validation process into smaller steps. Step 1 was to print the base and ensure the Arduino Uno R3, battery, and mini breadboard fit. After confirming this, I ran the electronics and tested how fast I could contract and retract the lever, which revealed a major electronic design flaw. The 9V battery was connected directly to the Arduino, which powered both the servo motor and the joystick module, but this didn’t allow enough current to reach the servo, leading to a drop in current, potentially breaking the entire system.
​
Through this, I learned that I would need to power the servo from a separate power source if I wanted to use any servo stronger than the SG90. However, because of the constraints of the project was that I did not want to spend any money, I ultimately decided to drill a hole into the back of the base so I could power the Arduino via USB and a power block.


Figure 7: 3D Printed Base/Electronic Housing
Catching this early on was great, as I could edit the pillar to include this feature for the cable to run through. Meanwhile, using a drill on the base meant I did not have to reprint the base with a hole, meeting the goal of minimizing reprints.
​
Moving on to the pillar, after manufacturing the part I realized that the bottom screw meant to secure it to the base was unnecessary, since the pillar already fit tightly. This was something I intentionally tested to gauge the 3D printer’s accuracy. Throughout this project, I learned that achieving a proper press fit typically requires a 0.2–0.4 mm clearance, which allows parts to snap together easily while still staying firmly in place.
​
Once I installed the pillar, I realized the joystick module couldn’t fit through any of the openings to be mounted inside. With all the overhangs and support structures the pillar required, I learned that I should have split the design into two parts and used a snap-fit connection. This would have made the assembly process far easier, since wiring and mounting the electronics in the current one-piece pillar was extremely difficult. To avoid wasting filament, I didn’t reprint it, but I’m definitely taking this forward as a key lesson for future projects: design for assembly and manufacturing!

Figure 8: 3D Print of Pillar Feature & Assembly
After putting the entire system together, I discovered the only redesign needed to ensure all the project goals were met: the marshmallow storage/dispensing system did not work. With the cone-shaped feature, marshmallows would get stuck at the bottom. To fix this, I switched to a more cylindrical shape that allowed batches of marshmallows to fall out instantly.



Figure 9: Final Design
Results
With this redesign in place, I reached the final product for the project, which actually turned out very nice. The electronics were hidden, and the device worked exactly as intended, meaning all of the goals and constraints were met. My family and I celebrated by enjoying hot chocolate together and testing the product to ensure reliability.
Figure 10: Demonstration Videos