Introduction: Cocktail Machine With GUI Raspberry

About: 🔩Maker Arduino Raspberry. 🇫🇷🇬🇧 🖨️3D Print and design creation ! 🖨️ ☕My STL design ; https://cults3d.com/fr/utilisateurs/diyfunproject 📲FULL WEBSITE : …

You like technology and party ? This project is made for you !

In this tutorial we will create an automated cocktail machine with an graphic interface.

Everything controlled by the raspberry !

EDIT : I made a new one easier and cheaper the link here !

Step 1: What We Need:

For this project i will use 8 botlle but you can adapt easily if you want less or more.

-Raspberry B : Any should work

-8 channel relay : each channel will be a botlle .(1channel = 1bottle)

-Wire the most important are female to male .

-8 Water pump each pump will be use for one botlle

-Pipe I got 10m.

-Touchscreen 2.8 in order to display the user interface

- SD card 8G : at least 8GB

-SD card reader i believe most of you already has it but in case.

-Container for the drink , I let you choose as it will depant of your idea . Mine car contain 1.5liter

Step 2: Set Up the Raspberry Pi

In order to use the raspbery and the touchscreen , we will need a modified image of raspbian

FIrst 3 software :

-Adafruit modified image of raspbian

-Win32diskimager to burn the image on the SD card

-Putty to connect in remote to the raspbery

WIn32 disk imager:

After download install it.

Open it ,

1/ you will see "device" in general the default is good (if you only have the sd card connected)

2/ Click on the blue icon folder and select the raspbian jessie image you have downloaded

3/ Click write and it's done.

You can now insert the card to the raspberry.

Putty:

It allow us to connect via SSH , open Putty (no need to install)

-Connect internet cable to the raspberry

-You need to find the ip of the raspberry 2 easy way :

-Connect to your box interface you will be able to see the device with the IP

-Connect the touchscreen and keyboard go to terminal then ifconfig

Now in Putty enter the ip adress will be something like 192.168.0.3 then enter

-it will ask to trust click yes (picture)

-login : pi password : raspberry

Leave the windows on the side we will come back here later

Step 3: Connecting the Screen

The inconvenient of the screen is that it come already mount so when you plug it it will use all the pin of the rasp.

I have tested each pin to find out wich one use the screen (check picture)

To connect the screen it will be the same pin as raspberry

Once connected if you have install raspbian you will be able to use it .

Advice for the screen:

the taskbar take some place , if you right click on it then panel setting => advanced => untick reserved space for taskbar

Configure single click:

Single click: IF you click to use only click on the screen on puty : cd /home/pi/.config => nano libfm.conf

Line 5 single_click = 0 change to single_click = 1

Step 4: Connecting the Relay/Raspberry

The picture show for one water pump.

water pump + = RELAY

water pump - = Charger 12V

I used one charger 12V (cut the top) negative goes to the each pump (negative) and positive each channel of relay

One charger is enough as only one pump will work at the time

Repeat this for the 8 pump.

To learn more about raspberry and relay amazing topic here

Step 5: Code for the GUI

We are done for the material part (kind of) .

Let's create the Graphic User interface:

You can now get back to putty once connected we gonna create our code on the desktop:

cd /home/pi/Desktop

open a file:

nano drink.sh

to make sure file is executable

<p>chmod +x drink.sh</p>

and paste the code:

If you want to modify the code :

"GPIO mode out" mean you turn on the pin (so the relay turn on)

The Gpio = pin on the raspberry , but the physic pin are not the same of the system .

Check the picture .

So if you want to add or change a drink just modfiy the name in "menu boisson" and in the body of the code, you can see very easisly each drink has a small section of code.

