Build a robot that can make drinks with Arduino

Any party needs something to talk about, and what’s better than making drinksThe robotA better topic? Not only is this a great conversation starter, it also allows the party promoter to get out and talk to other people instead of standing behind the bar all the time. Mai Tai, the concoction introduced in this article, is not very alcoholic, even for a workplace party!

The bartending robot is actually made from an Arduino microprocessor and lots of pumps. I wrote a simple program to turn the pump on for a specific period of time to make the drink. In its current design, the robot can only make one beverage, but with a few tweaks to the program and input switch, it can make dozens of beverages. The main purpose of this article is to get you started and to learn some basic concepts along the way.

Our bartending robot can make the perfect Mai Tai. There are many Mai Tai labels, too. I like to call this one Margot’s Mai Tai because it’s my wife Margot’s finishing touch, and the main difference is the low alcohol content (going from three shots to a little more than one). If a Mai Tai could be conjured up at the push of a button, too many people would pass out inconveniently. In addition, we used pomegranate syrup and pineapple juice instead of the usual orange juice.

Production process:

1. Mai Tai mixing materials

  • Rum, 30 ml
  • Curacao, 12ml
  • Almond syrup (Orgeat), 5 ml
  • Grenadine Syrup, 6 ml
  • Pineapple juice + lime, 120 ml. You can squeeze 10 limes, plus a gallon of pineapple juice

2. Robot components

  • Arduino Uno microprocessor
  • Small motor (operating current consumption should not exceed 120 mA)
  • Peristaltic pumps for aquariums (2)
  • 12V submersible pump
  • Elegoo resistance block
  • The doorbell switch

3.Make a robot

First, we calibrate the pump to see how fast the fluid flows under 12 V dc. The motors I used were purchased online for about $5 each. When driving the pump, I use about 120mA of current, so I need a power supply that can supply several amps to make the drinks. In addition, another key point is the finishing speed of the drink. In my design, it takes about 35 seconds to make a Mai Tai.

Back of peristaltic pump. You can see a resistor on the blue LED above the pump motor that limits the current. Viewed from the front, the LED blinks when the machine is idle. When making the drink, the LED shows which pump is working

The peristaltic pump delivers a fixed amount of liquid through a ball rolling device and a flexible hose. Such pumps are common in the food and medical industries. In this project, we are using small pumps common in the aquarium industry to deliver chemicals into the aquarium.

The peristaltic pump I use can pump 30ml of liquid in 32 seconds. Please remember to test the pumping speed before creating your project. I started with water to approximate the time, and then tested it with the actual drink. I use a time plot to show the process:

In the figure above, the colored area represents the amount of fluid pumped into the pump. Since the rum pump requires the largest amount of fluid, the rum pump takes the longest to open, which is one of the limitations of a small peristaltic pump.

The submersible 12 V pump delivers faster and can also drive pineapple pulp!

Another limitation of the small pump is the inability to pump out the pineapple juice, as the Mai Tai has 120 ml of pineapple juice and using a peristaltic motor is too slow, so I used a submersible motor here to solve both the pulp and speed problems. Submersible motors also run on 12 V direct current, controlled by a relay box. It takes only 3.2 seconds to pump 120 ml of pineapple juice with this motor! In fact, I originally wanted to use a larger peristaltic motor for the treatment, but I couldn’t find one nearby, so I switched to a submersible motor left over from another project. Since I had only one motor to drive the pulp, I mixed pineapple juice with lime juice and then used the precious diving motor to process it. If you use a squirming motor, you’ll get stuck in the pulp. To avoid siphoning, the submersible pump is placed above the surface of the juice.

Suggestion: Blue LEDS can also be upgraded to color leds to add different effects. For this project, due to limited time, I used a blue color with a current limit and a 300 ohm resistor to prevent the LED from burning out.

A simplified diagram of a resistance block. The relay controls two peristaltic pumps. Note: Write the Arduino pin as LOW to start the relay and pump.

