← back

Curing chamber with a wine cooler, Raspberry Pi and an Arduino

September 19, 2016

So I’ve managed to get my curing chamber up and running. In this write-up I’ll try to describe how I did and and what I encountered along the way.

TL;DR See the step-by-step guide

Say what?

I got inspiration on building my own curing chamber from the guys over at /r/charcuterie as well as the Dutch book ‘Over Rook’. What you need for curing meat is a temperature and humidity controlled environment to make it as comfortable as possible for your sausages and meats at the right moment. In terms of charcuterie this means you need to create a warm and humid environment for fermentation as well as a drier environment for longer drying.

So the essential gear you need is something to cool, something to raise the humidity (RH%) and in the colder months also something to heat.

Measuring and controlling

The quick road to success is using a temperature and humidity switch, switches like these can turn the fridge and humidifier off when it reaches a set value. I however wanted to have a bit more control and also measure and graph the values over time. I decided to go this way with a Raspberry Pi, Arduino and seperate sensors to control my fridge. See below my current gear list.

The Hardware - A wine fridge

  • Baumatic BW18BL Wine Fridge [1]
  • Click-On/Click-Off 433Mhz remote light switch [2]
  • Raspberry Pi 3 (with built-in Wi-Fi)
  • Arduino Nano
  • 433Mhz Sender and Receiver (For switching 220v remotely)
  • DHT22 with 6.7k resistor or AM2302
  • Small ultra sonic humidifier [3]

The contraption I have running now is: a Raspberry Pi connected to an Arduino that reads the humidity and temperature of the chamber and uses 433Mhz to toggle the remote switches to switch on/off the fridge and humidity in order to control the environment.

The set-up

[1] http://service.baumatic.co.uk/manuals/bw28bl-060709.pdf
[2] https://www.bol.com/nl/p/klikaanklikuit-startset-3-schakelaars-met-afstandbediening-apa3-1500r/9200000008884789/?country=BE&suggestionType=browse)
[3] I bought this one but it broke after 8 weeks. http://www.luchtbevochtigerstore.nl/product/402221/category-219103/stylies-atlas-yellow.html


The software - Pimatic & Homeduino

In the first stages of the project I wanted to control everything using my own software. So I wrote a small python library to read the AM2302 over GPIO ports, this worked fine. For the source of that project see here: https://github.com/tomvo/python_dht22. I however abonded this when I didn’t manage to get the 433Mhz sender/receiver working due to too much noise. I wasn’t able to send or receive anything. The reason for this was probably the lack of a filter circuit but since I didn’t want to go about soldering some filter circuit, I looked for other options. A lot of people reported success with using an Arduino for both the sending a receiving and so I ordered an Arduino.

The software that was being used the most often I found was Pimatic, a home automation system with support for a lot of modules, protocols and sensors and it even included a plugin for both the DHT22 and 433Mhz sending/receiving called homeduino.

The only thing left to do here was to flash the Arduino with the Homeduino code, hook up the sensors and I was in business. After the struggle with all the Python code I wish I would’ve known this before, after all my goal was to cure sausages, not write some huge controlling library in Python.

Step-by-step guide

1. Install your Pi

I used Raspbian which is just a matter of flashing the SD card and then booting the pi with it. You can download Raspbian here. The link also contains a tutorial on how to flash an SD card on windows and mac. Once you’ve done that, put the SD card in the Pi and switch it on. It should now automatically start.

There are two ways to interact with your pi. The first one is connect a keyboard and monitor to it, the easy way. The second being connecting your Pi to the network and connect to it over SSH, that’s how I did it.

1.1 Connect to your Pi using SSH

When you plug-in your Pi to your network using an ethernet cable it will ask for an IP address from your router, check your router DHCP table to find your Pi’s IP address. Once found, you can SSH to it. On Mac the ssh command-line tool is already installed, on windows you can use Putty.

In the above tutorial they tell you to install Ansible. You could also look at the git repository and edit the wpa_supplicant.conf by hand. Ansible seems like a bit of over head for this. Now connect to your pi over SSH to continue setting it up. Default user/password is pi/raspberry.

1.2 Connect Pi to Wi-Fi