#!/bin/bash<br> 
while true; do
  choice="$(zenity --width=400 --height=300 --list --column "" --title="Cocktail" \
  "cocktail" \
  "soft" \
   "shooter" \
   "cow boy")"
  
  echo $choice
 
  case "${choice}" in
    "cocktail" )
      while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "whisky coca" \
        "wodka orange" \
		"ricard eau" \
		"tequila orange"\
		"Gin orange")"
 
		echo $choice
		
        case "${choice}" in
          "whisky coca" )
            
  gpio mode 2 out
        sleep 3
        gpio mode 2 input \
       gpio mode 0 out
       sleep 4
       gpio mode 0 input
         			break
          ;;
          "wodka orange" )
             gpio mode 3 out
        sleep 2
        gpio mode 3 input \
     gpio mode 7 out
       sleep 4
       gpio mode 7 input
         
			break
          ;;
		  "ricard eau" )
             gpio mode 24 out
        sleep 3
        gpio mode 24 input \
        gpio mode 25 out
       sleep 3
       gpio mode 25 input
         
			break
          ;;
		    
          "tequila orange" )
             gpio mode 22 out
        sleep 3
        gpio mode 22 input \
       gpio mode 7 out
       sleep 3
       gpio mode 7 input
         
			break
          ;;
		   "Gin orange" )
            gpio mode 23 out
        sleep 2
        gpio mode 23 input \
       gpio mode 7 out
       sleep 4
       gpio mode 7 input
         
			break
       ;;
		  *)
			echo "bye"
			break
		  ;;
        esac
      done
     ;;
	 "soft" )
		while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "orange" \
		"coca" \
        "eau")"
		
		echo $choice
 
        case "${choice}" in
          "orange" )
             gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
          "coca" )
             gpio mode 0 out
       sleep 6
       gpio mode 0 input
			break
          ;;
		  
		   "eau" )
             gpio mode 25 out
       sleep 6
       gpio mode 25 input
			break
          ;;
		  *)
			echo "bye"
			break
		  ;;
		  esac
		  done
	 ;;
	
    
 "shooter" )
		while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "whisky" \
		"wodka" \
		"tequila" \
		"gin" \
        "TGV")" 
		
		echo $choice
 
        case "${choice}" in
          "whisky" )
             gpio mode 2 out
       sleep 2
       gpio mode 2 input
			break
          ;;
          "wodka" )
             gpio mode 3 out
       sleep 2
       gpio mode 3 input
			break
          ;;
		  "tequila" )
             gpio mode 22 out
       sleep 2
       gpio mode 22 input
			break
          ;;
		  "gin" )
             gpio mode 23 out
       sleep 2
       gpio mode 23 input
			break
          ;;
		  "TGV" )
               gpio mode 22 out
        sleep 1
        gpio mode 22 input \
        gpio mode 23 out
       sleep 1
       gpio mode 23 input \
	   
	   gpio mode 3 out
        sleep 1
        gpio mode 3 input 
			break
          ;;
		  *)
			echo "bye"
			break
		  ;;
		  esac
		  done
	 ;;</p><p> "cow boy" )
		while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "ricard pierre" \
		"whisky coca" \
		"wodka orange" \
		"gin orange" \
		"tequila orange" \
        "cimetiere")"
		
		echo $choice
 
        case "${choice}" in
          "ricard pierre" )
             gpio mode 24 out
        sleep 4
        gpio mode 24 input \      
	  gpio mode 25 out
       sleep 5
       gpio mode 25 input
			break
          ;;
          "whisky coca" )
            gpio mode 2 out
        sleep 3
        gpio mode 2 input \
        gpio mode 0 out
       sleep 6
       gpio mode 0 input
			break
          ;;
		     "wodka orange" )
             gpio mode 3 out
        sleep 3
        gpio mode 3 input \
        gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
		     "gin orange" )
             gpio mode 23 out
        sleep 3
        gpio mode 23 input \
        gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
		      "tequila orange" )
             gpio mode 22 out
        sleep 3
        gpio mode 22 input \
      gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
		        "cimetière" )
             gpio mode 2 out
        sleep 2
        gpio mode 2 input \
        gpio mode 3 out
       sleep 2
       gpio mode 3 input \
	   
	    gpio mode 23 out
        sleep 2
        gpio mode 23 input \
       gpio mode 25 out
       sleep 2
       gpio mode 25 input \
	   
	   gpio mode 7 out
       sleep 1
       gpio mode 7 input
			break
          ;;
		  *)
			echo "bye"
			break
		  ;;
		  esac
		  done
	 ;;
	 *)
	  echo "bye"
	  break
    ;;
esac
done

Step 6: Final Mounting

I use a vertical furniture from IKEA was cheaper than to build myself.

I cut a square from the front door to put the glass

I made some hole in the shelve to pass a pipe , the pipe of the pump goes there.

At the bottom i put a wire rack from a ventilation computer whith a container for the leaking water

Step 7: Conclusion

Everything is working properly but i have faced some unattended problem.

Few issue:

-The case is a bit tight ,when you fill up can be complicated. -

-The container for drinks are on the top and the glass at the bottom; it will create a siphon wich mean even when the pump stop the liquid keep coming.

In order to avoid this use a horizontal case or like me you will have to make a small hole in the pipe in the immerge part.

Also you can see i have cable going everyhere wich looks bad, so horizontale desk would be the best option .

Advice:

Put some stickers on each container to know what drink the relay is conected to.

If you like the instructable please vote !

IoT Builders Contest

Participated in the
IoT Builders Contest

Circuits Contest 2016

Participated in the
Circuits Contest 2016

Dorm Hacks Contest 2016

Participated in the
Dorm Hacks Contest 2016