Full house rebuilding incl. home automation installation - my approach

Dear all,

with this post, I would like to introduce myself and my project. I am an 38 year old engineer interested in mostly any technical stuff you can find (disclaimer: interested does not necessarily mean being successful with it :innocent:).

When my family and I decided to buy a house that needs to be complete rebuild (“Kernsanierung” for you German speaking readers), I was keen to install a home automation that supports us in our daily life, without complicating it.
(sneak preview: it worked ;-))

So my main key goals are:

  • Undoability: The system should be exchangeable with a classical electrical installation without removing any wire from walls
  • high WAF: Although the WAF is a highly sexist, its principle is to be used - A non technical person should be able to use and, to a certain extend, repair the system without f.ex. using a linux console
  • Green footprint: making the house as energy saving as possible
  • Fun: Going through the process of setting up a system and maintaining it should always include the fun of building and using something self-build
  • Money: I did not want to spent too much money on sensors/actuators/home automation components

My Approach of doing this:

Cables:
To be able to undo the whole automation and rewire everything to a classical setup, it is necessary to wire everything that might become 230V in the right cable type for 230V. In addition to this, these wires must be guided to a electrical distribution rack. This can be done as one rack for the whole house (tons of cables and a HUGE rack) or as one rack per one or two rooms.
I went for the second one, this saves cables and complexity and supports my slave hardware.

Infrastructure:
Since I already running an home server and the house should have gigabit network wall outlets “everywhere” I did need a decent switch. Since I wanted to have a second small server (Cubietruck) to host openhab, I needed a second computer case and well, a second switch (separating home automation traffic from normal network traffic) Ebay Kleinanzeigen then found me a nice server rack for my basement, now hosting the above mentioned hardware.

All lighting and all clients shall be powered with 24V DC, therefore I have a central 24V 240W power supply that is distributed to each electrical rack.

Home automation hardware:
Since I now have electrical distribution racks for each two rooms, I need clients in these racks to control the rooms themselves. Any hardware on the market was too expensive or too featureless for my demands, which are:

Basis in every room:

  • sensors for temperature, humidity, brightness (installed in the wall terminals)
  • all switches connected to openhab
  • an RGB lamp (included in the wall terminals)
  • all wall outlets can be rewired to be switchable
  • all blinds are controlled by openhab
  • all windows are checked for being open

Optional features:

  • switching other loads (f.ex. LED stripes, washing machines)
  • supporting motion detectors

So buying was not an option: Let’s build it :blush: !

The final “room client” hardware has the following features:

  • 13 PWM controlled OUTs, each controlling either an Meanwell adjustable current source (powering high power LED lamps) or switching 24V loads (stripes, relais,
)
  • 23 digital INs, (every voltage from 5 to 24V DC will be accepted as “high”)
  • barometric pressure sensor
  • current and voltage sensors for the total client energy consumption
  • 4 sensor inputs, supporting the above mentioned sensors and the RGB lamp
  • 4 outputs directly controlling relays
  • Communication via Ethernet and the MQTT protocol
  • USB connection for programming it and getting debug information

Hardware wise, I am using an Arduino Mega with an Ethernet shield as a basis. Attached to these is my “room client” shield that itself is connected to two extension boards making the IO available. Every IO is somehow protected against 230V, be it through powering a relay, the protection system of the meanwell supplies or optocouplers.

So, where am I?

We are living in this house while working in it, which is a special kind of fun.
Nevertheless, we already have finished wiring the second floor and soon we will be able to move up. When it comes to home automation, the whole server and infrastructure is already up and running, server, rack, network cabling for the new floor 

We have three clients wired and working in the first floor, which is already pretty cool to use :smile:
Still they are not completely wired, since I need to wait for the wallpapers to be attached to wire all the switches, sensors and wall outlets. So I only have a small amount installed for testing.
I also have a MII-light test system and Sonos speakers that are integrated. The system already knows when our mobile phones come home (i.e. set up an WLan connection) and monitors sensors. It controls 90W of LED lights in ten different circuits and actuates the blinds. It also controls the info lamps in the connected rooms.

