I'm again working on a project for school. But this time I'm not uploading it when it's finished, we're still working on it and for some parts we could still use some help. So if you have idea's, please let us know!
I'm working on a project that will be used as a DIY domotica system. The different parts in the project that we combine together:
The Raspberry Pi acts as a server for openHAB. A java-like program is written with the different items and rules for how to act when a certain item (like a switch or a dimmer, etc) is activated or deactivated. This program continuously runs on the Raspberry Pi. In the program a GUI is also created. The interface can be accessed by laptop or cellphone. When an event occurs, like pushing a button in the interface to put a light on or off, the Raspberry Pi gets a message with the status change of the item and reacts in an appropriate way by sending another message to an Arduino for turning that light on or off.
Main PCB with Arduino Mega module and Ethernet/SDcard shield
The Arduino can receive messages from the Raspberry Pi that it has to change an output, if so the Arduino sends an I²C message to the correct output. The Arduino knows which pin is in- or output and what that I/O represents in the house because the user saves a Excel file (translated into txt-file) on the SD-card.
If an input changes on the other hand, the Arduino has to see what kind of input it is, if he knows to do what to do if that input changes by himself, than he has to do the action himself, otherwise he just has to ask the Raspberry what to do with it. In both cases the Raspberry has to be updated with the new state of the system.
On the main PCB is also an output for DMX. Some lights will be controlled by a DMX dimmer.
If one needs more I/O’s than we now provide (see part ‘extending PCB’), the Arduino’s need to be able to communicate with each other. For this we will use UART, as not all Arduino’s are going to have the Ethernet shield.
Connection between Raspberry Pi and Arduino
Option 1: As we are not using any real KNX-components, we don’t need a real KNX bus. We can send KNX net-IP messages over an Ethernet cable. The Arduino uses the Ethernet shield.
Option 2: If we would like to be able to use other KNX-components, than we need the KNX-bus. For connecting the Raspberry Pi to the bus, we have a KNX tunnel. We connect the Raspberry Pi to it with an Ethernet cable and on the other side we have the connector for the KNX bus.
For connecting the Arduino mega to the KNX bus we have to make a driver ourselves. At the moment this is not worked out yet.
Extending I/O PCB
On this PCB’s we have an I²C I/O extender with 16 outputs (MCP23017). We can have 8 extending PCB’s on 1 Arduino, which means we have 128 I/O’s on 1 Arduino Mega module (DMX outputs not encountered). The outputs we will control with these modules are mainly push-relays. The inputs we will read out with these modules are push switches. To avoid problems with the I²C bus we use the SMBus buffer (PCA9512).
As everything needs to fit on a DIN-rail, we are going to use the plastic casings from Bud industries.
For connections between these boxes for the I²C communication and the power, we are going to use the connectors from molex (44764-0801 & 44428-0801).
Remark: You might wonder why we don’t only use the intelligence of the Raspberry Pi. This is because the project also needs to work without Raspberry Pi. A more elementary house can only make use of the Arduino’s. But if you want more complex things, like working with a smartphone, than you need to take the Raspberry Pi.
We have still problems with the Raspberry Pi and Open HAB, so if anyone has some experience with this, please contact me!!!