About This Project
My goal was to build a simple programmable unit to control standard 433MHz switch units. Want to use that to control the lights in our house if we’re not at home. I am not a programmer and used some Turbo Pascal back in the 80's in Electronics school. Hooking up an Arduino to a real time clock and copy/pasting code is no problem but writing code to compare times and dates is way to complicated for me at this moment. Then I discovered Cayenne! On Thursday I received my Wemos D1 and after a few hours of playing around the first version is working.
Getting the 433MHz transmitter to work from the Arduino/Wemos D1.
I used the following resource to get it to work and used a 433Mhz receiver to discover the code that the manual remote control unit was transmitting. https://arduinodiy.wordpress.com/tag/elro/
Figuring out the @#%# Pin mapping of the Wemos D1.
Having played around with the Arduino I was somewhat confused by the Wemos D1 pin mapping.
Check the following page for more information: https://github.com/esp8266/Arduino/blob/master/variants/d1/pins_arduino.h
For this project I used the Wemos D1 pins labelled D9 (=2 in my sketch) and D3 (=5 in my sketch). Took me some time to figure that out.
Wemos D1 V2 (includes Wifi, supports most Arduino code but has a weird pin mapping)
Elro 220V switch unit
Img 0 : These are the 433Mhz transmitter and receiver I use.
Img: this is basically all it takes, the D1 and the 433Mhz transmitter
Triggers & Alerts
I am not using triggers or alerts (yet)
Scheduling is one of the two main functionalities. I have built the controller for 1 channel but can easily add multiple channels by copy/pasting code. One channel can control multiple switch units in parallel.
It’s a very simple set up at this moment but as said, I can easily add other channels.
Photos of the Project
Img 1: D1 connected with the orange Data wire to the transmitter. I also hooked up a LED to indicate if the switch is supposed to be on or off. (don't forget to put a 1k ohm resistor in series to ground)
Img 2: The 433MHz transmitter. It has 4 pins but only the Data, + and - are used.
Img 3 The 220V switch unit and the manual remote control unit.
The sketch code
cayenne_WemosD1_V2.txt (2.0 KB)
Explanation is embedded in the code
- I sometimes encountered issues with scheduling. At this moment I am running a duration test and scheduling is working well. The issue I had was that I scheduled an event and it just did not work.