So the basic functions are all set up and ready to be scaled to a higher level.

What’s to come?

Basic functions:

  • scale the above mentioned functionality up for the whole house
  • several easy rules like: “turn infolamp purple when room humidity is too high” “after 20:00h do not actuate the door bell but blink the info light”

Example advanced functions/tasks:

  • open and shut window blinds depending on the sun position (easy) and the desired room temp and the outside temperature (summer sun heats up room: unwanted -> close blinds; winter: sun heats up room: wanted: leave blinds open)
  • make the data of heat pumps, water meters and energy meters available and correlate them to anything.

The hard stuff:

  • Forecast the amount of solar power over the day by interpreting the day of the year and the weather forecast. Correlate a list of jobs (washing machine, warm water heat pump, dish washer, 
) into the forecast to use as much solar power for these tasks as possive
  • maintain the whole system easily :scream:

So much for my brief introduction, there is a truckload of more details, just ask if you are interested.

Last but not least: I would like to say thank you to the openhab developers and the community making all this possible. GREAT WORK!

Cheers,
Christian

4 Likes

Impressive project - sounds like a lot of thought and clever design has gone into this. I wish I knew what I know now when I built my house 4yrs ago!!

Thanks! Well you mention my greatest fear with all this: while I am learning I take descisions that can only be reverted with great efford. Up until now everything worked out, but I am still waiting for Murphy to kick in :smile:

1 Like

Hi Christian,

My father in-law works in industrial automation using Saia-Burgess products. When I was building my house 3 years ago, he gave me some old PLC hardware to wire up the house.

I am not trying to tell you how to build your system, but maybe you get some ideas what should be automated or not based on my 3 year experience.

I did the following:

  • all the lights controlled by PLC
  • Boiler (for heating and hot water) is connected
  • Security system is connected: PLC turns the alarm on/off and gets back a simple state
  • 3 industrial touchpanels
  • Every room has temperature sensor as the original idea was that each room can be individually controlled
  • No mains sockets are connected
  • Sprinklers are controlled by PLC (with well pump, sump pump etc.)
  • All my light switches are momentary switches which go into the PLC and PLC turns the lights

What I found that controlling the lights is not the most useful feature. 99% of the time, I am using the light switches because I don’t feel the need to control them remotely. I have 3 lights which I tend to leave on, so those turn off automatically in 5, 10, 15 minutes.

One very useful feature: I have a button on the touchpanel to turn all the lights off when I leave the home. That is very handy. I also have a button which turns on the outside light and the light in the landing and turns them off after 10 minutes. This is what I use when I leave the house or arrive.

I also found that connecting the security system to the PLC is a good feature. Sometimes I turn off the alarm from the car, open the garage door, turn the lights on by the time I reach home. I can also check remotely if I have the alarm on.

I have christmas lights in the living room and in the garage window (which overlooks the street) which I am controlling via cheap timers I got in OBI. If I had thought of that, those can be controlled centrally as well.

I have a “burgler lights” program which cycles a few lights randomly between certain period in the evening. I use that quite a lot.

The original idea was that all rooms have a temperature sensor and I can control each room individually from touchpanel. I have the temp sensors installed in each room. The control interface would have been a thing that replaces a knob that is used to turn a room on/off. This thing has some gel inside which is hard on room temperature and shuts the valve off. To open the valve you apply mains voltage which heats up the gel becoming liquid and the valve pin pushes into the gel opening the valve. Buttom line is that I need the apply voltage when I want the valve to be open. That is 2W power for the entire heating season times 7 circuits. That is just too much power for a feature you will not use much at all. Hence it did not got implemented after all. Moral of the story is to understand what you are doing and the gain vs. cost.

I have an off peak meter which is hooked up to the PLC. So in the program I know when I have off peak electricity. For example I only run my well pump during off peak hours to save money.

I hardly use the phone app to control my house. I rather walk up to one of the touchpanels. It is just must faster and convenient. You may want to consider that.

Few more things to consider:

  • Since I have some overview of the industrial products, you may want to consider what is available on the market. Check Aliexpress for MODBUS products. You can get temperature/humidity sensors, digital/analogue inputs and outputs, current sensors, etc. MODBUS is most cases is over RS486, so you only need a twisted pair to communicate with openHAB. OpenHAB supports MODBUS. Since these are manufactured in volume, I think the price is competitive and could be a true alternative, especially if you consider the time of building something on your own.
  • I think what makes your life easier is AUTOMATION! Automation is not controlling your lights via your phone. Focus on what you want to work automatically: heating cycle, garden sprinklers, garden lights, setting stuff when you leave the home and turn the alarm on, close blinks in the winter after sunset, etc.
  • I have solar panels, but I don’t see the need of controlling them. The grid takes care of that.
  • Controllable appliances: I am not sure if this is possible at all. Nowadays everything has soft switches so controlling the mains power is not going to help. Check this first before building the whole system around it.

If you are interested I can do a video tour of my system so you an idea how it is done with commercially available products.

Dear Csongor_Varga,

thanks for your input. In principle I fully agree with your argumentation. But when it comes to hardware, its too late, the home brew stuff is already installed and working for one floor :wink:

My main goal in using the home automation perfectly fits into your description: Openhab should ease my life and not make it more complicate: If you need to get out your smartphone, unlock it, open the app and then turn on the ceiling lights, thats not what I want. But if you actualte a switch that does something clever, that’s another story.

talking about switches: This will be the main way of switching lights on and off. But as you said: AUTOMATION is the fun. Since all switches are hooked up to the room clients, they only deliver a signal to openhab and the rules decide what to do. For example: I have a switchpanel directly at our bed. one switch for each reading light, the third switch for several tasks, depending on the situation/time:

  • Switch off all lights in the sleeping room and the attached closet
  • in the evening do full power lighting
  • during the night dim the sleeping room lights to a non bright value
  • you name it :smile:

All my wall outlets are also hardwired to 230V yet, I can easily rewire them to become switchable (christmas tree, kids computers, 
)

Since I am still in the process and you are already finished: what is your experience with reliability? Which parts of the automation system did fail, which work flawlessly?
Which components are in your security system?

And yes, a video would be cool!

Thanks,
Christian

Hi,

I will put a video together next week when I have some time. My system is up and running for 3 years now. So far I had one relay which broke but that is all. I have to reset the main server which is running FTP from time to time (let’s say 2-3 times a year). It goes not affect the program, only that I cannot access my files via FTP.
Other than that I had many issues with the water level sensors. I have two differential pressure sensors one in the well, and the other in the cistern measuring water level to cm precision. These are proper industrial grade sensors that my father in-law uses in water towers and other places as well. I need the well sensor to ensure the well pump is not running dry and the cistern sensor is used to know now much water to top-up. My well does not give enough water to run the sprinklers, so I top-up the cistern and a second pump feeds the sprinklers.

The security system is very simple. I signed a contract with a company supply alarms here. I told them I want to link them to my PLC. The alarm has an input line which turns the alarm on and off. PLC turn a relay on and the security system is armed. I still have the regular keypad if anything goes wrong. The alarm has two outputs one is to indicate that the system is armed and the other if there is an alarm. Both and interfaced with one relay each. So it is not rocket science. I have no information (in the PLC) which zones are active, I can only see that on the keypad supplied with the alarm. So we kept it to the bare minimum.

