Mix Drink Machine Student Project
by MiaVreven in Circuits > Arduino
142 Views, 0 Favorites, 0 Comments
Mix Drink Machine Student Project
Have you ever found yourself disappointed when attempting to create mixed drinks, whether it's an alcoholic beverage or a homemade soda? You pour the ingredients together, hoping to replicate your previous success, only to find that the taste falls short. Tired of the manual measurement process and seeking consistency, I embarked on a student project to create a solution. I have devised a simple yet effective construction that can hold two liquids and dispense them into your glass based on your desired proportions. Say goodbye to the uncertainty and effort of manual mixing. Join me as I share the steps to create a mix drink machine that will revolutionize your beverage preparation experience.
Supplies
Components used
- Peristaltic pump (12 Volt) X2
- 2 channel Relay module
- Arduino
- Potentiometer X2
- Button
- Wires
- A 12 Volt Power supply
- wire connectors X2
Other things you might need
- saw
- drill
- screws and a screwdriver
- wood
- bottles to contain the liquid
I would recommend that you do not go for a solid state for the relay module as I tried that myself and it produced unwanted behavior.
Initial Component Testing
To ensure the seamless operation of my mix drink machine, I conducted preliminary tests on each component, focusing primarily on the pumps and the relay. My objective was to verify their individual functionality before integrating them into the final setup.
For the relay, I connected it to both the Arduino and a set of lights to observe if the lights would illuminate as expected. This allowed me to confirm that the relay was properly responding to the Arduino's signals. As stated before I initially used a solid-state relay but that produced unreliable unwanted behavior because it was not made for DC power. It might have been a mistake I made but I found that changing the relay fixed the issue.
Regarding the pumps, I began by modifying a 12V power supply. I carefully removed the end and separated the positive and negative wires. To establish a secure connection, I used wire connectors and connected color-coded wires to the original ones. During the pump testing phase, I also took the opportunity to measure the flow rate of each pump. This information proved crucial for determining the precise speed at which the liquids would flow through the system. Interestingly, I discovered that the pumps operated slightly faster than their designated flow rate as specified during the purchase.
By conducting these comprehensive tests, I ensured that each component was fully operational and gained valuable insights into the pumps' actual performance. This knowledge will be instrumental in calibrating the mix drink machine for optimal liquid flow control in subsequent stages.
Code Development
With successful individual component tests completed, it was time to assemble the various elements. I incorporated the potentiometers and a button into the existing relay test setup. At this stage, I focused on writing the code that would drive the functionality of our mix drink machine. However, I refrained from connecting the pumps during this phase to prevent any accidental "dry runs" while writing the code.
For the code implementation, I adopted an approach that leveraged our knowledge of the pumps' flow rate. By determining the amount of liquid based on the duration of the relay's activation, we could achieve precise measurements. To achieve this, I assigned the potentiometers' rotation values to corresponding millisecond timings, which dictated the duration for which the relay would remain active. Consequently, this allowed us to control the desired quantity of liquid dispensed. It's important to mention that fine-tuning the machine may be necessary to attain precise measurements. However, once the system is appropriately calibrated, you can consistently achieve the desired quantity of liquid with accuracy.
By uniting the components and implementing this code-driven approach, we are inching closer to creating a mix drink machine that guarantees reliable and customized beverage preparation.
//importing Timer library
#include "MillisTimer.h"
//setting up pin references
#define BUTTON_PIN 4
#define POTENTIOMETER_PIN1 A1
#define POTENTIOMETER_PIN2 A2
#define PUMPSWITCH_PIN1 9
#define PUMPSWITCH_PIN2 10
//The time in miliseconds that it takes for one pump to move 300 ml
const long int maxtime = 225000;//in miliseconds
//Creating the timer objects
MillisTimer timer1 = MillisTimer(90000);
MillisTimer timer2 = MillisTimer(90000);
void setup() {
Serial.begin(31250);
//setting the pin modes of the pins
pinMode(PUMPSWITCH_PIN1,OUTPUT);
pinMode(PUMPSWITCH_PIN2,OUTPUT);
pinMode(BUTTON_PIN,INPUT_PULLUP);
pinMode(POTENTIOMETER_PIN1,INPUT);
pinMode(POTENTIOMETER_PIN2,INPUT);
//I needed to have my pins set to HIGH for the relay to not run pumps.
digitalWrite(PUMPSWITCH_PIN1,HIGH);
digitalWrite(PUMPSWITCH_PIN2,HIGH);
//setting the timers to only run once. Default they are set to 0 which means repeat infinitely
timer1.setRepeats(1);
timer2.setRepeats(1);
}
void loop() {
//telling the timers to run if they have been started
timer1.run();
timer2.run();
//checking if the timer is running and setting the pins accordingly
if(timer1.isRunning()){
digitalWrite(PUMPSWITCH_PIN1,LOW); //runs the pump
} else{
digitalWrite(PUMPSWITCH_PIN1,HIGH); //stops the pump
}
if(timer2.isRunning()){
digitalWrite(PUMPSWITCH_PIN2,LOW); //runs the pump
}else{
digitalWrite(PUMPSWITCH_PIN2,HIGH); //stops the pump
}
//checking if a timer is running
if(timer1.isRunning() || timer2.isRunning()){
} else{
//checking if the button is pressed when no timer is running
int a = digitalRead(BUTTON_PIN);
if(a == 0){
//reading the potentiometers
int inputsensor1 = analogRead(POTENTIOMETER_PIN1);
int inputsensor2 = analogRead(POTENTIOMETER_PIN2);
//Remaping the value to a milisecond time.
long int time1 = map(inputsensor1, 0, 1023, 0, maxtime);
long int time2 = map(inputsensor2, 0, 1023, 0, maxtime);
//setting the timers to the new time.
timer1.setInterval(time1);
timer2.setInterval(time2);
//starting the timers so that they can run when called
timer1.start();
timer2.start();
}
}
}
Downloads
Fine-Tuning
With the code developed, the time had come to connect the pumps to the relay and commence testing the machine. As a temporary measure before soldering the components, I secured the wires to the pumps using duct tape. This allowed me to proceed with the initial testing phase. It's worth noting that I repeated this process once more after soldering the components to enhance the wire management within the construction.
During the testing phase, I carefully observed the machine's performance and made necessary adjustments to ensure optimal operation. Fine-tuning the machine became paramount at this stage, as it enabled me to achieve precise measurements and consistent liquid flow. By iteratively adjusting the system, I honed in on the desired results, ensuring the machine dispensed the exact amount of liquid as intended.
Soldering
To ensure a more permanent and reliable connection, I proceeded to solder the components together. While it was only my second time soldering, I tried to carefully solder the necessary joints.
Soldering not only improves the overall durability of the connections but also minimizes the risk of loose or unreliable connections that may impact the machine's functionality.
Following the soldering process, I highly recommend conducting another round of testing. This step ensures that all the connections remain intact and functional after soldering. By retesting the machine, you can verify that the soldering process did not introduce any unforeseen issues or disruptions to the functionality you had previously established.
Cutting the Enclosure
To create an enclosure for the mix drink machine, I began by designing a basic mockup using Tinkercad, considering the size and shape of the bottles I intended to use. Please note that these steps may serve as a general guideline, as the dimensions of your bottles may differ.
For my container, the measurements were as follows:
- Bottom Panel: 20 cm x 22 cm
- Back Panel: 22 cm x 32 cm
- Front Panel: 22 cm x 31 cm
- Front overhang Panel: 22 cm x 6 cm
- Inside Panel: 22 cm x 10 cm
- Side Panels: 32 cm x 12 cm (twice)
- Top Panel: 24 cm x 12 cm
To construct the enclosure, I utilized planks that were 1.2 cm thick. Using these measurements, I carefully cut out the respective panels from the planks.
It's important to note that the dimensions provided above may not precisely match your specific bottle sizes or desired enclosure design. Therefore, I encourage you to adapt these measurements to suit your requirements, ensuring a snug fit for your bottles and a well-tailored enclosure for your mix drink machine.
Assembling the Enclosure and Installing Components
Having cut the panels to the appropriate dimensions, the next step is to assemble them by screwing them together securely. Ensure that the panels align properly to create a sturdy and functional enclosure for your mix drink machine.
To accommodate the various components, you will need to drill holes in specific locations. Focus on the front, top, and inside panels to allow for the passage of the pumps, tubes, button, potentiometers, and bottles. Take accurate measurements and exercise precision during the drilling process to ensure proper alignment and fit for each component.
Once the holes are drilled, it's time to attach the components to their respective positions on the panels. Securely fasten the pumps, tubes, button, and potentiometers in their designated locations, ensuring they are firmly attached and in proper alignment with the drilled holes.
Additionally, drill holes in the caps of the bottles to facilitate their connection to the tubes and ensure smooth liquid flow.
Final Touches
To further improve the ease of operation, I designed a pointer piece using 3D modeling software and printed it using a 3D printer. This pointer piece is intended to indicate the current setting of the potentiometer, providing a visual reference for users. Additionally, I created a graphic displaying the measurements, which can be affixed to the enclosure to serve as a convenient reference guide.
When printing these files, it is crucial to ensure they are scaled correctly to fit the specific components you used in your mix-drink machine. Take precise measurements of the potentiometer and the available space on your enclosure to determine the appropriate dimensions for the pointer piece. Similarly, adjust the size of the graphic to match the dimensions of your enclosure accurately.
Downloads
End Product
If you've followed these steps diligently, you should now have a fully assembled drink machine at your disposal, ready to create a delightful array of mixed drinks. As someone with no prior experience in electronics or Arduino programming, this project has been a learning experience for me. I've faced a learning curve, discovering the intricacies of working with Arduinos, relays, and soldering along the way.
Throughout this endeavor, I've come to realize the flaws in my design that I would approach differently next time. One aspect I would address is the need to almost completely dismantle and reassemble the machine to replace the liquids. It's an inconvenience that I would seek to improve for future iterations.
Despite these imperfections, I take pride in my completed drink machine.
(I made use of ChatGPT to reword some sentences to be clearer.)