Introduction: Raspberry Pi Sous Vide WIP
This project is to build a Raspberry Pi sous vide machine that can be controlled via the web or via a walk up GUI interface. The main goal is to get something fully functional for cheaper than most commercially available solutions, which start at about $200, but also be extensible.
The main functionality of this Raspberry Pi is to turn off and on an external device, like a rice cooker or hot plate, via a solid state relay. A small screen and tactile controls provide for a walk up interface, and the power of the raspberry Pi is utilized for it to run a website that can control the sous vide machine.
Parts list for this project:
Raspberry Pi Kit, $85: http://amzn.com/B00G1PNG54
This may be able to be assembled for cheaper depending on any sales going on at the time, but your mileage may vary.
Rotary Encoders, $6.50: http://amzn.com/B00KHTLWU6
12v power supply for screen, $10: http://amzn.com/B00LLYYORO
3.5 inch screen, $17.57: http://amzn.com/B0045IIZKU
Cable to hook up to screen, $2: http://amzn.com/B008SO5LDQ
40 amp solid state relay, $7.99: http://amzn.com/B005KPIX9A
Heatsink for relay, $5.37: http://amzn.com/B005D6145G
Thermal paste, $3: http://amzn.com/B00006B8DX
Screws for relay/heatsink, $3: http://amzn.com/B00F32E42K
Temperature sensor, $11.99: http://amzn.com/B00EU70ZL8
Food safe heat shrink: $10: http://amzn.com/B0078S7DWA
Outlet, $1.19: http://amzn.com/B0015R9M2Y
Tupperware or other container (Suggest using one bought locally), $15: http://amzn.com/B007V4IWIU
A lot of these could be scavenged for cheaper than buying, for example using a CPU heatsink and metal screws as a heatsink instead of buying a custom made one. I also might have chosen a nicer, bigger screen in hindsight considering how much of a pain this all was.
Step 1: The Raspberry Pi 2: Introduction
First, the Raspberry Pi 2 will be the brains of our operation. You can use this as an emulator for old systems up to the Playstation and Nintendo 64, a full linux home computer, or to control low level hardware and input. These can be bought for $35, though expect the raspberry pi, breadboard, wireless dongle, power supply and SD card to cost at least double that.
The specific kit I got and used can be found here: http://amzn.com/B00G1PNG54
Once you get this kit, place the SD card in the slot, put the Raspberry Pi heatsinks on (I suggest cleaning the chips first with an alcohol swap), and put the Raspberry Pi inside of the enclosure. There is an included ribbon cable, which you will plug in to the raspberry pi and then to the breadboard adapter. Finally, plug the breadboard adapter in to the included breadboard. The power supply goes in to the micro USB slot, and while you can use any power supply try to make sure it is at least a 2 amp supply. Finally, plug in the wireless USB dongle.
You will need to image an SD card and hook the raspberry Pi 2 up to a keyboard, mouse and monitor via HDMI.
A complete guide of setting up the raspberry Pi can be found here: http://www.raspberrypi.org/help/quick-start-guide/
I highly suggest purchasing an SD card already imaged with NOOBS, new out of box software. You can find the guide on using NOOBS here: http://www.raspberrypi.org/help/noobs-setup/
Choose Raspian as your OS of choice, and once that is installed be sure to set your timezone and your keyboard nationality.
Step 2: Wiring Up the Raspberry Pi
For the purposes of testing, you are going to want to leave a USB mouse, wireless dongle (if you are using one), keyboard and monitor plugged in.
I used two rotary encoders that also featured push button for the input. The specific one I bought is here: http://amzn.com/B00KHTLWU6
You will then solder these to a solderable breadboard: http://amzn.com/B00FXHXSN6
The temperature sensor used is a DS18B20, which was also purchased from Amazon. It is important to note that this sensor is not food safe out of the box, the sheathing used is normal PVC wrap and would not be safe at high temperatures. You need to add a layer of food safe heat shrink.
Temperature sensor: http://amzn.com/B00EU70ZL8
Heat shrink: http://amzn.com/B0078S7DWA
You will also need a 4.7k ohm resistor to pull up the data signal. This is probably best bought locally, though here is one on Amazon: http://amzn.com/B00BWYS6ZY
You only need one to be 1/4 watt.
You will also want some wire to hook everything up and extend things where needed.
Something like these will work: http://amzn.com/B00B4ZRPEY
The wire will generally be cheaper in a brick and mortar store, so your mileage may vary. 22 AWG solid wire will work for all of our purposes.
Lastly, you will want some pins in order to hook everything up to the breadboard: http://amzn.com/B00899WPSE
This shows the final breadboard layout. The temperature sensor yellow (data) is connected to GPIO 4, with the black wire (ground) connected to the ground and the red (power) is connected to the 3.3 v header. A pull up 4.7k ohm resistor is required in order for the data to be read. GPIO 23 and 24 are the timer rotary pins, with GPIO 25 being used as the timer switch. GPIO 27 and 22 are used as the temperature rotary potentiometer pins and the TDX pin is repurposed as a GPIO pin for the temperature switch. When I saw switch, I refer to the push button feature of the knobs, as either knob can be clicked in.
Remember that there are multiple different wiring standards for the raspberry pi. Just to make it confusing, different software libraries will refer to the GPIO pin number or the physical pin number at times. Refer to the above graphic if you are having trouble matching up the pins.
Step 3: Set Up the Software
This software is still very much a work in progress, but there is a Git page for all of this software:
You will want to clone from this URL: https://github.com/drewhavard/rasp-sous-vide.git
So in the raspberry pi, go to a terminal and type in:
git clone https://github.com/drewhavard/rasp-sous-vide.git /home/sousvide
Change target /home/sousvide to something different if you want this project in a different folder.
Inside this git repository are a few other pages and config you will want.
The boot config.txt I used is in here, but note this already has a lot of the settings needed for the particular display I bought. You may want to edit these as necessary for your chosen display.
You will want to move the config.txt to your /boot folder, so user
sudo mv /boot/config.txt /boot/config.txtbak
To back up the config, and then
sudo mv /home/sousvide/config.txt /boot/config.txt
In order to copy the config I used. The main important thing the config does is set up device tree and additionally sets up the display settings.
rc.local is used to start up scripts, though this initial commit doesn't work for the python GUI, you still have to start that manually.
sudo mv /etc/rc.local /etc/rc.localbak
sudo mv /home/sousvide/rc.local /etc/rc.local
You will need to install some other components to get the web interface working for this.
Simply use the following commands to get Apache, MySQL and php installed:
apt-get update && apt-get upgrade
apt-get install apache2 php5 mysql-client mysql-server tomcat6 vsftpd
This includes a lot of things we will not use in this project, but it represents a "standard" lamp setup. You can read a more full guide here: http://elinux.org/RPi_A_Simple_Wheezy_LAMP_install
Once you have done this, you will want to copy the index.php we have created and pulled from Git
mv /var/www/index.html /var/www/indexbak.html
mv /home/sousvide/index.php /var/www/index.php
Now, you should be able to reboot the machine and visit the IP of your machine in a web browser in order to see the web interface.
Step 4: Attach Other External Peripherals
First, a reminder that 120 volts can absolutely kill you if mishandled. We are using a relay, but you still have to be extremely careful to not touch or be near the current once it is plugged in.
Please always double and triple check that everything is unplugged and unpowered before you go messing around with this.
The clean the heatsink and relay with alcohol swaps or with a microfiber cloth, apply the thermal paste and carefully spread with a credit card. Once you have a uniform thin layer, place the relay on the heatsink and screw it down.
Note that you want to be attaching this to the flat side of the heatsink, the two ends with a U shaped hole at the bottom are where the heatsink will screw into the enclosure.
All of the color guides that follow will be for US cords and outlets, please modify where appropriate for your country!
You will need a thick grounded power cable, which should be lying around your house. An extension cord will work if it is rated for at least 15 amps, or you can use a computer power cable of a similar rating.
You will want to cut and strip the power cable at a nice short length and strip about 1/2 inch or a little over 1 cm of the wire. You will also need to remove a bit of spare wire to hook up to the relay. The green wire is the ground, which will go to the bottom offset screw.
The 12v power supply can be fed with any power cable you have lying around, I stripped and used an old computer power cable. Just be sure to feed the black to the negative and white to the positive if you are in the US, and the green (if you have a grounded connector) gets fed to the ground symbol. You will screw in the power adapter for the screen at this step to, and the red is positive/black negative for this peripheral.
For the video cable, the 3.5mm metal headphone jack goes into the raspberry pi and the Red will actually put out the video. So connect the red RCA female jack coming from the Pi to the yellow coming from the screen.