CocktailMaker

by stijnvd3 in Circuits > Raspberry Pi

465 Views, 6 Favorites, 0 Comments

CocktailMaker

IMG_2677.JPG

Cocktails, a great way to end a tiring day, or to start an exciting party. You go to the bar, order a fancy drink, sit back and wait for the heavenly mixture to arrive. At the end of the night you pay the bill, tip the bartender and you’re on your way. But what if I told you there is a way for you to enjoy the same tasty cocktail without going to the bar or even spending a lot of money. All it will take is a bit of your free time and some creativity. Keep reading, and I will explain step by step how to make your own cocktail machine at home.

Supplies

For the case

- MDF 6mm thick

- 2 x 374mm / 462mm

- 2 x 280mm / 462mm

- 2 x 174mm / 250mm

- 1 x 162mm / 250mm

- 1 x 150mm / 250mm

- 1 x 180mm / 162mm

- 1 x 180mm / 362mm

- 1 x 362mm / 100mm

- 1 x 374mm / 292mm

- MDF 12mm thick

- 1 x 374mm / 292mm

- 2 x hinge

- screws

- wood glue

For the electronics

- 1 x LCD display 16x2

- 1 x 5V 8-channel relayboard

- 1 x 12V DC 100W power supply

- 1 x raspberry pi 3B+

- 8 x 12V DC Dosing Pump

- 1 x PCA8574p I2C I/O expander

- 1 x breadboard

- 1 x 330 Ohm resistor

- 2 x 470 Ohm resistor

- 1 x distribution plug

- 1 x infrared obstacle avoidance sensor

- 1 x ultrasonic module

- 1 x magnetic doorswitch

- copper wire

Extra

- 1 x small funnel

- 1 x flexible nutella lid

- 8m flexible tube 4mm thick

- 3 x clothespin

- white paint

- 1 x cocktailshaker

Drinks

- 1 x bottle of gin

- 1 x bottle of rum

- 1 x bottle of vodka

- 1 x bottle of tequila

- 1 x bottle of triple sec

- 1 x bottle of lime juice

- 1 x bottle of simple syrup

- 1 x bottle of cola

(optional)

- 8 equal bottles

Drawing the Holes

IMG_2612.JPG

We start by measuring and drawing the needed holes on the wood.

  • front panel (374mm/462mm)
    • 6.5 cm from the top, in the center of the panel, we draw a rectagle the size of our lcd display.
    • on the bottom, in the center of the panel, we draw a rectangle of 25cm high by 15cm wide for the door.
  • back panel of electronics compartment (362mm/100mm)
    • draw 8 times the surface of the pumps on this panel, to make all the pumps fit.
  • top panel of shaker chamber (180mm/162mm)
    • draw a cirkel as big as the end of the funnel in the center of the panel
    • 3 cm from the edge of the short side, draw the shape of the two holes needed for the ultrasonic module to fit.
    • in the front right corner, draw a tiny hole, 1cm away from both sides. Two wires shot fit through it.
  • right side panel of the shaker chamber (174mm/250mm)
    • 10 cm from the bottom (short side), draw the two holes needed for the infrared sensor to fit (in the center)

Sawing/drilling the Holes

IMG_2617.JPG
IMG_2619.JPG

Now that we’ve drawn our holes, it’s time to take some heavy machinery and cut/saw/drill them. I used a simple drill and a fretsaw, and in less than an hour the job was done.

If you are like me, and have difficulties sawing on the drawn lines, you can use a file afterwards to correct your mistakes.

Gluing the Case

IMG_2608.JPG

  • For the outside
    • Start by gluing the rear panel (the biggest one) onto the bottom panel (the thick one) at a 90-degree angle.
    • Add the sides (2 x 280mm/462mm).
    • We'll leave the front and top open for now
  • for the inside
    • Start by making the shaker chamber.
      • glue the two sides (2 x 174mm/250mm) onto the rear panel (162mm/250mm)
      • add the top panel (180mm/162mm) with the two holes for the ultrasonic module facing the rear panel. This panel should cover the sides of all three panels perfectly.
  • for the electronics compartment
    • glue the motor panel onto the bottom panel (362mm/180mm)
  • glue the shaker chamber onto the center of the front of the machine (leave 6mm for the front panel.
  • glue the electronics compartment at the top of the machine, 6mm from the front. The motorpanel should be facing the rear panel.

The Schematics

frit.png
schema.png

Before we start connecting all the electronic components, let's have a look at the schematics.

Soldering the Pumps

IMG_2613.JPG

Make sure all the grounds are connected. This way we can easily connect them to the ground of the power supply.

Connecting the Relayboard to the Pumps

IMG_2620.JPG

  • Connect all the COM's of the relayboard, so we can easily connect them to the 12V of the power supply.
  • Connect each NO on the relayboard with a different pump (+).

Add the Power Supply and the Raspberry Pi

IMG_2611.JPG

Don't mind the front panel in the picture, I just placed it there to have an idea of how much space there would be for the electronics.

  • connect the relayboard like this
    • 5V to the 5V pin on the raspberry pi
    • GND to the GND on the raspberry pi
    • each IN to a GPIO pin on the raspberry pi
  • connect the series of GND pins of the pumps with the 0V of the power supply, and the series of COM's on the relayboard with the 12V of the power supply.
  • Now, if you run a simple script that activates all the connected GPIO pins, you can test your soldering and fix any mistakes before there are to many wires in the compartment. All the pumps should start

Add the Infrared Sensor

IMG_2680.JPG
IMG_2622.JPG
infra.jpg
  • first of all I drilled a hole in the middle of the electronics compartment, so that the cables from the shaker room could go up.
  • start by configuring the sensor right
    • connect the VDD to the 3.3V on the raspberry pi
    • connect the GND to the GND on the raspberry pi
    • put a small piece of cardboard inbetween the receiver and the transmitter
    • place the shaker about 5cm away from the sensor
    • take a screwdriver and turn the trimmer at the top until the OUT led goes out.
    • test move the shaker back and forth and see if the sensor reacts to the movements. (the OUT led should turn on and of).
    • repeat if necessary.
  • insert the receiver and the transmitter through the holes we made earlier.
  • connect the OUT pin to GPIO pin on the raspberry pi.

Connect the Ultrasonic Module

IMG_2681.JPG
IMG_2682.JPG
  • insert the module in the holes at the top of the shaker chamber we made earlier.
  • connect the VCC with the five volts on the raspberry pi.
  • connect the trigger with a GPIO pin
  • make a voltage devider between the GND and the echo (as shown in the picture)
  • connect the GDN with the GND of the raspberry pi.
  • connect the echo with a GPIO pin

if you don't understand what I mean by a voltage devider, have another look at the schematics. it makes sure that the 5V echo is lowered to 3.3V.

Install the Door

IMG_2623.JPG
IMG_2688.JPG

  • Use small screws to attach the hinges to the door and to the front panel.
  • a fingersized hole to make it easier to open the door.

Install the Doorswitch

IMG_2685.JPG
IMG_2687.JPG

Use screws or glue to attach the two parts of the doorswitch to the door, and the inside of the shaker chamber.

Make a Tube Holder

IMG_2625.JPG

  • cut eight pieces of tube of approximately 20cm
  • use a circular object (I used a flexible nutella lid) to hold them

Insert the Funnel

IMG_2634.JPG

  • place the funnel in the last hole in the top panel of the shaker chamber.
  • place the tube holder in the funnel, and secure it with clothes pegs.

Attach the Tubes to the Pump

IMG_2626.JPG

attach te other side of the tubes to the dispensing side of the pumps.

Cutting Tubes for the Bottles

IMG_2633.JPG
IMG_2644.JPG
IMG_2652.JPG
IMG_2635.JPG

cut the various sizes of tubes, so that each bottle will be connected with a pump. Attach them to the unused side of the pumps.

Add the Distribution Plug

IMG_2639.JPG
IMG_2689.JPG

  • cut the connector plug
  • drill a hole on the side of the electronics compartment
  • put the cable through the hole
  • reattach the connector plug

Connect the Lcd

IMG_2690.JPG

  • connect the lcd as shown in the schematics
  • use a I2C i/o expander, because there wont be enough GPIO pins
  • this is the only time we need a small breadboard

Glue the Front Panel

now that the LCD (our last component) is connected, we can glue the front panel to our machine.

Painting

IMG_2669.JPG
IMG_2671.JPG
IMG_2674.JPG
IMG_2675.JPG

make sure to cover the non-wood parts with tape, and paint the machine in a color of your choice.

Fill the Machine

IMG_2667.JPG

The last thing we need to do before we can upload the code and enjoy a delicious cocktail, is fill the machine up with some liquor, and some mixers.

Create the Database

db.png
eerd.png

make a connection to the raspberry pi, and create the database.

CREATE DATABASE IF NOT EXISTS `cocktailmaker` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `cocktailmaker`; -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64) -- -- Host: 127.0.0.1 Database: cocktailmaker -- ------------------------------------------------------ -- Server version 5.7.20-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

