Foreword
As I (might) have mentioned before, the initial reason why I got into home automation was the house my dad built in the middle of nowhere. The current system is based heavily on 1-Wire, which is pretty much a wired equivalent for EnOcean standard. 1-Wire bus uses only two wires and each device has an unique address, much like EnOcean.
My goal for the design is to create an add-on for the Raspberry Pi, which will include all the stuff needed for the current system, with the addition of EnOcean. As the house wasn’t originally designed for automation, wireless sensors bring a much needed addition to the system, as they’re easy to install.
I have managed to finish first draft of the add-on board schematic. This enabled the final go-ahead for the prize order, which I received today. I also managed to test (almost) all the functionalities described in this post today, so everything should be ok for ordering the PCB. I have designed the PCB already, but haven’t had time to double check it yet.
I’ll be going through the design piece by piece, explaining why I did it like I did. There’s also couple of renderings of the PCB and pictures from the test setup at the end...
Power supply
As I found out in my review of the Tektronix TBS1052B-EDU oscilloscope, cheap, Chinese DC-DC converters are enough to supply power to the new design of the Pi. As I need a higher power supply for relays etc, this suits powering the 5V for Pi and some other components very nicely. I did look into the possibility of implementing the same circuit myself, but noticed quite soon that it’s more expensive and would take the same space on the PCB anyways.
As the house isn’t occupied during weeks (dad working abroad) and temperatures reaching as low as -35C, the system needs to be rock solid. This is why I’ll power the Pi through a Texas Instruments TPS2034D. This allows me to implement a microcontroller (Texas Instruments MSP430G2152) to control the power supply. My plan is to send a “heartbeat” from the Pi to the microcontroller. If the heartbeat stops for any reason, the MCU will cut the power for couple of seconds and reapply it. Also, all other external circuitry will be connected to this, so everything is reset at the same time.
Of course the microcontroller is running on 3.3V instead of 5V, so I need a step-down regulator. I chose Diodes Inc. AP1117 for this, as it’s relatively small but can still supply a lot of power, just in case I want to add more devices to the 3.3V.
EnOcean
Initially I thought about implementing the EnOcean TCM 310 module to the board, it’s the same as in EnOcean Pi. It doesn’t seem too hard to design a circuit to hold it, but at the moment I just don’t have the time for it.
Instead, I’ll be using long pin headers for connecting the board to the Pi, (hopefully) leaving long enough headers for the EnOcean Pi to connect through the add-on board.
I2C
A lot of the stuff I’ll be using relies on I2C, some of which will be running from 3.3V and some 5V. Because of this I’ll need a level-shifter to translate messages across different voltages. For this purpose I chose NXP PCA9306D. It’s specially designed with I2C in mind, so it should do nicely.
Keeping time
Internet connection for the house is an external 3G modem, so it might not be reliable, especially in case of power failure. Correct timestamps are essential when checking through the backlog, so the system also needs a real time clock with battery backup (Pi doesn’t have one ). I chose Maxim Integrated DS1307ZN+ for this, as it has quite good reputation and connects to I2C. All the external parts it needs are a battery and a crystal, so it’s quite easy to implement as well.
1-Wire
I chose Maxim Integrated DS2482S-100+ as interface from I2C to 1-Wire. This will basically be the heart of everything, as the system relies very heavily to 1-Wire. 1-Wire will take care of relay control as well as most of the temperature measurements.
The DS2482 will be connected to 5V, although it can also function with 3.3V. This is mainly because of wire lengths etc, so the bus voltage is high enough for long distances. Also, DS2482 uses active pull-ups for the network, so it should work reliably.
Controlling relays
The most important part of the system is relays, which is used to control anything from a heating boiler to lighting. The boiler heats the whole house, so the system needs to be designed so that in case of a failure, relays are switched to a predetermined state.
Interfacing between the Pi and relays will be done via Maxim Integrated DS2408, which connects to 1-Wire. As the voltage (or current) threshold of the DS2408 isn’t that much, I added a Texas Instruments ULN2803A to take care of the high voltage side. This allows me to use anything up to 50V for relays. However, I’ll be using the same voltage for supplying the circuit, so the input is capped to 40V because of the DC-DC converter. This is more than sufficient though, as the relays I’m using are 12V. These might change to 24V in the future, so it’s good to have a design that can handle it.
Wire connections
As with any system, I’ll of course need some wired connections. For these connections I chose a spring loaded connector, Phoenix Contact PTSA 1.5/10-3,5-Z. I did think about using a traditional terminal block, but these seemed like a good alternative and allow easy attaching and detaching of the wires. I chose the 1.5mm2 version of the connector, because we have some wiring done with 1.5mm2 wires already. Nothing in the design really requires such heavy wires, but it would be too much work to replace the wiring.
There’s also header for both, 3.3v and 5v I2C, so it’s easy to extend the board as needed. I have also added some pull-ups and pull-downs to the GPIO pins I haven’t used, this way it’s easy to add devices like IR-sensors, buttons etc to the system.
Summary
The board should be able to handle everything I (at the moment) need from home automation system. We’ll be testing the range of EnOcean sensors this weekend at the house, just to be sure that the range is sufficient. If not, we need to do some minor changes to the setup at the house, but nothing too major...
So far I’ve tested basically all the systems on a breadboard, excluding the functionality of the TPS2034D. This has to be tested before I order the PCB, as the whole reset functionality relies on it. I might add few small details still, but I’m fairly sure this is the design that will make it to the PCB.
Figure 1: PCB from the top.
Figure 2: PCB bottom side
Image 1: Test “setup”, more like an unorganized mess...