Build Your Own Syrup Dispenser Machine

by TylerDDDD in Circuits > Arduino

271 Views, 4 Favorites, 0 Comments

Build Your Own Syrup Dispenser Machine

Custom Syrup Dispenser Machine

This Instructable will guide you through building a custom syrup dispenser machine.

This device automatically dispenses water or a water-syrup mixture. It includes a button to adjust the syrup percentage, allowing you to control the sweetness from mild to strong.

The machine's body is custom-designed and 3D-printed, with laser-cut components for precision. The electronics are powered by an Arduino ESP32-WROOM-DA with a custom program, and the pumps are 12V DC-powered.

Let’s get started!

Supplies

Capture d’écran 2024-12-25 à 17.51.49.png

Materials Needed

  1. 3D Printing & Laser Cutting:
  2. 3D printer (FDM or SLA)
  3. Laser cutter
  4. PLA or ABS filament for 3D printing
  5. Acrylic sheets for laser cutting
  6. Electronics:
  7. Arduino ESP32-WROOM-DA
  8. Custom PCB (optional for tidy wiring)
  9. 12V DC water pump (2 units)
  10. Power supply (12V, 2A minimum)
  11. Push button (2 units)
  12. 12V power supply
  13. Potentiometer or rotary encoder (optional for fine-tuning)
  14. One 12V relay module
  15. Optional : OLED screen
  16. Wires, connectors, and a soldering kit
  17. Miscellaneous:
  18. Tubing (food-grade) for water and syrup
  19. Syrup and water reservoirs (bottles or containers)
  20. Fittings to secure tubing
  21. Screws and nuts for assembly
  22. Tools (screwdrivers, pliers, etc.)


Note : the links are part of the Amazon associates program.

Design and Print the Body

Capture d’écran 2024-12-25 à 17.00.31.png
Capture d’écran 2024-12-25 à 17.03.18.png

If you want to start from scratch, you need to :

  1. Use CAD software like Fusion 360 or TinkerCAD to design the machine's body.
  2. Include slots for the pumps, Arduino, button, and tubing.
  3. Design mounting points for secure placement of electronics and reservoirs.
  4. Export the design files and 3D print the body components.
  5. For any flat panels or decorative elements, use a laser cutter to cut acrylic sheets based on your design.

You can also use my designs on GitHub :

  1. box_bottom.stl
  2. box_middle.stl
  3. box_pipe.stl
  4. box_top.stl
  5. box_top_trou.stl

In that case just you have to download the files, slice them with Cura, and load the gcode files on your 3d printer.

Assemble the Electronics

Capture d’écran 2024-12-26 à 09.26.59.png
Capture d’écran 2024-12-25 à 17.02.47.png
Capture d’écran 2024-12-25 à 17.04.02.png

Follow those steps :

  1. Connect the pumps to the Arduino via the relay module.
  2. One pump will handle water.
  3. The second pump will handle syrup.
  4. Wire the push button to an input pin on the Arduino.
  5. Program the button to cycle through syrup strength levels (e.g., low, medium, high).
  6. Power the pumps using the 12V power supply.
  7. (Optional) Design a custom PCB to neatly organize the connections.

The pinout connections are commented in the Arduino Code at the beginning of the program :

// -- -----------
// Declaratives
// -- -----------
// Declaratives, buttons
int POT = 15; // Assign POT pin D15
int WATER = 21; // Assign WATER pin D2
int RED = 19; // Assign RED pin D4
int R_PUMP = 22; // Assign R_PUMP pin D22
int W_PUMP = 23; // Assign W_PUMP pin D23


Programming the ESP32

Capture d’écran 2024-12-25 à 17.04.35.png
Capture d’écran 2024-12-25 à 17.05.26.png

Steps to follow :

  1. Download the Arduino Code from GitHub : file CocktailMachine.ino.
  2. Use the Arduino software to compile and upload the code to the ESP32 board.

Many documentation on internet explain how to use the Arduino software.

Copy of the code, that is also available on GitHub :

// -- -----------------------------------------
// CocktailMachine
//
// v1.0 - Initial version
// -- ------------------------------------------

// -- -----------
// Declaratives
// -- -----------
// Declaratives, buttons
int POT = 15; // Assign POT pin D15
int WATER = 21; // Assign WATER pin D2
int RED = 19; // Assign RED pin D4
int R_PUMP = 22; // Assign R_PUMP pin D22
int W_PUMP = 23; // Assign W_PUMP pin D23

