Friday 26 July 2013

The components

Today I will present you the different components I have bought yet, what they are for, and how to connect them with each other.

The Raspberry PI
It is an mini-PC, very easy to use, running Linux. I guess most people buying them are geeks, but you can also use them as a media station, or something like that :



The LCD screen
This part was the most difficult to find. The original constraint was to find a 3-5'' LCD monitor including a touch panel, compatible with the Raspberry PI. However, all the monitors I could find were very expensive, around 150€, even the smaller ones.
The other solution was to buy a "naked" LCD screen, and find a way to make a case around it. After much reflexion, I finally bought this screen :




It is a 6.3'' LCD screen with a touch panel on it, native resolution 800x480. It has an RCA input, which is good because the Raspberry PI has an RCA output. It also has a remote control to configure the backlight and so on. The last part is the touch-panel controller, which is independant from the display part. It has a standard 4-wire resistive input for any touch panel, and a USB plug. I guessed there was a driver for Linux, which is the case fortunately :)
The complicated part is that the screen doesn't have a case. The solution for this problem is to design one and have it built using 3D printing. This method is becoming quite usual, and there are many services on the Web where you cand send a 3D file and receive the object some days later, in various materials. It is not really cheap, so I'd better do a one-shot-good :) The good thing is that I can integrate all the electronics inside the case, and let a hole for the temperature sensor. I will come back to the case later.
I bought the screen on Aliexpress (like all the other components, except the Raspberry), which is a good site for this kind of things. However, I received it after 2 months and a half, so if you ever buy something there, be patient !

Once I received the screen and the Raspberry, I connected them through the RCA. I then had a bad surprise, because the RCA output of the Raspberry is low-resolution only, so the dispay was quite ugly. The only solution to have a clean display is to use the HDMI output of the Raspberry, but the screen only has a VGA input, so I had to buy an HDMI to VGA converter, which is not a simple cable because the HDMI signal is digital, and the VGA is analogic :


Once connected this way, the screen works perfectly (after setting some parameters on the Raspberry, which I will describe later).

The temperature sensor
I first bought a simple USB temperature sensor on Aliexpress :


Once I got it, I found some piece of code on the Internet to communicate with it and retrieve the temperature. It worked, but after some hours of temperature retrieving every second, I observed some strange values. Sometimes the communication with the sensor just didn't work, and sometimes the returned value was irrelevant. After speaking with a colleague at work, he suggested that I use one of the sensors we are working on, and we know are very robust. The sensor is based on a TMP102 chip, communicating using an I2C bus. For those who don't know, it is a 2-wire communication protocol, often used to communicate between electronic chips. The Raspberry PI has an I2C controller on some of the multi-purpose pins, so I just had to cut the cable, and solder a plug :


Once done, I just plug it on the Raspberry, and I have to retrieve the value of a register on the I2C bus, then convert it to the temperature, according to the TMP102 datasheet. Actually I already had the code, because I implemented it for an other project at work.

The relay
A relay is just a switch, but instead of switching it with your finger, you can switch it by sending an electric current :


This is what will allow me to actually control the stove, by connecting it on the serial port. It should be easy to use with the Raspberry, because it has General Purpose Input Outputs (GPIO), which are pins you can easily control to send a current or not. It did not test the relay yet, but I have no doubt that it will work...
As you can see, there are two relays on the board : having an extra-relay might prove useful later, for example to turn the screen on/off if I can't control it otherwise. By the way, A 2-relay board is not more expensive than a 1-relay... Actually, I have other ideas which may require other ones, so I'd better have bought an 8-relays in the first place !

Next time, I will come back on how everything is connected together !

Thursday 11 July 2013

The stove controller

So, once the idea was set in my mind, I started thinking about how I could make it work in the most convenient way. Definitely, I needed an electronic board and a relay to control the stove. Then, I still wanted to be able to control the stove manually, or change the temperature configuration easily. That meant I needed an interface. Moreover, the temperature sensors needs to be somewhere in the middle of the house, far from the stove itself.

