loading

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 !

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 !

<p>Bonjour,</p><p>Avec des amis nous comme projet de r&eacute;aliser un bar automatique.</p><p>Quand je le lance le programme rien ne ce passe. J'ai copi&eacute;/coll&eacute; le code indiqu&eacute;.</p><p>Avez vous une solution pour r&eacute;gler le probl&egrave;me?</p><p>Merci d'avance</p>
Test celui la ou envoie ton mail en mp<br><br>#!/bin/bash<br> <br>while true; do<br> choice=&quot;$(zenity --width=400 --height=300 --list --column &quot;&quot; --title=&quot;test&quot; \<br> &quot;cocktail&quot; \<br> &quot;soft&quot; \<br> &quot;shooter&quot; \<br> &quot;cow boy&quot;)&quot;<br> <br> echo $choice<br> <br> case &quot;${choice}&quot; in<br> &quot;cocktail&quot; )<br> while true; do<br> choice=&quot;$(zenity --width=400 --height=300 --list --column &quot;&quot; --title=&quot;test&quot; \<br> &quot;whisky coca&quot; \<br> &quot;wodka orange&quot; \<br> &quot;ricard eau&quot; \<br> &quot;tequila orange&quot;\<br> &quot;Gin orange&quot;)&quot;<br> <br> echo $choice<br> <br> case &quot;${choice}&quot; in<br> &quot;whisky coca&quot; )<br> <br> gpio mode 2 out<br> sleep 3<br> gpio mode 2 input \<br><br> gpio mode 0 out<br> sleep 4<br> gpio mode 0 input<br> <br><br> break<br> ;;<br> &quot;wodka orange&quot; )<br> gpio mode 3 out<br> sleep 2<br> gpio mode 3 input \<br><br> gpio mode 7 out<br> sleep 4<br> gpio mode 7 input<br> <br> break<br> ;;<br> &quot;ricard eau&quot; )<br> gpio mode 24 out<br> sleep 3<br> gpio mode 24 input \<br><br> gpio mode 25 out<br> sleep 3<br> gpio mode 25 input<br> <br> break<br> ;;<br> <br> &quot;tequila orange&quot; )<br> gpio mode 22 out<br> sleep 3<br> gpio mode 22 input \<br><br> gpio mode 7 out<br> sleep 3<br> gpio mode 7 input<br> <br> break<br> ;;<br> &quot;Gin orange&quot; )<br> gpio mode 23 out<br> sleep 2<br> gpio mode 23 input \<br><br> gpio mode 7 out<br> sleep 4<br> gpio mode 7 input<br> <br> break<br> ;;<br> *)<br> echo &quot;bye&quot;<br> break<br> ;;<br> esac<br> done<br> ;;<br> &quot;soft&quot; )<br> while true; do<br> choice=&quot;$(zenity --width=400 --height=300 --list --column &quot;&quot; --title=&quot;test&quot; \<br> &quot;orange&quot; \<br> &quot;coca&quot; \<br> &quot;eau&quot;)&quot;<br> <br> echo $choice<br> <br> case &quot;${choice}&quot; in<br> &quot;orange&quot; )<br> gpio mode 7 out<br> sleep 6<br> gpio mode 7 input<br> break<br> ;;<br> &quot;coca&quot; )<br> gpio mode 0 out<br> sleep 6<br> gpio mode 0 input<br> break<br> ;;<br> <br> &quot;eau&quot; )<br> gpio mode 25 out<br> sleep 6<br> gpio mode 25 input<br> break<br> ;;<br> *)<br> echo &quot;bye&quot;<br> break<br> ;;<br> esac<br> done<br> ;;<br> <br> <br> &quot;shooter&quot; )<br> while true; do<br> choice=&quot;$(zenity --width=400 --height=300 --list --column &quot;&quot; --title=&quot;test&quot; \<br> &quot;whisky&quot; \<br> &quot;wodka&quot; \<br> &quot;tequila&quot; \<br> &quot;gin&quot; \<br> &quot;TGV&quot;)&quot; <br> <br> echo $choice<br> <br> case &quot;${choice}&quot; in<br> &quot;whisky&quot; )<br> gpio mode 2 out<br> sleep 2<br> gpio mode 2 input<br> break<br> ;;<br> &quot;wodka&quot; )<br> gpio mode 3 out<br> sleep 2<br> gpio mode 3 input<br> break<br> ;;<br> &quot;tequila&quot; )<br> gpio mode 22 out<br> sleep 2<br> gpio mode 22 input<br> break<br> ;;<br> &quot;gin&quot; )<br> gpio mode 23 out<br> sleep 2<br> gpio mode 23 input<br> break<br> ;;<br> &quot;TGV&quot; )<br> gpio mode 22 out<br> sleep 1<br> gpio mode 22 input \<br><br> gpio mode 23 out<br> sleep 1<br> gpio mode 23 input \<br> <br> gpio mode 3 out<br> sleep 1<br> gpio mode 3 input <br> break<br> ;;<br> *)<br> echo &quot;bye&quot;<br> break<br> ;;<br> esac<br> done<br> ;;<br><br> &quot;cow boy&quot; )<br> while true; do<br> choice=&quot;$(zenity --width=400 --height=300 --list --column &quot;&quot; --title=&quot;test&quot; \<br> &quot;ricard pierre&quot; \<br> &quot;whisky coca&quot; \<br> &quot;wodka orange&quot; \<br> &quot;gin orange&quot; \<br> &quot;tequila orange&quot; \<br> &quot;cimeti&Atilde;&uml;re&quot;)&quot;<br> <br> echo $choice<br> <br> case &quot;${choice}&quot; in<br> &quot;ricard pierre&quot; )<br> gpio mode 24 out<br> sleep 4<br> gpio mode 24 input \<br><br> gpio mode 25 out<br> sleep 5<br> gpio mode 25 input<br> break<br> ;;<br> &quot;whisky coca&quot; )<br> gpio mode 2 out<br> sleep 3<br> gpio mode 2 input \<br><br> gpio mode 0 out<br> sleep 6<br> gpio mode 0 input<br> break<br> ;;<br> &quot;wodka orange&quot; )<br> gpio mode 3 out<br> sleep 3<br> gpio mode 3 input \<br><br> gpio mode 7 out<br> sleep 6<br> gpio mode 7 input<br> break<br> ;;<br> &quot;gin orange&quot; )<br> gpio mode 23 out<br> sleep 3<br> gpio mode 23 input \<br><br> gpio mode 7 out<br> sleep 6<br> gpio mode 7 input<br> break<br> ;;<br> &quot;tequila orange&quot; )<br> gpio mode 22 out<br> sleep 3<br> gpio mode 22 input \<br><br> gpio mode 7 out<br> sleep 6<br> gpio mode 7 input<br> break<br> ;;<br> &quot;cimeti&Atilde;&uml;re&quot; )<br> gpio mode 2 out<br> sleep 2<br> gpio mode 2 input \<br><br> gpio mode 3 out<br> sleep 2<br> gpio mode 3 input \<br> <br> gpio mode 23 out<br> sleep 2<br> gpio mode 23 input \<br><br> gpio mode 25 out<br> sleep 2<br> gpio mode 25 input \<br> <br> gpio mode 7 out<br> sleep 1<br> gpio mode 7 input<br> break<br> ;;<br> *)<br> echo &quot;bye&quot;<br> break<br> ;;<br> esac<br> done<br> ;;<br> *)<br> echo &quot;bye&quot;<br> break<br> ;;<br>esac<br>done<br><br>
hello ,<br><br>right click on the file and check the permission should be &quot;anyone&quot;<br><br>and I gonna double check my code if there is no htlm tag Inside...
<p>OK,</p><p>I have revise the code.</p><p>Now I have this :</p><p></p><p>Do you have an idea for correct this problem?</p><p>Thanks</p>
<p>Please re upload the code it was some HTML inside ,if you see something &lt;p&gt;&lt;/p&gt; it shouldn't be there</p>
<p>yes you can do the same but i would not know how to program the touch screen</p>
<p>Can you do something similar with an arduino?</p>
Is that pump safe for health?
<p>Well it's more about the pipe from what i checked it's fine, and it will be always better than the water we drink from the sink !</p>
Technology and party - I love it!<br>And I love the gray drain pipe :-D
<p>ahah thanks !</p>

About This Instructable

5,340views

99favorites

License:

More by Thomas sxt:IOT Farm + Timelapse Cayenne Arduino/Raspberry Cocktail Machine With GUI Raspberry Auto Coffee machine bluetooth arduino + android app 
Add instructable to: