The ‘Domotica Gateway’ (DG) is build around an Arduino Mega 2560 with ethernet shield. The main goal of the DG is to interface with the outside world using the digital in- and output ports, RFM12b 868Mhz Transceiver, 434 Mhz transmitter and 434 Mhz receiver for remote switches and analog ports.
(The RFM12b 868Mhz transceiver is added in a later stage because it can send and receive and is compatible with Attiny84 and TinyTX sensors. The 434Mhz transmitter is still used to control remote switches. The receiver…. it’s still hanging to receive remote switch signals but not really in use now)
The reason I choose to use a dedicated Arduino is to not interfere with the solarpower measurements on the Solar Monitor Arduino. The Raspberry Pi only has a limited amount of digital ports and are 3.3 volt while most of the sensors or equipement I use needs 5 volts. So I decided to make a dedicated box to which the Solar Monitor Arduino, the Raspberry Pi and websites or telnet sessions can communicate over ethernet.
This page describes MY setup. Let it be your inspiration to build your own !
The main purposes of the DG are:
– Communicate with other systems using simple ethernet commands;
– Communicate with iOS Arduino Manager;
– Switch relays
– Switch 434Mhz wall outlet switches
– Receive 434Mhz wall outlet remote control signal to register switch status
– Send data to wireless LCD display over 868Mhz
Communicate with other systems
Two ethernet server processes are listening to incoming connections. A maximum of 4 connections is possible. One server proces listens on a specific port (23) for telnet or simple tekst commands. The other server process is listening on another port for incoming iOS Controller connections (check out Arduino Manager).
Commands are like: LampA_ON, LampA_OFF for switching Light A on or off. TX868= is used for sending something over 868Mhz. TX868=TXT,This is text. This will transmit “This is text”. Using TX868=V1,300,340,243,235 the values are interpreted by the domotica gateway which knows what the values mean and send to the LCD display. You can create your own commands just like the above.
The DG also send the status of the lights to the wireless LCD display. (it sends the value of variables over the air, and the receiver can process it).
In the source code you have to define the relays you want to switch. You have to connect the relays to the Arduino board digital ports. For switching lights or devices not close enough to connect them to a relay, buy some cheap 434Mhz remote control devices. In the Netherlands the versions of ‘Klik Aan, Klik Uit’, ‘Action’, ‘Blokker’ and ‘Elro’ work. (Buy them at Action for EUR: 9,99 for three ;-)) and switch the devices wireless.
Recently I attached a 434Mhz receiver to the Arduino. It can serve multiple purposes, but in this case it was to receive the remote control signal over 434Mhz from the remotecontrol of the action kit (configurered on another code then the wall outlets). Interpret the signal and switch the wall outlets using 434Mhz. By using this method, the Arduino always knows the status of the switches. Otherwise somebody could switch the wall outlet directly without using the Arduino. Knowing the status of the switch is useful for updating the ‘Arduino Manager’ switch status, and so on.
Unfortunately the idea is good but it does not work very reliable, probably because of the location where I’ve put the receiver. I stopped using it.
Communication with iOS device
I use the Arduino Manager application which provides an app with switches, displays, graphs, led’s and so on for you iOS device (iPhone, iPad). Using the included library it was very easy to connect the iOS device to the Arduino. Commands can be send from iOS to Arduino, status can be send back to iOS.
Switch Relays
Buy some relay board on ebay. Usually they contain 1, 4 or 8 relays with a connection to 1, 4 or 8 digital ports on your Arduino. Switch a digital port to 1 (sometimes it’s the otherway around, so switch to 0) and you can switch heavy loads on the relay like 220v lights, coffeemachine, TV, and so on.
I use a ‘old fashion’ DIN plug to connect the relays board to the Arduino. For a 4 relay board I used a 6 Pin DIN connector.
The pin layout I used is:
1. 5 Volt +
2. Relay 1 (pin 42)
3. Relay 2 (pin 44)
4. Relay 3 (pin 46)
5. Relay 4 (Pin 48)
6. GND
(This is primarily for my own reference 😉
Remote control wall outlets
Buy some cheap 434 Mhz (search on ebay on 433 mhz!) receivers and transmitters. Use this library to switch remote controlled wall outlets. The transmitter is connected to PIN 12 on the Mega. Pin 13 is connected to a LED and is ON when data is being send.
Before I used the same transmitter to send data to other systems like the wireless LCD Display using the virtual wire library but I’ve replaced this functionality with the RFM12b 868Mhz transceivers.
RFM12B wireless transceivers 868 Mhz
I’ve replaced the virtual wire library using the cheap 434Mhz senders with the RF12 library from Jeelib and still cheap transceiver modules, the RFM12b. Because those new modules are only 3.3volt and the Arduino is running on 5 volt, I recommend you buy the RFM12b Board from jeelabs.org. This works perfectly. (Actually I had a module running for 3 weeks on 5 volt but it is not recommended).
The RFM12b is available on 434, 868 and 915 Mhz so choose what you like. I choose 868Mhz because 434Mhz is already used for my switches. The 915Mhz is not allowed where I live. Start reading here on the RF12 library and use our friend ‘Google‘.
[wpdm_file id=4]
[wpdm_file id=5]
You receive the whole package, Energy Meter, Domotica Gateway, SensorBox and Wireless LCD Display so all versions are working together. I’ve packed all libraries as they are on my disk now. Those might not be the most recent versions, but they should work with sources.
Unfortunately the sources are not ‘monkey proof’, so you have to dig into the code and change it to suit your situation and needs.
No Comments Yet