Is there any information available to help me port RCSwitch ReceiveDemo_Simple from Arduino to an DOIT ESP32 DEVKIT V1.
The sketch compiles and uploads but the variable mySwitch.available() never changes. I’m running out of ideas about what to change next.
Please excuse if I have not used this facility correctly, I’m quite new to this game.
Kind regards, Mike
Hi Mike.
You are using the forum just fine.
Tell me…
What is the module that you are using?
How are you wiring the module to the ESP32?
That may be a wiring issue or the pins are not properly defined in the code.
Regards,
Sara
Hi Sara,
Many thanks for your prompt response.
The transmitter module I am using is a ‘iHaospace 433Mhz RF Wireless Transmitter and Receiver Modules for Arduino from a supplier listed in the MakerAdvisor.
The ESP Board that I am using is an ESP32_DevKitc_4, also from a supplier listed in the MakerAdvisor. This board has worked well on many other projects.
The wiring is as follows: VCC on module to 5v pin on ESP32, GND to GND, and middle pin (middle pins are joined together) on module to either pin 2 or pin 4 (ESP Interrupt 0). Neither pin worked.
A debug statement in the void loop continually prints out mySwitch.avalable is 0.
Many thanks for your help. I really enjoy the tutorials. Most of them work first time!
Take care and stay safe, Regards, Mike.
Hi.
Replace the following line:
mySwitch.enableReceive(0);
with:
mySwitch.enableReceive(digitalPinToInterrupt(4));//connect the module pin to GPIO4
And connect the module pin to GPIO 4.
Tell me if this solves the issue.
Regards,
Sara
Sara,
I’m sorry to report that the changes you have suggested do not appear to work – no output was written to the monitor in response to operating the transmitters ( 433MHz keyfobs and Mercury remote power socket switch.) I have tried both the ReceivedDemoSimple and well as the ReceivedDemoAdvanced
The issue here is does the 433MHz receiver work? I have tried three different receivers from a pack of five. They don’t look particularly well made and there is no led indicator on them to show that a signal has been received or that the unit is functioning.
I have ordered the wall plate switches as advised on the MakerAdvisor, but they will not be delivered for another week.
Any advice on the next step forward would be most welcome.
Regards, Mike
Hi Mike.
Do you have any Arduino board to experiment the module with?
Regards,
Sara
Hi Sara,
I have an old Duemilanove which still functions and so over the weekend I repeated the experiments with a variety of antenna on the receiver module. The antenna that were tried were:
1) 17cm wire, both straight and coiled,
2) coil loaded antenna with both bare copper and regular wire.
I also tried a simple circuit that needed no computer but used the transmitter and receiver to switch a led on and off.
Since none of the above worked I have concluded that the batch of receivers that I bought are defective and or the key fobs that I have used cannot connect to a simple receiver.
Yesterday I ordered another set of $433mHz transmitters/receivers from a different source, another Arduino so I can try computer to computer transmissions and another 433MhZ wall plate switch. These are due for delivery later this week.
Sorry that this has dragged on for so long
Regards, Mike
Hi Mike.
Then, tell me if you were able to make it work with the newest modules.
Regards,
Sara
Hi Sara,
Firstly, the new 433MHz wall plate switches worked perfectly with the Duemilanove and the new 433MHz receiver modules – a sucess. Further experiments showed that only one of the five initial batch of receiver modules worked and that was with a 17cm antenna. Non of the key fobs that I had been using to trigger the receiver worked. The fact that the identifier on the chip set had been ground off should have given me a clue, although the fob case did clearly show 433MHz.
However, I still have not been able to get the ESP32 version to work. I have perused many websites etc. Many identify the problem and many propose solutions that do not work. I think the problems are deep in the RC_Switch library, but unfortunately my knowledge of C/C++ is not good enough for me to understand the intricacies of the code.
In the mean time I will continue with the Alexa(Echo) with ESP32 and ESP8266 tutorial.
Regards, Mike
Hi Mike.
Can you show me the code that you used to test with the Duemilanove Arduino?
I’m not sure if you need to make some changes to make it work the ESP32. Hi can take a look at it and try to experiment with some modules that I have here.
Regards,
Sara
HI Sara,
I could send you the code that I used in the Duemilanove. However it was selected from File>Examples>RC_Switch>ReceiveDemo_Advanced in the Arduino IDE as advised in the RNT tutorial ‘Decode and Send 433 MHz RF Signals with Arduino’. The only change I made was to up the baud rate to 115200 baud.
I have used the same receiver code for the ESP32 as used with the Arduino with an identical change to the baud rate and the change you proposed to use (digitalPinToInterrupt(4). No Serial Monitor output was evident in response to activating the wall switches. I know the compiled program runs OK because previously I have put debug statements in the setup and loop functions. Incidentally I found quite a few web sites that propose the use of the DigitalPinToInterrup() function. I would quite like to understand what is not working as it should.
I have completed the ‘Decode & Send 433 MHz RF Signals with Arduino’ tutorial and have been able to construct two transmitters; one on an Arduino UNO and one on an ESP32. So I was able to to get Arduino(TX)/Arduino(RX) transmissions and EXP32(TX)/Arduino(RX) transmissions using the 433MHz modules. I’m excited about the prospect of completing the ‘Alexa(Echo) with ESP32 and ESP8266’ RNT Tutorial.
I look forward to the results of the ‘experiments with some modules’ that you propose.
Regards,
Mike
Hi Mike.
I’ve just experimented with the 433MHz receiver with the ESP32 and it is working as expected.
My receiver looks like the one in this picture:
The data pin is connected to D4 (GPIO 4) and the code has the changes that I’ve proposed you.
#include <RCSwitch.h> RCSwitch mySwitch = RCSwitch(); void setup() { Serial.begin(115200); mySwitch.enableReceive(digitalPinToInterrupt(4));//connect the module pin to GPIO4 } void loop() { if (mySwitch.available()) { output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol()); mySwitch.resetAvailable(); } }
I’ve tried it with a 433MHz remote and it works perfectly.
I’m out of ideas why your module doesn’t work with the ESP32.
Regards,
Sara
I too am having problems with the RC switch decoding, and my serial monitor remains blank at all times! I am using the arduino with the suggested code. I am wondering if my 433 receivers are also useless, even though I am on my second set. On the back of the chip there are three frequencies suggested (315,330 and 433 MHz) – but none of the numbers are highlighted to show what version this board is (even though they were sold as 433)
Howard
Hi Howard.
Are you sure that the transmitter is actually transmitting 433 MHz signals?
Everything is working fine for me and my receivers are a couple of years old.
Regards,
Sara
Thanks Sara, at the moment I using the remote switches and the remote controller and that combination is working fine straight out of the box, but I am trying to decode the signals that are involved by connecting the 433 mHz receiver that I bought and using the ReceiveDemoAdvanced code for the Arduino. However I see absolutely nothing on the serial monitor. Could you take a photo of the back of the receiver (the one in the photo above) to see whether the frequency is marked as 433 MHz and whether that is the same as mine. I cannot figure out either how to include a photo in these messages.
Thanks again
Howard
Hi Howard.
To share a photo, you can share a link to google drive, dropbox or imgur.
Here are two photos of my receiver:
Regards,
Sara
Hi Sara,
I have just lost my first and lengthy response to you.
In summary, I have been able to get three 433MHz receivers responding to two sets of wall switches on two ESP32s. I don’t understand why they now work when previously they did not. I cannot identify anything that is different apart from reloading the Arduino IDE.
So many thanks for your help and I will now move onto Alexa (Echo) with ESP32.
Howard states that his monitor is blank. He should get about 10 lines of output when the ESP32 resets. To reset my board consistently I pressed the reset button for about a second or two and on release those ten or so lines appeared on the monitor. I also put a debug statement in the code to print out when control was leaving void setup() to demonstrate that the monitor was working OK. Oh and I did not get any of my key fobs to trigger the modules and neither did the remote power switch handset.
I was also interested to see the photos of your receiver modules. There are two obvious differences.Firstly your receiver has a fat resistor mounted on the board, as shown on the silk screen print on the rear of the board. My board does not have that resistor. Secondly the silk screen panel containing the three frequencies is missing from all of my boards. On my board the panel contains the numbers 1 to 9 in a 3 by 3 matrix.
I have tried different suppliers. I’m not sure I’m getting better quality components. I have read that many of these modules are used in cheap toys with a very limited life span.
Regards, Mike
Sara,
One other thing springs to mind. Two of the 433MHz receivers do not have any antenna and as a consequence they are very sensitive to their relative position to the transmitter, that is they have to be close and at the right angle. The receiver with the 17cm straight wire antenna seems to respond to the transmitter anywhere within a couple of feet range and possibly more.
Regards, Mike
Hi Mike.
Thanks for your response.
Issues with the receiver can definitely be related with the antenna.
I’m glad you get it working now, even though we cannot really tell what the problem was.
Regards,
Sara
Please confirm if I should see the ten lines of code if I am running the code (as originally suggested on the Arduino Uno) or whether that is only as a result of resetting the ESP32 if I was using one of those?
Howard,
I am sorry that I misread you earlier communication and thought you were using ESP32s.
I have repeated my Arduino experiments and I can confirm that I do not get any ‘system’ output on the monitor. This prompted me to insert a debugging statement in the setup loop. So now the output on the monitor is a simple statement confirming leaving the setup loop followed by streams of data triggered by the wall switches.
Please note my earlier comment that I did not get any of my key fobs to trigger the modules and neither did the controller for the remote power switches. Only the 433MHz wall switches described in the tutorial consistently work for me.
Hope this helps,
Regards, Mike
A few days ago I watched a YouTube video from that guy with the Swiss accent (Sorry I can’t find it right now). As I recall it was about ESP32 available pins. At any rate at one point in the video he mentions that either taking a specific pin high or low will stop the output of those system lines on reset.
Hi Howard.
Can you better explain what’s the issue you’re facing with your receivers?
Regards,
Sara
Thanks Mike for your answer and Sara for continuing to support me,
I have concluded that the wall sockets and the remote control that I bought are not outputting the type of data that the decoder program is looking for. I have tried with two different receivers and I don’t get so much as a blip on the serial monitor, and I have checked everything else a hundred times.
I’m going to try and find some other RC things to test out the receiver and the program.
Thanks again, will let you know how I get on.
H