Saturday 9 November 2013

State of progress

Hi everyone !
It's been a while since my last post, but I have been working a lot on my domotic project, as you will see ! Today I just want to show you what I have successfully done, what problems I had, and what is to do next !


The case

I have spent a lot of time on designing the case, because I wanted something really great. My objectives were to have something looking good, as small as possible, and easily openable for maintenance. My first idea was to have a first part fixed on the wall with screws, holding all the electronic part, including the touch screen; then having a second part (polished and painted) which would slot on the first one, so that I would have no visible screw. It was a hard challenge, and I did something quite good, but I was stopped because of the price : having two parts means twice the price of printing, and with the required size, a part is around 100€, which is quite expensive, so I had to do it with a single part.
Finally, I came up with something very simple, and small. I also had to give up on the openable part : all the inside parts will be sticked to the case, so if the screen dies, it will be nearly impossible to replace it.
Here are some 3D renders of the case as it will be on the wall. The exterior desing is quite simple, with just a rounded border.
And here is a preview of the back/inside :

The screen will be sticked to the case, and the board sticked on the screen. The temperature sensor fits the hole so that it shouldn't move, but I will have to change its position (see below).
The hole on the left is for the infra-red receiver, not represented here.
The screws are represented in red, so that they are clearly visible.
The case is fixed on the walls by the screws, which are not visible from outside, except if you look at it from the very bottom. I will have to place the screws on the wall first with a pattern, then slot the case on them by moving it down, like any standard frame fixed on a wall. I hope it will be strong enough !

The wires

The most complicated part was to set the wires between the toilets, the Internet router, and the stove. I had to make a big hole in the toilet's ceiling, so that I could set the sheathes under the attic's floor. Then I screwed all the electronic boards directly on the toilet's wall, which will be covered later :
I looks quite a mess, I did the best as I could ! And as I don't have the outside case now, I also set the screen there.
The red/black wire is the one going to the stove, it is a simple HI-FI wire...
Here is the stove once the wire was upon it. The fire screens can be easily removed and they are hollow, so I can hide the wires between them.
Now, the wire is connected to the stove's RS232 port !
In the corridor, here is the hole I made in the toilet's wall. Right now, you can just see the temperature sensor going though it. At first, the sensor was outside the wall, so that it is the most reactive as possible. However, the first time we turned the stove on, the sensor was too much reactive, because it is quite high, and right towards the stove, so the hot air is directed to it, and the temperature raised to 25°C in half an hour. To correct this, I placed some rubberband on the hole, to isolate the sensor from the pushed air. That means I will have to work again on the case to embed the sensor inside it.


The software

I didn't mention the software earlier. The technology I use is the Qt framework with the C++ language. I made this choice because I am very familiar with them, and they are very easy to work with. The C++ is not the easiest language, I could have used Python with PySide (The Qt binding for Python), but C++ is a bit faster and allows more optimizing when required. As the Raspberry PI doesn't have a very powerful processor compared to a desktop PC, that's wiser.
The good thing is that I can make the software on my PC, test it heavily, and when everything works, compile it again for the Raspberry. I made a test interface so that I can simulate different conditions of the sensors and see if everythings goes well.
I don't plan to release the software by now, because I don't really see the need, but if anyone is interested, let me know and I will push it on github !

The software is not very complex though, I just need a few interfaces, and a nice enough design. Here are the main elements done :
The main screen, always displayed (when the screen is on). There are currently 4 widgets on it :
  • The first one simply displays the current date and time, useful because we don't have any clock in our living room
  • The second one displays the state of the stove and the trigger mode
  • The third one displays the current weather conditions
  • The fourth one displays the current inside temperature
When you click on the temperature widget, you can see a curve of the last 24 hours temperatures
When you click on the stove widget, you can :
  • Turn in on/off manually
  • Set it to automatic/manual trigger mode
  • Set it to holiday mode, so that it won't turn on until you come back and find your house hot :)
  • Configure the automatic mode thresholds and planning (not done yet, but I plan if for this week-end !)

