Cheese cave

From Real Vegan Cheese
Revision as of 05:02, 7 April 2014 by Juul (talk | contribs)
Jump to navigation Jump to search

The cheese cave is based around a "Haier 18-Bottle Thermal Electric Wine Tower" that we found for $40 on craigslist. This is an upright wine chiller that uses two large peltier modules with heatsinks and fans to chill the bottles. It was modified to add humidity control and humidity and temperature logging using a relay-controlled ultrasonic humidifer, an SHT15 humidity and temperature sensor, a 3.3 volt arduino pro and an OpenWRT compatible wifi router with USB.

The current developer on this project is juul. Contact him for more info.

Code

The sources for the lua web app and the arduino C code are availabel on github.

Reading temperature and humidity

The temperature and humidity are read every second using a 3.3 volt Arduino Pro and a SHT15 sensor breakout board from Sparkfun.

The arduino is powered by 3.3v coming from the wifi router and communicates with the router using TTL serial.

The sensor communicates with the Arduino using a "2-wire protocol" similar to I2C.

The arduino code uses a

Wifi and logging

A Linksys/Cisco WRT160NL router was flashed with OpenWRT version 12.09 Attitude Adjustment. OpenWRT was configured to use an external usb flash drive as its root partition (extroot). Avahi was installed and the hostname set to cheese, such that any mDNS compatible operating systems are able to access the router through the domain name cheese.local.

The router has an internal 3.3v TTL serial connector. This was connected to the arduino, providing both power and communications.

A simple web server was written in lua to read the temperature and humidity from the Arduino and display it on a web page such that the status of the cheese cave can be monitored by accessing http://cheese.local in a web browser.

Wine cooler hacks

The wine shelves were cut to make them flatter and a sushi mats was places on each shelf.

Wires were run into the chiller by un-mounting the bottom peltier module, cutting a small amount of insulation away, running the wire through and re-mounting the peltier module. One 110 vac power cord was run for the humidifier and a communications cord was run for the temperature/humidity sensor.

ToDo

  • Allow changing humidity set-point from the web app
  • Allow changing temperature set-point from the web app
  • Write step-by-step guide for replicating the electric cheese cave

OpenWRT configuration

The following assumes some knowledge of networks and *nix command line.

Go to the OpenWRT table of hardware and find the wiki page for your router. It will tell you how to flash it with OpenWRT. You should use a wifi router that has the following minimum specs:

  • Atheros chipset
  • 32 MB ram
  • 4 MB flash
  • USB
  • Supported by OpenWRT

You want to connect to the router's LAN port.

After flashing, telnet into the router using:

telnet 192.168.1.1

Set the root password:

passwd

Now exit the telnet session and log in with ssh instead:

ssh root@192.168.1.1

Wifi setup

We'll set up the router to connect to your existing wifi access point as a client (you could also connect it using wired ethernet if you prefer, which should not require any configuration, provided your router has a wan port).

Edit the "config wifi-iface" section in /etc/config/wireless (using vi) too look like this:

 config wifi-iface
     option device   radio0
     option ifname   wlan0
     option network  wifi
     option mode     sta
     option ssid     myaccesspoint
     option encryption none

Replacing myaccesspoint with your wifi access point name. If the access point is password protected you will have to specify the encryption method and password.

In the same file, remove the following line:

     option disabled 1

Now edit /etc/config/network, adding the following section to the end of the file:

 config interface 'wifi'
       option ifname 'wlan0'
       option proto 'dhcp'

You should also change the line "option ipaddr '192.168.1.1'" in the "config interface 'lan'" section to e.g:

option ipaddr '172.28.1.1'

Now reboot the router. When it finishes booting, DHCP should be running on the LAN interface and you should get an IP in the 172.28.1.x range. You can now ssh back into it and check if the internet is working:

ssh root@172.28.1.1
ping sudomesh.org

If it works then the router is successfully connecting to your wifi, but you won't know its IP address is. We'll fix this in the Avahi section below.

USB extroot

Now you can set up extroot to use a flash drive as your root partition. Take a usb flash drive, and plug it into a normal linux system (e.g. debian). It should show up as e.g. /dev/sdb (you can check using dmesg). First unmount it in case it's mounted:

sudo umount /dev/sdb1

Now change the flash disk partition type to linux:

sudo fdisk /dev/sdb 
At the fdisk menu, hit:
  t <enter>
  83 <enter>
  w <enter>
  ctrl+c

Format the flash drive as ext4:

sudo mkfs.ext4 /dev/sdb1

Now plug the usb flash drive into your router and ssh into the router. The rest of the commands in this section take place on your router.

Install the required packages for extroot:

opkg update
opkg install blkid block-mount kmod-fs-ext4 kmod-lib-crc16kmod-nls-base kmod-scsi-core kmod-usb-core kmod-usb ohci kmod-usb-storage libblkid libuuid swap-utils

Change the section "config mount" in /etc/config/fstab to look like this:

 config mount
       option target   /
       option device   /dev/sda1
       option fstype   ext4
       option options  rw,sync
       option enabled  1
       option enabled_fsck 0

Now mount the usb drive and copy the filesystem:

mkdir /tmp/mnt
mount /dev/sda1 /tmp/mnt
cd /
cp -a bin etc lib rom root sbin usr var www /tmp/mnt/
cd /tmp/mnt
mkdir dev mnt overlay proc sys tmp
sync
cd /
umount /tmp/mnt

If the following command gives any output after rebooting, then you are now using extroot:

mount | grep sda1

Avahi (mDNS)

To set up mDNS, first install avahi-daemon:

opkg update
opkg install avahi-daemon

Make it work without d-bus by adding this line to the [server] section of /etc/avahi/avahi-daemon.conf:

enable-dbus=no

Make it auto-start on boot:

/etc/init.d/avahi-daemon enable

Change your hostname to something relevant by editing the hostname option in /etc/config/system (maybe set it to cheese so you can use cheese.local to access the cheese cave).

Start avahi:

/etc/init.d/avahi-daemon start

You should now be able to disconnect the ethernet cable and ssh into your router using:

ssh root@cheese.local

If you're using Windows, you will first have to install Bonjour Print Services from apple, since Windows does not come with mDNS support (grrr).

If you at some point can't get into the router via wifi, you can always connect an ethernet cable to the LAN port and ssh to root@cheese.local

Wiring notes

Communications cables between sensor, router and arduino take place over old PS/2 cables that have been cut and soldered onto the different devices. These cables are shielded, easy to get for free, and the plugs make it easy to disconnect and reconnect components.

From router to arduino:

  • RX: Brown
  • TX: Orange
  • 3.3v: Green
  • GND: Ground (shield)

From arduino to SHT15 sensor:

  • VCC: Green wire to VCC (3.3v)
  • Pin 12: Orange wire to Data
  • Pin 13: Red wire to SCK (Clock)
  • GND: Shield/ground wire to GND

From arduino to the relay controlling the humidifer:

  • Pin 8: Relay control
  • Ground to ground

From router to the relay:

  • 5v: Yellow
This is needed since the Arduino does not have 5v (only 3.3v).