The best thing was to have a small LCD screen with a touch panel. The good point is, I have a corridor which leads to the rooms, and there is some space on the wall :


As you can see on the left image, there is currently a CO sensor on the wall, but I plan to move/remove it. That leaves me a lot of space for the screen. And the very good point is that there is plenty of space behind the wall (right image) : the half-painted wall will be closed one day (to hide the toilets frame), so I can put all the electronics here without having a clean case. Moreover, I can bring the required cables there and hide them easily.

So what I need right now is an electronic board, and LCD touch screen !

For the electronic board, I first thought about an ARMadeus board, because I use them at work so I am very familiar with them. However, the processor board requires a motherboard, so the whole solution is not really cheap. Actually I could afford one, but one challenge of the project is to keep it very cheap. Finally, I decided to use a Raspberry PI. If you are even a half-geek, you probably know about it. It is a mini-PC with all the connections one need. Some months ago, I thought they were useless, but actually, they're perfect for this kind of project : very cheap (around 40€), ready to use, a decent processor and enough RAM, 2 USB ports, an Ethernet port, an HDMI port, everything required to control external electronic devices : I2C, GPIOs, 3.3V and 5V power supplys.

With the Raspberry Pi, I've got everything I need in the first place : an output for my screen, an input for the temperature sensor, an input for the touch panel, and an output to control an external relay.

So next time, I will talk about the other components !

Saturday 6 July 2013

Details about the stove

This time, some details about the stove !

First of all, it is an Edilkamin Funny. Here it is in situation in my home :


The white plates behind it are fire-blockers, they were mandatory because our house is made of wood :)
By the way, they will help me hide the cables !

As I said earlier, it has a serial port at the back :


The documentation doesn't say anything about it. So after googling some time, I found some forums which talked about it, and especially this picure :


Very well !! However, I wanted to be sure that this was compatible with my model, so I has to google much more to be sure of that. Finally, I decided to test it. I took a serial cable (we have plenty of them at work, which are quite useless !), cut it, and added a swith connected to the 2/6 pins, plugged it on the stove, and voilà ! It just worked.

Of course, there are some limitations about how you can turn it on/off. There is fire in the stove, so it doesn't turn on instantly ! When started, there are 10 minutes during which you can't do anything, so that the fire has time to set up properly. Same thing when stopping, 10 minutes for all the remaining wood to be burned.
That means you can't turn it on and off too frequently. The fire is really hot after 30 minutes, so it would be unproductive to let it burn 20 minutes and turn it off. For this reason, a hysteresis regulation has to be used on the controller, with a high delta between the thresholds.
Moreover, the temperature sensor should not be just besides the stove, because it takes time before the whole house gets hot, even if the stove has a hot air fan.

That will take me on the controller position inside the house, next time !

Monday 1 July 2013

First post ! Domotic project started

Hi everyone !

Finally, this is my first post on this blog !
For the time coming, I'm going to talk about a domotic project I'm working on for some time. Now I have some interesting things to share, so I will try to write posts every time I go on.

I got the original idea some months ago, during the long nights when my wife was feeding our baby, and I just had to wait so I could change him and take him back to bed. The point is, it was winter and the temperature outside was around 0 °C. On the other hand, we own a brand new house, which is very weel insulated, and a single pellet wood stove to heat the house. The stove is quite oversized, so when it turns on, the house gets very hot within some hours. It is then very difficult to have a constant temperature, especially at night, without burning too much wood. The good thing is, the stove has a serial input at the back, the seller told me I could buy a GPRS modem to turn it on remotely with an SMS. So I found some documentation on the Internet, and found out that I just needed to connect two pins of the port, and the stove turns on. Disconnect them, and it turns off. So what I just needed was a temperature sensor, a driving board, and I could have an automatically regulated fire !

More technical details on next post :)