It does work !

Once everything was set up, I was quite impatient to try it ! I had tested all the parts individually, but not together. I had to wait some days because it was not cold enough, and the first time I wanted to turn the stove on, I used the touch screen, and it just worked ! The day after, I set the automatic regulation mode, and was very happy to see the stove on when I got home, the hot air being very comfortable !

Sunday 1 September 2013

The big plan

After some days of works, I have finally ended the big plan of connections. I thought it would be a mess, which is the case when you plug everything physically with all the wires, but the plan is clear enough :


Well, there are many things that can be noted about it :

The front panel

I wanted to have as few components as possible inside the front panel, so that I will be able to design a small case. Finally, there is :
  • the touch screen
  • the temperature sensor, which should be out of the case to sense the ambiant temperature
  • the monitor board, because the wire to the screen is very small and I can't extend it
  • the monitor conrol board, with the infrared receptor accessible from outside (see below)
  • the VGA plug, because the wire to the board is very short (or maybe I will try to extend it if it can't fit inside the case)


The monitor power management

As you can see, I have decided to have the monitor board always powered. Instead, I will turn off the screen backlight when I want it asleep. The reason is that the monitor board takes some time to initiate when turned on, and it displays a big blue "VGA" indication. This way, the board is always ready and the LCD screen actually displays something, but you can't see it. When you touch the panel, the backlight will be back on which is immediate.


The monitor control board

You may be asking why the monitor board is inside the front panel ? Actually, it's not really required, but in case there is a power loss (which happens quite often when there is a thunderstorm), the monitor needs to be reconfigured to display the correct resolution, so I have to include the control board and have the infrared LED visible from outside. Or maybe I will let the board behind and put a wire between it and the LED, to save space in the panel.


The music

I have decided to buy standard desktop speakers for the bathroom, and fix them at the ceiling. The point is, I don't expect them to work forever, especially because of the humidity. That means I have to be able to replace them easily, so I will add a power outlet and an audio plug at the ceiling, and plug the speakers from here. The day they die, I can replace them with new ones and just plug them. The plan is not really true about it : I will have the relay power the outlet itself, so that the speaker cable doesn't need to be customized.
Actually, this idea is obsolete as I have a new one which suits much better, I will talk about it in the next post !


The power

I will need many power outlets for the various boards. Fortunately, there are power cables inside the back wall of the toilets, used for an outlet in my son's room. I just have to open a hole and shunt the cables.
The network cable (not represented) will be a bit trickier because the main router is quite far, but I have meters of Ethernet cable left, and the up floor is not set up so I can join everything together (same for the stove cable !)

Feel free to ask any question if something is not clear !

Tuesday 13 August 2013

More features !

Once I had set the idea of having a Raspberry PI, I started thinking of extra features I could add to my box. The question I asked is "what do I need a computer for, but does bother me to turn it on ?"

Weather forecast

This feature came quite naturally, because the box is supposed to manage the temperature inside the house, so having the information about the temperature outside and the forecast is very relevant. It also resolves the problems of "What am I going to wear today ? What will the weather like ?"

Technically, it is not very complicated to retrieve a weather forecast from any web service, and display it. After some research, I choose Weather Underground which is the provider of The Weather Channel. They offer a very complete and easy access to their data. They also have stations everywhere in the world for the real-time weather, and there is one at some kilometers of my house. You can query it 500 times a day freely, which is good enough !

Music in the bathroom

When I get up on saturday morning, I really enjoy turning on the music and taking a shower. However, not everybody at home like it, and I have to lower the volume so I don't hear anything. The idea is to buy some cheap desktop speakers, fix them at the ceiling in the bathroom, and connect them directly to the audio output of the Raspberry.
I have a NAS where all my music is stored, so I can access it easily by network. A shuffle play will be good enough !


Now all the features are described, I will present the (big) connection map of all the components, next time !

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 :)