Sunday, June 21, 2015

What kept me busy the last few months

It's been a while since the last post on this blog. This hat many reasons but here are the most interresting ones:

1st of all i have replaced a thermostat in my livingroom with a tempereature monitoring and internet enabled one built by myself in my livingroom:

Until now i had a thermostat in my livingroom which was a bimetal with a turning knob scaled from 1 to 5 which ment cold or hot. Just the inside part of this thermostat costs at the hardwaresore somewhere around 50 €. To adapt that to the design of the lightswitches and poweroutlets you have to pay another 10-20 € depending on the design. So i decided to go for a replacement.

First i thought about a arduino pro mini with a 0.96 inch spi Oled display, a rotary switch and a ESP8266 Wifi-adapter. That all together costs less than a thermostat from the hardwarestore. Problem was that all that is, although the parts are very small, to large to fit in the hole of the existing thermostat. I also did not find a proper switching power supply. And the most difficult thing of the whole project was that i had to design all the Programming. Sure there is the incredible huge and mighty u8glib, and there are many libraries for the rotary encoder, but i decided to take the thing to another level and came to another solution which fits quite well.

This  is my partslist:

  1. Raspberry Pi Model A+ (24€ because it is small and has less power consumption)
  2. Pi-TFT form Adafruit. 2.8 inch resistive touch (35 € affordable and in stock)
  3. edimax nano-Wifi dongle (12 €)
  4.  USB Powersupply (had one laying around but costs 7 €)
  5. housing (6 €)
  6. micro SD Card (6€ )
  7. DS18S20 temperaturesensor (3€)
  8. Sharp solid state relay (had it laying around.price ? because it is very old and not sold any more)
all together 93 €. That is not bad for a internet-enabled thermostat that is logging the temperature to thingspeak and can be pimped to alarm-system

Here are some pictures:
old thermostat

new thermostat (sorry german)
The display did cost me some nerves, because although all 26 pins are routed through something happens with the voltage on the way and therefore the 1-wire protocol on GPIO-Pin 4 is not working. After fiddling around 2-3 days i found a thread on the mircrocontroller-forum and that led me to use GPIO5 (accessable because the Pi was a Model A+). The next Problem was that i had to use a special bootloader from Adafruit to run the Pi-TFT. Not nice.  Although it is a nifty little display and the app runing is a wxpython script. That comes handy because there is plenty of code to read out the 1-Wire temperature-Sensor.

One little thing to mention is that if you want to build the same thing: Do not try to put the RRD-Database on the sd-card. That will destroy the card by time. I am writing the temperature every 5 minutes and therefore i have placed the rrd-database in a ramdisk. To save that i have a cronjob running, that is saving this file every hour to my nfs-server. On boot i copy that file again in the ramdisk by a rc-script. The same procedure comes handy with the prefered temperature, which is written to a file (by the webserver and the wxpythonscript)

So that was the main project i was working on. Right now i am in a project to pimp my hacked IKEA Lamp that i mentioned earlier. Now i try to make a spherical light source that i can project coloured clouds on the Lamp. This could be used to build an palantir. Right now i have 20 WS2812B and a arduino pro mini in mind.

Ok. Thats all for now. If you like i would appreciate if you post comments or like/share. I try to keep this blog alive.