A sketch to control home illumination in a smart manner via 433.92MHz wireless X10-like devices, e.g. Nexa.

Background

When it comes to decorative illumination, it has been somehow tiring to me that every second or third week I had to readjust the timers that switch the lights on because of the shifting of the solar hour with respect to the CET.

At the same time, some nights we go to bed earlier than other. Because of this, sometimes the lights switch off either "too late" or "too early".

The above challenged me to think: I want the decorative illumination to switch on always at the same level of ambient light and then switch off at certain time depending on if we are awake or not.

 

Objective

This sketch exploits the possibilities of wireless controlled devices like System Nexa operating on the 433.92MHz frequency.

 

Material

To take fully advantage of the possibilities this sketch gives, you need:
1) An Arduino Uno (tested on R3)
2) An Arduino Ethernet shield
3) A Nexa set or similar operating at 433.92MHz
4) A PIR (Passive InfraRed) detector
5) A 10KOhms resistor
6) An LDR
7) A RTC DS3231 (external server version only)
8) A 433.92MHz transmitter: XY-FST
9) A 433.92MHz receiver: MX-JS-05V

 

The minimum recommended is:
1) An Arduino Uno (tested on R3)
2) A Nexa set or similar operating at 433.92MHz
3) A 10KOhms resistor
4) An LDR
5) A 433.92MHz transmitter: XY-FST

(the omission of the Ethernet shield requires modifications of the sketch)

 

Internal versus External Web Server

Internal Server exploits the possibility of the Arduino Ethernet shield to provide a web server. The web server will attend web client calls to check and interact with the Arduino. This is a straight forward solution with limited functionality; the possibilities of enhancing the web server code are limited by the memory of the Arduino.

The External Server requires the setup up of an external PHP web server. This setup is more complicated and not supported by this tutorial however, the PHP code/page to check and steer the Arduino is provided with basic functionality. The possibilities of enhancing the web server are, in this case, limited by the external web server.

 

RTC Time Set

To set the time/date on the RTC I use sketch SetTime that comes together library DS1307RTC. Only applicable to the External Server version.