-- -- Table structure for table `cocktaillogboek` --

DROP TABLE IF EXISTS `cocktaillogboek`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cocktaillogboek` ( `id_cocktail_log` int(11) NOT NULL AUTO_INCREMENT, `aantal` tinyint(4) DEFAULT NULL, `datum` datetime DEFAULT CURRENT_TIMESTAMP, `cocktail_id` int(11) NOT NULL, PRIMARY KEY (`id_cocktail_log`,`cocktail_id`), KEY `fk_Cocktaillogboek_Cocktails1_idx` (`cocktail_id`), CONSTRAINT `fk_Cocktaillogboek_Cocktails1` FOREIGN KEY (`cocktail_id`) REFERENCES `cocktails` (`id_cocktail`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */;

-- -- Dumping data for table `cocktaillogboek` --

LOCK TABLES `cocktaillogboek` WRITE; /*!40000 ALTER TABLE `cocktaillogboek` DISABLE KEYS */; INSERT INTO `cocktaillogboek` VALUES (1,1,'2019-05-31 18:06:24',1),(2,1,'2019-05-31 18:06:24',2),(3,2,'2019-05-31 18:06:24',1),(4,2,'2019-05-31 18:06:24',2); /*!40000 ALTER TABLE `cocktaillogboek` ENABLE KEYS */; UNLOCK TABLES;

-- -- Table structure for table `cocktails` --

DROP TABLE IF EXISTS `cocktails`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cocktails` ( `id_cocktail` int(11) NOT NULL AUTO_INCREMENT, `naam_cocktail` tinytext, `code_cocktail` varchar(45) DEFAULT NULL, `inhoud_cocktail` float DEFAULT NULL, PRIMARY KEY (`id_cocktail`), UNIQUE KEY `code_cocktail_UNIQUE` (`code_cocktail`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */;

-- -- Dumping data for table `cocktails` --

LOCK TABLES `cocktails` WRITE; /*!40000 ALTER TABLE `cocktails` DISABLE KEYS */; INSERT INTO `cocktails` VALUES (1,'long island iced tea','1q3n2q3n3q3n4q3n5q3x6q3n8q2',20),(2,'tequila sunrise','2q5x7q5x9q3',13); /*!40000 ALTER TABLE `cocktails` ENABLE KEYS */; UNLOCK TABLES;

-- -- Table structure for table `dranken` --

DROP TABLE IF EXISTS `dranken`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dranken` ( `id_drank` int(11) NOT NULL AUTO_INCREMENT, `naam_drank` tinytext, `tijd_per_centiliter` float DEFAULT NULL, `inhoud_drank` float DEFAULT NULL, `pomp_drank` tinyint(4) DEFAULT NULL, PRIMARY KEY (`id_drank`) ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */;

-- -- Dumping data for table `dranken` --

LOCK TABLES `dranken` WRITE; /*!40000 ALTER TABLE `dranken` DISABLE KEYS */; INSERT INTO `dranken` VALUES (1,'gin',20,70,1),(2,'tequila',20,70,2),(3,'wodka',20,70,3),(4,'triple sec',20,70,4),(5,'rum',20,70,5),(6,'whisky',20,70,NULL),(7,'cola',15,100,6),(8,'sinaasappelsap',25,100,7),(9,'limoensap',20,100,8),(10,'grenadine',30,100,9),(11,'suikersiroop',30,100,10); /*!40000 ALTER TABLE `dranken` ENABLE KEYS */; UNLOCK TABLES;

-- -- Table structure for table `dranken_cocktails` --

DROP TABLE IF EXISTS `dranken_cocktails`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `dranken_cocktails` ( `Dranken_id_drank` int(11) NOT NULL, `Cocktail_id_cocktail` int(11) NOT NULL, PRIMARY KEY (`Dranken_id_drank`,`Cocktail_id_cocktail`), KEY `fk_Dranken_has_Cocktail_Cocktail1_idx` (`Cocktail_id_cocktail`), KEY `fk_Dranken_has_Cocktail_Dranken1_idx` (`Dranken_id_drank`), CONSTRAINT `fk_Dranken_has_Cocktail_Cocktail1` FOREIGN KEY (`Cocktail_id_cocktail`) REFERENCES `cocktails` (`id_cocktail`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_Dranken_has_Cocktail_Dranken1` FOREIGN KEY (`Dranken_id_drank`) REFERENCES `dranken` (`id_drank`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */;

-- -- Dumping data for table `dranken_cocktails` --

LOCK TABLES `dranken_cocktails` WRITE; /*!40000 ALTER TABLE `dranken_cocktails` DISABLE KEYS */; /*!40000 ALTER TABLE `dranken_cocktails` ENABLE KEYS */; UNLOCK TABLES;

-- -- Table structure for table `softs` --

DROP TABLE IF EXISTS `softs`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `softs` ( `bruisend_drank` tinyint(4) DEFAULT NULL, `drank_id` int(11) NOT NULL, KEY `fk_Softs_Dranken1_idx` (`drank_id`), CONSTRAINT `fk_Softs_Dranken1` FOREIGN KEY (`drank_id`) REFERENCES `dranken` (`id_drank`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */;

-- -- Dumping data for table `softs` --

LOCK TABLES `softs` WRITE; /*!40000 ALTER TABLE `softs` DISABLE KEYS */; INSERT INTO `softs` VALUES (1,7),(0,8),(0,9),(0,10),(0,11); /*!40000 ALTER TABLE `softs` ENABLE KEYS */; UNLOCK TABLES;

-- -- Table structure for table `spirits` --

DROP TABLE IF EXISTS `spirits`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `spirits` ( `alcohol_percentage_drank` tinytext, `soort_drank` tinytext, `drank_id` int(11) NOT NULL, KEY `fk_Spirits_Dranken_idx` (`drank_id`), CONSTRAINT `fk_Spirits_Dranken` FOREIGN KEY (`drank_id`) REFERENCES `dranken` (`id_drank`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */;

-- -- Dumping data for table `spirits` --

LOCK TABLES `spirits` WRITE; /*!40000 ALTER TABLE `spirits` DISABLE KEYS */; INSERT INTO `spirits` VALUES ('40','gin',1),('35','tequila',2),('37.5','wodka',3),('40','triple sec',4),('37.5','rum',5),('37.5','whisky',6); /*!40000 ALTER TABLE `spirits` ENABLE KEYS */; UNLOCK TABLES;

-- -- Dumping events for database 'cocktailmaker' --

-- -- Dumping routines for database 'cocktailmaker' -- /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2019-06-03 14:56:53

Writing the Code

ss.png

Many hours of work went in to this program, luckily for you I have a github repository.

Here is a link to the code.