The “start button” is actually a doorbell switch that you can buy at a hardware store

I wanted to use a two-wire doorbell switch for my project, so I removed the light bulb from the switch and replaced it with a green LED. The problem is that the logic does not stop at HIGH when the switch is pressed. To solve this problem, I connected the logical pins to the Arduino analog input pins, and when the simulated value fell below a certain point, the drink sequence would be triggered. Of course, this is not the only solution. The simple code I wrote was to make the doorbell switch drive the beverage motor after the LED flashes. I deliberately kept the code simple to make it easy to read and understand. I want you to feel that these pumps are very easy to control, and that if you can control the amount of fluid you put into them, you can do a lot of other things besides mixing drinks, like doing liquid experiments.

Just adjust the program code below, you can make a variety of different strength, strength of the drink. In addition, the device can mix more than one drink, for example, by pressing different buttons.

After reading this article, I hope you can also build your own robot. In fact, the device itself and electronic components are not difficult, which is very suitable for beginners to learn Arduino, programming and electronic components.

3. Code is provided

#define Rum 1 // (Pump no. 1) connect 12VDC motor to pin No. 1 and pour rum
#define LED8 8 // (No. 1 pump)LED display of rum driving status
#define Curacao 2 // (No. 2 pump) Orange wine connect no. 2 pin
#define LED9 9 // (No. 2 pump)LED display the driving status of mandarin wine
#define Orgeat 3 // (no. 3 pump) connect no. 3 pin
#define LED10 10 // The LED on pump no. 3 is connected to pin no. 10
#define Grenedine 4 // (no. 4 pump) connect no. 4 pin
#define LED11 11 // The LED on pump # 4 is connected to pin # 11
#define PineLime 5 // No. 5 pump connects pineapple with lime juice
#define LED12 12 // The LED on pump no. 5 is connected to pin no. 12
#define doorbell 13 // Activate the switch with the doorbell
#define pump6 6 // No. 6 pin is connected to large submersible pump
int strobe=100; // Control the LED flashing speed
int sensorPin = A0; // Analog reading: used to detect whether there is a press doorbell switch
int sensorValue = 0;  // If the doorbell value is read, it will be written here

void setup(a)
{
pinMode(Rum, OUTPUT);
pinMode(LED8, OUTPUT);
pinMode(Curacao, OUTPUT);
pinMode(LED9, OUTPUT);
pinMode(Orgeat, OUTPUT);
pinMode(LED10, OUTPUT);
pinMode(Grenedine, OUTPUT);
pinMode(LED11, OUTPUT);
pinMode(LED12, OUTPUT);
pinMode(doorbell, INPUT);
pinMode(pump6, OUTPUT);
digitalWrite (LED8, LOW); // No. 1 LED is on
digitalWrite (Rum, HIGH); // Close pump no. 1
digitalWrite (LED9, LOW);
digitalWrite (Curacao, HIGH); // Close pump no. 3
digitalWrite (LED10, LOW);
digitalWrite (Orgeat, HIGH); // Close pump no. 3
digitalWrite (LED11, LOW); // Close pump no. 4
digitalWrite (PineLime, HIGH); // Close pump no. 4
digitalWrite (LED11, LOW);
digitalWrite (Grenedine, HIGH);// Close pump no. 5
digitalWrite (pump6, HIGH);// Close pump no. 6
delay(1000); // Make the relay ready before it starts running
}

