In this project you can make a very cheap home automation light controller with 2 wire push button control In many new home automation systems the push buttons have a pcb card to communicate with the controller and each pcb/button and controllers are very expensive. The goal for this was makig a cheap normal light controller with 2 wire control capabilitys. The system works with a resistor divider on a analog input and toggles the output relay of the desired light output. Each channel has his own resistor value, who's very simple to mount in normal push buttos from every brand. You just need to know for the button what channel he uses and mount the right resistor to it. The program and input is emc proof through the implementation of a LF inputfilter so there is no problem with noise. The program wait 100ms before taking the value so when you push a button it has time to stabelize the voltage on the input before takig effect. Also the system won't take further action until every button is free, so fast on/off toggle is imposible. If you make a short circuit to the 2 control wires , the system sees this as a "all off" position and all the lights go out. In the circuit you'll see that the relays are driven with a uln2803 chip but a 7channnel uln2003 is also possible. The relays in the circuit have a coil voltage of 12v but you can use also 5v or 24v types just change the voltage rail. of the relays and the uln's. If you familiar with programming an arduino you can use this as a base to implement other funktions like timers, delays, motion detectors, light sensors, and whatever you want to program, if not the system works fine for normal operations.
The circuit and program (*.cpp) can bedownloaded here. this is the active high version for the use with uln2003/2008 chips. To read the cpp file, change the filename extention to file.txt and you can read the file in notepad.Copy the text into the arduino ide and upload the project to the arduino, wire the extra card with the relays and your home automation system is ready.
There is also an "inverted output" version for the use with relayboards you can by on ebay who are controlled with a negative going signal. download here. The software invert the output to an active low.
If you know to hook up a HC05 bluethoot module the system can be controlled by your smartphone also, only some adaptation to the software will do it and if you implement the previous project the channels don't have limitations also, just make the use of more analog input channel and group the system to more input lines and it is possible to control a realy big house with a large number off lights. There is almost no limitation of this, yust use your imagination.
Because we use the bitread/bitwrite funktions the system uses a very small amount of his memory.