Controlling cheap 433MHz Switch units with Wemos D1 and Cayenne

About This Project

(MQTT code included at the bottom of this article)

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. Elro – Arduino, ESP8266, ESP32 & Raspberry Pi stuff

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: Arduino/pins_arduino.h at master · esp8266/Arduino · GitHub

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.

What’s Connected

Wemos D1 V2 (includes Wifi, supports most Arduino code but has a weird pin mapping)
433Mhz transmitter
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.

Dashboard Screenshots

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.

Update April 1st 2018: migrated to MQTT

I changed to MQTT and that works well. I only have an issue selecting a device/actuator when using the schedule from the IOS app (raised a ticket for that).

MQTT sketch included 20180401_MQTT_code_433Mhz_remote_switch.txt (3.4 KB)



1 Like

This is an awesome project, thanks for posting!

1 Like

The issues with scheduling are known. There are certain scenarios where the schedule will not run. This is a high priority bug for us to fix coming up. Sorry about that!

Love the project! Hang in there while we fix scheduling :slight_smile:


1 Like

Hi, thanks. I am aware of that. Keep up the good work!

Hi, I’m trying to set up a Wemos D1 with Cayenne and struggled a bit. I have it running in the Arduino IDE ok and manually imported the Cayenne libraries, However, I struggle to set up on the Cayenne side as I’m not sure if I should categorize the board as a Arduino or some other. Any tips on how you set up your Cayenne side with Arduino would be appreciated.


Sorry for my late response. I used the Generic ESP8266.
When setting that up it generated an Auth code that I could use in the Cayenne code that I uploaded to the Wemos D1 (and other ESP8266 based boards later on).

Just tried to create another device and see that it now generates MQQT credentials and ID. I guess in the most recent Cayenne code there are placeholders for that information.

Hope this helps.


If you run the code as he has above in the project you can select an Arduino Uno as the device. It’s kind of confusing but it really doesn’t matter what the device actually is on the Cayenne side. You can rename the device in the settings after creation.

I’ll try it thanks. I’ve tried Blynk and just wanted to compare the two.
Havevyou any preferences. I noticed Blynk has limit on widgets but you can
pay for more.


The method listed here of adding the device to the dashboard actually uses Blynk to make the connection and send data. The method mentioned by @ihatespam is the new officially supported way of connecting an ESP to the dashboard and it uses MQTT. I’ve never personally used Blynk other than the back-end part that Cayenne uses.