I am using 2 HC-12 modules to communicate between an Arduino uno and an ESP-32 board. Everything works fine for a while, with the HC-12 responding appropriately to AT commands and transmitting data. However, after some time, the HC-12 communication just ... stops.
I tried checking the HC-12 on the arduino uno with the AT commands, and I do not get any response. The HC-12 on the ESP32 still responds to the AT commands. I decided to swap the HC-12s, to see if this is a problem of one of the HC-12 modules, but even then, the HC-12 on the arduino uno now (which was originally connected to esp32) did not respond to AT commands, and the HC-12 on the ESP-32 (which was originally connected to the arduino uno) responds to AT commands. This must mean this is a problem on the Arduino Uno.
I then changed the pins I used for my RX and TX on the Arduino, and then my HC-12 module on the Arduino starts working again. However, after a few hours, they stop working again, and I have to change pins once again.
Would anyone have any idea why Arduino Uno behaves this way? Resetting the board does not fix this, and the only thing that seems to fix this is time. Is there something in the Software Serial library that causes this problem? This is something that has made me waste a lot of time
Does your Uno only have the HC-12 connected? Or is there something more?
Does power cycling the Uno and HC-12 solve the issue (this is not the same as a simple reset of the Uno as you did try).
Bad contacts might be a cause of your problems.
Hi, currently there is also a micro-SD card reader attached to the Uno, but this problem has been persisting for quite some time, before I used the microSD card reader. Maybe the reader might be making this happen more frequently? But I am not too sure, I haven't been recording how often I face this issue
What does power cycling mean? Does it just mean to disconnect the Uno from the power supply and reconnect it (in my case, my laptop)? If so, yeah, I also try that, but get the same result.
Regarding bad contacts, that might be possible too, but I just wanted to see if there were any other possibilities before I conclude that
Both Arduino and HC-12; if the HC-12 is powered from the Uno, disconnecting the Uno from the laptop should be sufficient.
My comment was based on your comment that just resetting the Uno is not sufficient to get communication going again so possibly the HC-12 might get into an unknown state.
I doubt it is the SoftwareSerial that causes the problem; problems like you experience would have been picked up / known long ago if they were in the library.
They suggest it in order to take advantage of the diode's forward voltage drop effect.
I fried a HC-12 module once on the Uno due to not paying attention to this. It occurred during a data burst transmission. After that experience, I always put a 1N4007 there between the module's VCC and the Uno(or any other 5v power source/supply) when operating above 4.5v no matter, even if the module is sitting there just as a receiver. I found no drop in output power, data rate nor range when the diode was added.
Just to be on the safe side, I also always put an electrolytic decoupling capacitor(I think I'm using a 100uf 16v one) in series with the module(between VCC and GND).
Well, I don't think so. In the use case I had to work with the HC-12, there's two different Arduino types. One which most of the time just transmits data continuously is a Uno, and it's making use of the Software Serial library:
Both work just fine with a distance of a little more than 600m between them. Both are equipped with a Nagoya Na-771 external antenna. Communication is very smooth.