The log cabin control system is an ongoing project to use a Raspberry Pi to control various environmental aspects of the Log Cabin described below.
It started with just using it to control the heating. It has moved on from there to detect presence in the log cabin and turn power on and off to mains devices to save power then they are not required. I have a future project to automatically open and close the blinds that I am currently working on.
The Raspberry Pi
The log cabin control system operates using my first Raspberry Pi, a fairly original version B running a reasonably up to date version of Rasbian – Wheezy. I can’t currently upgrade to Jessie due to compatibility issues with WebIOPi which will be explained a bit later.
The requirements for the core code were that I could easily program it and that I could interface to it from a mobile device and PC. For the programming, it ideally had to be Python. When I bought my first Pi a few years ago, I started brushing off my programming skills and learned Python which is the main interpreted language used on a Pi. I found it easy to pickup and intuitive.
In order to be able to interface to a mobile device and PC, I had to go searching for something to help me. I knew I did not have the skills and time to write this all from scratch so I did some research.
I found the amazing WebIOPi which exactly fitted my requirements. It provides an excellent interface to various sensors with the building blocks to easily setup a web interface. You can write your own core code using Python and call functions from the web interface.
Unfortunately, development has stopped on it as the author has been hired to write for My Devices who are producing a similar product called, Cayenne. You have to tweak it to work on the Raspberry Pi 2 which I used for the Minecraft Controlled Christmas Tree, but it looks like there is no chance it will be updated to work on Jessie. Cayenne is not really a replacement.
The beauty of WebIOPi is that it allows you to use your own code to provide the core logic but relying on WebIOPi’s architecture to simplify the interface to sensors and the web portal. Cayenne is a drag and drop alternative for those who don’t want to bother with coding. For the moment, it all works okay but I do know that there will be a point at which I may have to transition to something else if I want to upgrade the Pi it is running on.
The concept of the heating control is simply to turn a mains powered oil filled radiator on and off to achieve a desired temperature in the cabin.
To sense the cabin temperature, I have connected the Pi to a 1-wire temperature sensor, the DS18B20+. There are many good resources on the internet about this but a good article is from ModMyPi.
After some research I found an excellent radio controlled mains plug system from Energenie4U. You can make the equivalent products cheaper but there is a limit to the time I have and they are simple and reliable. I also had an issue with the first Pi Mote I received and their customer service was excellent.
The transmitter that is connected to the Pi is called a Pi Mote. They now do one which allows two way transmission so you can get feedback from the mains socket. They did not sell this at the time and they are more expensive so I am only using the one that transmits.