One interesting story: we have the bedrooms upstairs, so when we go to sleep I turn on the alarm from the touchpanel (connected to the PLC) upstairs. Overnight my local router when down meaning that the touchpanel lost connection with the PLC. I could not turn the alarm off. The keypad is only downstairs and I had to go through and active zone to get it. So I turned the siren on before I could disarm it. More of the story: think about what happens when it all goes down, or even just your local network goes down.

Cheers,
Csongor

Dear Csongor,

I’d call this a well running system :smiley:. Did you evaluate your system to find “reliability bottlenecks” and found ways of working around those? (f.ex. having a spare notebook configured to be easily connected and booted whenever the server has problems).

So you have an “classic” security system that has those described interfaces. What were your toughs/concerns on security and vulnerability when hooking the security system to the home automation? How did you overcome them?

Please do not understand these questions as offending. I am just aligning my own thoughts to someone else to find flaws in my setup.

Thanks,
Christian

CeeCee,
Very nicely detailed. What power sensor are you using to evaluate per room power consumption?

Bravo on the planning.

Jason

Hi Christian,

This is certainly a benefit of an commercial system, especially that are design for industrial environment that the individual components are high reliability.

For the security system I also had password protection when turning the alarm on and off. So I don’t think that is less secure than the “classic” system. And it is in the middle of the house so it is not possible to physically get to without tripping the alarm.

Csongor

Hey Jason,

two different systems:

1st: Everything that is 24V powered is measured by a ACS712 (you can buy modules f.ex. at dx.com). in every room client.

2nd: My 230V distribution is divided into four different circuits. Each circuit has an energy meter that measures total energy per time. When knowing what is connected to where, it is easy to find the energy consumption of the interesting devices: Refridgerator, Washing machines, you name it


Cheers,
Christian

Ah sweet. I have never played with any current sensors Those are interesting :slight_smile: Thanks for the link.

No worries :smile:! Watch the measurable current when buying them, and keep in mind that 0 Amp = 2,5V, so you could even measure negative currents i.e. (low voltage!) AC. Although you would still need to to some trueRMS conversion.

I checked out a few videos on them. Interesting little sensors.

If you need any help, I’d be glad to help :wink:

Hi Christian, would you be able to upload some pictures of your racks with room clients and sensor in wall? Where exactly did you put them within a room? And in what? My idea is to have an access ceiling door in each room under which all room wiring would end up and be interconnected (directly or through an SSR). It would also house 5V and 12V power supplies and the room client as you call it.
I am planning to build something very similar to yours (if I finally find some land where I can build a house) and my thoughts on the implementation are very similar. A kind of controller in each room, MQTT protocol, ability to easily revert to classic installation (or actually switch between classic and “automated” one), 12V lights (as oppose to your 24V), same sensors as you have, motion sensors and an omni-directional IR blaster.
As for the controller I am thinking about Rasp Pi and/or Arduino Due+Eth shield with basic arduino(s) as slaves (if something more remote from the main room control box is needed to be controlled). I plan to use Win10 IOT for Rasp Pi which is getting better with each release. My initial thought about room controller was Mega with Ethernet shield as well but that combo is not that much cheaper than RaspPi which has ethernet built-in and is much more powerful (not sure about consumption) if I opt for something more power demanding in the future. Software updates should also be doable automatically via the network.
In regards to lights
where exactly did you place MeanWell adjustable current sources? I plan to use MeanWell LDD series (like LDD-350H) to be able to control the lights. My main concern is the transfer of PWM signal so it does not cause too much EMI and is not susceptible to EMI from other sources as well (like voltage spikes in mains when for example the fridge turns on). Although I am not sure if that should be of a big concern, I just don’t want to see the lights flicker when something “big” turns on. So my current thought is to have RaspPi/Arduino Due in the control box connected to TLC5940 12-bit PWM LED driver. Outputs of TLC5940 are then connected to high-speed optocouplers (since outputs are constant current sinks). This will also provide opto-isolation. The other end of the optocoupler is then connected to a line driver like 74LS214/74HC368 which is connected to cat5e pair and that goes out of the control box to each light (so the PWM signal is 5V). On the other side of the cat5 cable/light side is again an optocoupler (so the line driver in control box drives a led in optocoupler on the light side). The optocoupler is then connected to PWM input of MeanWell LDD constant current driver which drives the 12V LED light. Initially I was thinking of just PWMing with 12V straight from the control box but considering the highest PWM frequency from TLC5940 is 2MHz (when you set value of 1 out of 4095) and the length of the cable between the control box and the light might be 8m or even more it would be very hard to drive it at 12V delivering 350 or 700mA. I guess it would also cause quite some EMI. I have also considered using RS485 for transfering the PWM signal but then I would need a 5V source at the light end to power RS485 transceiver. Can you describe your solution for driving lights in more detail?
Also what kind of physical light switches do you use? Momentary or latching ones? I presume you are switching 24V only. I plan to use standard mains light switches which will switch 12V. Even though the current will be small I am not sure if generic mains light switches are suitable for DC power but I hope the contacts will not wear too soon. Those switches are also (usually) latching so the question is how to read it’s state considering the light can be switched on either with a physical switch or “via the network”. One can turn on light with a physical latching switch and turn it off via the network. So my idea is to react to the change of the switch state rather then turning light on when switch is in ON position and off when switch is in OFF position. If the light is off and you flick the switch (does not matter if it’s in ON or OFF position) the light will turn on.
I guess that’s enough for today :slight_smile:

