ESP32-Based Bluetooth-Controlled Cocktail Drink Mixer with Peristaltic and Diaphragm Pumps
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit designed to control multiple pumps and LED rings using an ESP32 microcontroller. The circuit includes various components such as peristaltic pumps, a diaphragm water pump, an ultrasonic sensor, and LED rings. The ESP32 microcontroller is programmed to control these components based on Bluetooth commands and distance measurements from the ultrasonic sensor.
Component List
Mini Diaphragm Water Pump
- Pins: Positive (+), Negative (-)
- Description: A small water pump used for liquid transfer.
- Purpose in Circuit: Used to pump liquids at a rate of 1.4L/min.
USB Module
- Pins: RX, TX, VCC, GND, DTR, CTS
- Description: A USB to TTL converter module.
- Purpose in Circuit: Used for programming and communication with the ESP32 microcontroller.
Peristaltic Pump
- Pins: GND, 12V
- Description: A high-flow peristaltic pump for dosing liquids.
- Purpose in Circuit: Used to pump liquids at a rate of 150ml/min.
Power Supply 5V 5AMP
- Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)
- Description: A power supply unit providing 5V and 12V outputs.
- Purpose in Circuit: Supplies power to the entire circuit.
HC-SR04 Ultrasonic Sensor
- Pins: VCC, TRIG, ECHO, GND
- Description: An ultrasonic distance sensor.
- Purpose in Circuit: Measures the distance to detect the presence of a glass under the dispenser.
AC Wire
- Pins: Line, Earth, Neutral
- Description: Standard AC power wire.
- Purpose in Circuit: Connects the power supply to the AC mains.
ESP32 8-Relay Board
- Pins: Multiple pins including NO, COM, NC, TX, RX, IO0, G23, G22, TXD, RXD, G21, 3V3, 5V, GND
- Description: An ESP32 microcontroller with an 8-relay board.
- Purpose in Circuit: Controls the pumps and LED rings based on Bluetooth commands and sensor inputs.
16 LED Ring
- Pins: DI, 5V, GND, DO
- Description: A ring of 16 WS2812B LEDs.
- Purpose in Circuit: Provides visual feedback and lighting effects.
12 LED Ring
- Pins: DI, 5V, GND, DO
- Description: A ring of 12 WS2812B LEDs.
- Purpose in Circuit: Provides visual feedback and lighting effects.
Wiring Details
Mini Diaphragm Water Pump
- Positive (+): Connected to NO6 on the ESP32 8-Relay Board.
- Negative (-): Connected to GND (DC) on the Power Supply.
USB Module
- VCC: Connected to 5V on the ESP32 8-Relay Board.
- GND: Connected to GND on the ESP32 8-Relay Board.
- RX: Connected to TX on the ESP32 8-Relay Board.
- TX: Connected to RX on the ESP32 8-Relay Board.
Peristaltic Pump
- 12V: Connected to NO1, NO2, NO3, NO4, NO5 on the ESP32 8-Relay Board.
- GND: Connected to GND (DC) on the Power Supply.
Power Supply 5V 5AMP
- 220V Positive Pole (AC): Connected to Line on the AC Wire.
- 220V Negative Pole (AC): Connected to Neutral on the AC Wire.
- GND: Connected to Earth on the AC Wire.
- GND (DC): Connected to GND on the ESP32 8-Relay Board and GND of all pumps.
- 12V-24V Output (DC): Connected to COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, and 7-30V on the ESP32 8-Relay Board.
HC-SR04 Ultrasonic Sensor
- VCC: Connected to 5V on the ESP32 8-Relay Board.
- TRIG: Connected to G22 on the ESP32 8-Relay Board.
- ECHO: Connected to G23 on the ESP32 8-Relay Board.
- GND: Connected to GND on the ESP32 8-Relay Board.
AC Wire
- Line: Connected to 220V Positive Pole (AC) on the Power Supply.
- Neutral: Connected to 220V Negative Pole (AC) on the Power Supply.
- Earth: Connected to GND on the Power Supply.
ESP32 8-Relay Board
- NO1: Connected to 12V of a Peristaltic Pump.
- NO2: Connected to 12V of a Peristaltic Pump.
- NO3: Connected to 12V of a Peristaltic Pump.
- NO4: Connected to 12V of a Peristaltic Pump.
- NO5: Connected to 12V of a Peristaltic Pump.
- NO6: Connected to Positive (+) of a Mini Diaphragm Water Pump.
- NO7: Connected to Positive (+) of a Mini Diaphragm Water Pump.
- NO8: Connected to Positive (+) of a Mini Diaphragm Water Pump.
- COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8: Connected to 12V-24V Output (DC) on the Power Supply.
- GND: Connected to GND (DC) on the Power Supply.
- 5V: Connected to VCC on the USB Module and 5V of the LED Rings.
- TX: Connected to RX on the USB Module.
- RX: Connected to TX on the USB Module.
- G21: Connected to DI on the 16 LED Ring.
- G22: Connected to TRIG on the HC-SR04 Ultrasonic Sensor.
- G23: Connected to ECHO on the HC-SR04 Ultrasonic Sensor.
16 LED Ring
- DI: Connected to G21 on the ESP32 8-Relay Board.
- 5V: Connected to 5V on the ESP32 8-Relay Board.
- GND: Connected to GND on the ESP32 8-Relay Board.
- DO: Connected to DI on the 12 LED Ring.
12 LED Ring
- DI: Connected to DO on the 16 LED Ring.
- 5V: Connected to 5V on the ESP32 8-Relay Board.
- GND: Connected to GND on the ESP32 8-Relay Board.
Documented Code
Cocktail Drink Mixer Code
#include "BluetoothSerial.h"
#include <Adafruit_NeoPixel.h>
#define LED_PIN 21 // pin til led ring
#define LED_COUNT 28 // antal WS2812B LEDs tilsluttet ESP32
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); // opsætning af NeoPixel library
BluetoothSerial ESP_BT;
char bt_data;
// pin til afstandstest "glas under"
#define trig 22 // blå
#define echo 23 // grøn
#define SOUND_SPEED 0.034
long duration;
float distanceCm;
int glas_under = HIGH;
//--
int orange = 32; // relæ1
int dry_lemon = 33; // relæ2
int caramel = 25; // relæ3
int apricot = 26; // relæ4
int lime = 27; // relæ5
int sprite = 14; // relæ6
int lemon = 12; // relæ7
int cola = 13; // relæ8
//--
int TIME4CL = 25000; // indstilles til at give 4 centiliter med Peristaltic pumpe 150ml/min.
int TIME2CL = 12500; // indstilles til at give 2 centiliter med Peristaltic pumpe 150ml/min.
int TIME1CL = 6250; // indstilles til at give 1 centiliter med Peristaltic pumpe 150ml/min.
int SODA10CL = 5000; // indstilles til at give 10 centiliter med alm. pumpe 1,4L/min.
int SODA8CL = 4000; // indstilles til at give 8 centiliter med alm. pumpe 1,4L/min.
int S