int TEMPO_POT_MAX = 4095; // max tempo for the pot
int TEMPO_WATER_MAX = 9000; // max tempo for the water
int TEMPO_RED_MIN = 1000; // max tempo for the red
int TEMPO_RED_MAX = 3000; // max tempo for the red

// Declaratives, others
boolean blocked = false; // block flag
int waterState = 0; // GO button state
int redState = 0; // BLUE button state
int potValue = 0; // value read from the pot
int tempo = 0; // tempo when a pump is on

// Declaratives, graphics and font library
#include <TFT_eSPI.h>
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI(); // Invoke library

// -- -----------
// Setup
// -- -----------
void setup() {
Serial.begin(9600);

tft.init(); // init TFT
tft.setRotation(1); // init TFT
initTFT(); // init TFT

pinMode(WATER, INPUT); // déclarer la broche comme entrée
pinMode(RED, INPUT); // déclarer la broche comme entrée
pinMode(R_PUMP, OUTPUT); // déclarer la broche comme sortie
pinMode(W_PUMP, OUTPUT); // déclarer la broche comme sortie

digitalWrite(R_PUMP, HIGH); // initial value
digitalWrite(W_PUMP, HIGH); // initial value

}

// -- -----------
// Loop
// -- -----------
void loop() {
waterState = digitalRead(WATER); // init GO
redState = digitalRead(RED); // init RED
potValue = analogRead(POT); // read POT value

delay(1000); // tempo
if ( redState == LOW and waterState == LOW ) { // no buttton pushed
blocked = false;

}

// * -- -----
// * 1. RED
// * -- -----
if ( redState == HIGH and not blocked) { // RED pressed
tempo = map( potValue, 0, TEMPO_POT_MAX, TEMPO_RED_MIN, TEMPO_RED_MAX); // pump tempo
tft.fillScreen(TFT_RED); // does not work

// pump RED
Serial.println("");
Serial.println("Pump ON for RED");
digitalWrite(R_PUMP, LOW);
digitalWrite(R_PUMP, HIGH);

// pump WATER
tempo = TEMPO_WATER_MAX - tempo;
Serial.println("Pump ON for WATER");
digitalWrite(W_PUMP, LOW);
delay( tempo ); // Pump WATER
digitalWrite(W_PUMP, HIGH);
blocked = true;

} else { // RED not pressed
// * -- -----
// * 2. WATER
// * -- -----
digitalWrite(R_PUMP, HIGH);
tft.fillScreen(TFT_BLUE); // does not work
if ( waterState == HIGH and not blocked ) { // WATER pressed
// pump WATER
tempo = TEMPO_WATER_MAX;
Serial.println("");
Serial.println("Pump ON for WATER");
digitalWrite(W_PUMP, LOW);
delay( tempo ); //
digitalWrite(W_PUMP, HIGH);
blocked = true;

} else { // RED and WATER not pressed
// * -- -----
// * 3. WAIT
// * -- -----
Serial.print(".");

}
}
}

// -- -----------
// Init TFT
// -- -----------
void initTFT() {
// background
tft.fillScreen(TFT_BLACK);

// test header
tft.setCursor(0, 0);
tft.setTextSize(2);
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.println("Syrup Machine");
tft.println("Welcome !!");
tft.println("");
tft.println("Make a choice");

// text body
tft.setTextColor(TFT_RED, TFT_BLACK);
tft.println(" BLUE button");
tft.setTextColor(TFT_BLUE, TFT_BLACK);
tft.println(" RED button");

}

Final Assembly

Capture d&rsquo;&eacute;cran 2024-12-25 &agrave; 17.07.10.png
Capture d&rsquo;&eacute;cran 2024-12-25 &agrave; 17.06.14.png

Follow the steps below :

  1. Install the pumps, Arduino, and button into the 3D-printed body.
  2. Connect the tubing from the reservoirs to the pumps and then to the output spout.
  3. Secure all components using screws or adhesive as necessary.
  4. Test for leaks and ensure all connections are tight.

Testing and Calibration

Custom Syrup Dispenser Machine

Try and adjust :

  1. Fill the water and syrup reservoirs.
  2. Power on the machine.
  3. Test the button to adjust syrup strength and observe the output.
  4. Fine-tune the program if necessary to adjust timings or flow rates.

Congratulations! You’ve built your own syrup dispenser machine. Enjoy crafting perfectly mixed beverages!

Next Steps

As future build, this machine could be enhanced to propose more than one syrup. Also a cocktail machine could also be developed..