void setup(a)
{
pinMode(Rum, OUTPUT);
pinMode(LED8, OUTPUT);
pinMode(Curacao, OUTPUT);
pinMode(LED9, OUTPUT);
pinMode(Orgeat, OUTPUT);
pinMode(LED10, OUTPUT);
pinMode(Grenedine, OUTPUT);
pinMode(LED11, OUTPUT);
pinMode(LED12, OUTPUT);
pinMode(doorbell, INPUT);
pinMode(pump6, OUTPUT);

digitalWrite (LED8, LOW); // No. 1 LED is on
digitalWrite (Rum, HIGH); // Close pump no. 1
digitalWrite (LED9, LOW);
digitalWrite (Curacao, HIGH); // Close pump no. 3
digitalWrite (LED10, LOW);
digitalWrite (Orgeat, HIGH); // Close pump no. 3
digitalWrite (LED11, LOW); // Close pump no. 4
digitalWrite (PineLime, HIGH); // Close pump no. 4
digitalWrite (LED11, LOW);
digitalWrite (Grenedine, HIGH);// Close pump no. 5
digitalWrite (pump6, HIGH);// Close pump no. 6
delay(1000); // Make the relay ready before it starts running
}

void loop(a)   // This part of the program code will continue to loop
{
sensorValue = analogRead(sensorPin);
// This part is to make the LED shine, so that the robot will look cool
// The flash will stop when the start button is pressed
// When the button is pressed, the LED will show that it is working
digitalWrite (LED8, HIGH); // open the LE at pin 8
delay(strobe);         // Control the LED flashing speed
digitalWrite (LED8, LOW); // Turn off pin 8 LED
delay(strobe);
digitalWrite (LED9, HIGH); // Turn on pin 9 LED
delay(strobe);
digitalWrite (LED9, LOW); // Turn off pin 9 LED
delay(strobe);
digitalWrite (LED10, HIGH); // Turn on the LED at pin 10
delay(strobe);
digitalWrite (LED10, LOW); // Turn off the LED at pin 10
delay(strobe);
digitalWrite (LED11, HIGH); // Turn on the LED at pin 11
delay(strobe);
digitalWrite (LED11, LOW); // Turn off the LED at pin 11
delay(strobe)
digitalWrite (LED12, HIGH); // Turn on the LED with pin 12
delay(strobe);
digitalWrite (LED12, LOW); // Turn off the LED at pin 12
delay(strobe);
sensorValue = analogRead(sensorPin);
if(sensorValue < 300){
digitalWrite (LED8, HIGH); // No. 1 LED is on
digitalWrite (Rum, LOW); // Pump no. 1 starts
digitalWrite (LED9, HIGH);
digitalWrite (Curacao, LOW); // Pump no. 2 starts
digitalWrite (LED10, HIGH);
digitalWrite (Orgeat, LOW); // Pump No. 3 starts
digitalWrite (LED11, HIGH);
digitalWrite (Grenedine, LOW);// Pump No. 4 starts
delay(8000);       // Wait 8 seconds to pour out 1/4 ounce of liquid
digitalWrite (LED10, LOW); // Turn off almond syrup LED P3
digitalWrite (Orgeat, HIGH);   // Turn off the almond syrup pump P3
digitalWrite (LED11, LOW);   // No. 5 pump LED off
digitalWrite (Grenedine, HIGH); // No. 4 pump shut down
delay(8000);     // Wait 8 seconds to pour out 1/4 ounce of liquid
digitalWrite (Curacao, HIGH);   // Turn off no. 2 of tangxiang wine pump
digitalWrite (LED9, LOW); // Turn off orange Wine LED no. 2
// At this point, the orange wine switch is on for 16 seconds, and delivers 1/2 ounce.
delay(16000);   // Wait 8 seconds to pour out 1/4 ounce of liquid
digitalWrite (LED8, LOW); // Turn off no. 1 pump LED
digitalWrite (Rum, HIGH);   // Turn off pump 1 (rum)
digitalWrite (pump6, LOW);   // Start pineapple juice pump (no. 6 pump)
//digitalWrite (PineLime, LOW); // Open the relay, open the pump
delay(2500); // Delay 4 seconds to serve pineapple juice.
digitalWrite (pump6, HIGH);     // Turn off the pineapple juice pump (no. 6 pump)
//digitalWrite (PineLime, HIGH); // Turn off pineapple juice
}
Copy the code

Translated by Ted Kinsman

Officially licensed by Makezine.tw

The original link: www.makezine.com.tw/make2599131…