I wanted to be able to have my Pi sitting next to the fridge without the hassle of cables so I decided to make it connect to my Wi-Fi network automatically. This is pretty straightforward. The only thing you need to do is create this file: /etc/wpa_supplicant/wpa_supplicant.conf. Then go to this gist that I made and copy the contents into your supplicant file. Be sure to change the name of the Wi-Fi and the password. Once you’ve done this you can try to remove the ethernet cable, reboot the pi and check your router to see if your Pi connects to it using Wi-Fi.

2. Install Pimatic

Just follow this excellent tutorial over at the Pimatic website: https://pimatic.org/guide/getting-started/installation/.

You can use my config file to get started, just make sure to fill in/replace the admin password. When using my config pimatic will load the plugins upon first load, no need to install plugins (like homeduino) seperately. Download the config file as a gist.

Starting pimatic
Once you have everything installed and configured it’s time to run pimatic for the first time. To check if everything works correctly, run sudo pimatic.js. Up until now I haven’t gotten the daemon to work but I use to sudo node_modules/pimatic/pimatic.js start to start pimatic. Have a look at this page (part of the installation guide): https://pimatic.org/guide/getting-started/running/. Make sure you also do a npm link if it doesn’t work.

You can tail the pimatic log when you go to your pimatic-app folder and then type tail -f pimatic-daemon.log. It’s handy to keep this open to see any errors or later to read the sniffed 433Mhz ID’s.

Now open a browser and go to your pi ip address, it should show you the pimatic interface where you can login. Happy times! (or not? Then let me know in the comments)

After logging in, this is what you should see:

Pimatic

3. Flash your arduino with homeduino (to send/receive 433Mhz and read DHT22)

Have a look here: https://github.com/pimatic/pimatic-homeduino. When using my config file there is no need to do anything with the devices, they are already loaded. Just make sure you following the exact same wiring diagram as in the readme.

To help you out, see here some really vague pictures of how I wired it:

Wiring Wiring

4. Sniffing the 433Mhz switch ID’s

In my config file you can see that the fridge and humidifier devices have an ID attached, this is the ID used for sending the remote signals. Every switch set has their own ID and you need to sniff it in order to get yours. To do this is easy, my config file already has the debug set to true so when you take your remote and press a few buttons you should see the code appear in the pimatic log.

note: I had it happen that my pi didn’t recognize the arduino on ttyUSB0, it seems it doesn’t mount correctly when you have it plugged-in and then booting. Disconnecting and connecting the arduino USB solved this issue.

5. Rules & Fine-tuning

When you look in your pimatic menu you find an option rules, this is where the magic happens. Rules are used to control with Pimatic is doing, you can use the values of the sensors and actuators to start controlling. When you used my config you already see four rules in there which you can change or work with just like you want.

I made a quick screencast on how you can make a new rule: http://recordit.co/Zb0Dgzw5kb

Here’s the link to the pimatic rules doc: https://pimatic.org/guide/usage/rules/.

Rules

5.1 Setting up a firewall & Accessing from the outside

I recommend setting up a firewall regardless if you will enable outside access or not. I made the mistake of not doing this when I quickly enabled outside access before I went on a holiday and came back to a hacked pi. I used this guide: https://www.raspberrypi.org/forums/viewtopic.php?f=26&t=47115 There is no need to do this while loop in screen. Just open up two SSH connections. Make sure the IP range you set the firewall matches the exact subnet of your home network, some networks use the 192.168.178.* reange instead of the 192.168.0.* one.

When you have this done just set-up a port forwarding in your router to point to your pi’s IP and you’re good to go.

DONE

Conclusion

At this point I’m happy with my set-up but I’ve noticed one major flaw in using a wine-fridge for a curing chamber. My wine-fridge uses a fan to pull in air from the outside that goes through a cooler. The good side of this is that you do not end up with stale air in the fridge and you have plenty of circulation. The downside however is that you’re constantly pulling in air with a probably different RH% then what you want, so either you’re humidifier is on constantly or it’s too humid to your liking and there’s nothing you can do about it. I had to re-fill my humidifier every 48 hours in the summer months during fermentation phase.

Heater Currently the ambient temperature of the place where the fridge is, is around 25 deg. However I expect it to go down as winter comes, so I might need to invest in a ceramic heater of sorts as well. We’ll see how that goes.

comments powered by Disqus