Marek

Hey Marek,

A lot of questions, I’ll start from the beginning:

Distributors

Since I wanted the rebuildability, I opted for these in wall distributors. Plenty of room for my 24V/230V installation and if needed, plenty of rooms for classical electro installation.

In my wall, this looks like that at the moment (yeah, I know its still a mess, but the final connections will be done whenever the wallpapers are installed and the switches are in the walls :sweat_smile:):

In the upper part (blue and green block down to the red LED) you see the 230V distribution. All cables coming from the top are somehow 230V related (mostly wall outlets). The red LED thing is a relay board to switch blinds and wall outlets if necessary.
On the left side of this segment you find the 24V input and the network connection. Both is routed downwards to the room client.
Please also notice the big gap between the room client and the upper segment. It divides both voltage fields nicely.

The lower segment mainly consists of the room client itself. All cabling coming from the left is somehow active (mainly lighting) and all cabling coming from the right is somehow switches.

Roomclients

I cannot tell you anything about the RPi2 Win10 IoT things (never tried that). But here is what I did:

The room client itself is divided into three parts. The upper and middle segment are I/O Terminals. Here you can see in the upper left the Meanwell current supplies. Since these are expensive, I socketed them.
The Switch input side is taking Voltages from 5V to 24V and sends these to the Arduino. The voltages can be taken from the distributors in the middle of the Terminals. Why this variety? I do have cheap IR sensors that I wanted to connect, these only allow 5V. Some other stuff takes 24V, and in general I did not want to have special inputs but generic ones.

The lower board is the Arduino shield stack. You find a Mega on there with an Ethernet shield and on the bottom, my own shield. I did choose the Mega for various reasons:

  • Wide community support
  • All libraries that I need are already availabe
  • It has a truckload of native I/O lines that I am directly using (although with some electrical safety installed)
  • There is no overhead Operation system that can be penetrated/needs to be updated
  • No SD card required for operation (just a personal reason: My RPi has destroyed three SD cards and therefore was not really reliable)

For me it was necessary to develop this shield because it extends the Mega with some nice stuff:

  • 24V and Reset input (I can reset every client from my main 24V distribution in the basement if necessary)
  • a Fuse (never to be understimated)
  • current sensor
  • barometric pressure
  • Room Sensor inputs (the four ethernet jacks on the right) These inputs are necessary to connect the humidty/brightness/temperature sensors and Info Light installations in the rooms. I did choose ethernet jacks because cabling with plugs is cheaply available in the world.
  • last but not least the distribution connector for the I/O Terminals

One thought: It will be not very comfortable to work at a ceiling compartment when searching for problems or wiring your system. I did find spots for the distributors in my walls where they are not noticable. But you may not have this luck :frowning:

Puh, that was quite a list :smile:

Keep on truckin’
Christian

1 Like

Thanks Christian for your reply and the pictures.
It got me thinking about the output waveform of a constant current driver. For some reason I thought it is a PWM signal/voltage which is obviously not true. And I never gave it a second thought until now. The output is a very low ripple dc voltage which won’t generate too much EMI. So having LDDs in the control box makes much more sense. LDD might be a bit stressed when connected to a long cable and switched on since long cables have capacitance which can draw a lot of current when first powered on but since LDDs have short circuit protection (anything over the rated current) it should not harm them.
I still want to use optocouplers for any I/O so TLC will drive optoucouplers which will now directly drive LDDs. Depending on the voltage drop between LDD and the light source I might need to opt for more than 12V power source. Ability to have more than one light per LDD is also a consideration.
Can you do a picture of your sensors in the wall? I plan to have the temp and humidity sensors at about 1.5m height from the floor but not sure what housing to use so it works and looks ok. I guess it’ll be just a plain white box with some openings :slight_smile: The motion sensors and IR blasters will be at the ceiling.
Btw. is your house insured? Can one even insure it with all that custom home made electronics? I’d guess one would need some kind of (very expensive) certification (like CE or FCC). When I’m gonna build the house, I guess all the electro installation will have to be classic first to pass the electric revision. After that I am gonna start rebuilding it :slight_smile: I don’t think I will be able to insure it though.

Hey Marek,

those sensors will be, as also the infolights in the walls. They will be aligned with the Switches/wall outlets in this type of a case:

When it comes to conformity, I sticked to standards where ever I could. f.ex. all cables are 230V rated, even if those are used for 24VDC, 10mA. All 230V installations are done as one would do in a normal house.

So the main problem would be the 24V powered electronics. here I took care that all cables can carry a lot more current than the system is able to deliver. Also, There are fuses everywhere :smile:. So from the logical point of view, there should not happen anything that could harm my house.

Cheers,
Christian

1 Like

I presume they will have some kind of opening to let the air in, right? :slight_smile: Are you not worried that the readings will be off since the sensor will be in the wall rather than sticking out into the room?
I agree and understand your logical point of view but the insurance company will probably not want to :slight_smile: And if something happens, even if not caused by your dyi installation, I am sure they would refuse to pay the bill. Well I guess we can’t do much about it. Btw. I know that in an official revision of electric wiring (which every newly built house in our state must have) the revising electrician is (among other things) also measuring wiring resistance so including a relay (for switching sockets) in the wiring path might cause the resistance go over the threshold.That’s why I’ll probably have a classic installation first, have that revised and then modify.
Also can you elaborate on infolights? What are they for and how they look like? Is it a RGB LED in wall? I know you mentioned it for humidity and door bell indication, any other usages? I plan to have a tablet (something cheap) in each room as a touch panel so I haven’t thought of using any infolights, but just curious

The tablets are getting cheaper and more powerful every day, in my case it just needs to display a web page with room controls and maybe be able to stream video from the door entrance camera (when for example somebody rings the bell).

Hey,

yepp, definetly openings to let the air pass through. Those will not be the fastest sensors in the world, still room temp should not change much over time 


The lights will also be behind a panel, as the temp sensors. I will do a round cutout that will be covered with some sort of plastic-let-the-light-pass-and-blur-the-LEDs cover. And yes, those are RGB. I did build a round PCB that is equipped with seven (3,2V*7 = 22,4V just below 24V, see :innocent:) RGB Leds and a chip controlling these with PWM. Pretty straight forward design, easily controlled by and Arduino Lib and OpenHAB controls.

Seeya,
Christian