I recently tried to add some more sensors to my home system. They are basically copies of sensors that I already had in place. The firmware is from your Home automation course using MQTT/Node Red. The earlier sensors are working fine. However, I am trying to use some esp8266-01 devices that I purchased back in Feb 2020. They finish upoading correctly but when I try to use them the blue led flashes continually at about a 1 htz rate and never stops. I am afraid to try to upload to any of the working devices for fear of causing them problems. I have enclosed a screenshot of the settings and the code is located here https://pastebin.com/r1HPrdef and the screenshot is here. https://imgur.com/c8YPPRu The devices are from MakerFocus shown here. https://imgur.com/g626ElP
I am also concerned about the fact that since I have been away from the arduino for several months due to illness that I may have updated some libraries or boards that I should not have. These boards all fail in units that are currently fully functional with the original esp8266-01 in them. The esp8266 devices currently working were purchased a year ago.
I have run out of ideas and hope that you might shed some light on the issue.
Thank you
KentM
Hi.
Can you erase the ESP8266 flash and then, try to re-upload the code and see if that solves the problem?
You can read this discussion for instructions on how to erase flash:
https://rntlab.com/question/how-perform-reset-factory-esp32/
Then, tell me how it went.
Regards,
Sara
Sara, I tried erasing the flash as described several different ways but to no avail.
This issue with my ESP8266 motion sensors will not go away no matter what I have tried. The facts are this. I have three ESP8266-01 devices that work in the same motion unit that were built back at the first of this year. Within the last month I set out to build some more and loaded what I thought was the same code that I used earlier in the year. I am loading the code on a breadboard and then putting them into the working sensor. For some reason these units immediately start to oscillate at about a ten hertz rate. The blue LED shows this rate. I have tried this with five new ESP devices and they all do the same thing. Keep in mind that at any time I can reinstall any of the three previously mentioned units and they still work fine. For this reason I am hesitant to try and change the code in these three units.
My next effort was to rebuild the sensor on a breadboard and start over. The sensor is the mini-sized PIR unit or an RCWL radar sensor. The devices work interchangeably. These units all work on the breadboard as well. For all these tests I am using the same power supply. The only difference in any of the codes are the device names that refer to different Sonoff basic switches that being activated by these sensors. The names occur four times in each sketch as “client.publish” statements to send to NodeRed.
My next effort has been to reconstruct the code from scratch as I did before. The source of this code was from the “Multi Sensor Project” from one of your tutorials. I actually did a cut and paste on the code for that project using just the motion sensor and providing my own names and credentials. I also designed and built a board just for this sensor project. They worked great. But this problem has nothing to do with the boards or breadboard. The problem with the code that has me puzzled the most is the fact that is compiles and uploads every time with no errors. I am currently running the latest version of the IDE, the Boards Manager and the libraries required as far as I can tell. I actually tried to revert back several versions of the ESP8266 library but nothing made any difference.
I would greatly appreciate someone looking over this code and see what I have overlooked.
Hello, I wish I could tell you that I have the answer but that is not the case. I have added two files, one being the error that I captured from the SerMON and the other is the exact code that I created from the NodeRed Multisensor project. I am hoping you can see some error that I am missing. Again this code compiles and uploads to both an esp8266-01 and a wemos D1 mini. But both seem to go into oscillation. The error code from the serMon just repeats over and over until I stop it.
KentM https://pastebin.com/YfUCBiqQ
https://pastebin.com/JsbdnpuL
Hi Kent.
Replace line 130 with the following:
ICACHE_RAM_ATTR void detectsMovement() {
This declares the callback function in RAM. The callback functions for the interrupts need to be declared in RAM. Where did you copy this code from? I thought we had updated the code to fix this issue. I’m sorry about that.
Can you tell me if this solved the problem?
Regards,
Sara
Sara , thanks for the prompt reply. Before I do anything however, I would like to verify which line 130 you are referring to. Are to referring to the code that I sent to you in my preceding post? The original code that I got that from came from the code in the tutorial called “NodeRED multisensor Shield” that I downloaded yesterday. I think it makes more sense to put in my line 130.
should look like this:
// Checks if motion was detected and the sensors are armed. Then, starts a timer.
ICACHE_RAM_ATTR void detectsMovement() {
Serial.println(“MOTION DETECTED!”);
client.publish(“esp8266/motion”, “MOTION DETECTED!”);
previousTime = millis();
startTimer = true;
}
Regards
Kent
Sara, I couldn’t bear waiting for your reply so I tried the fix as shown in my previous post.
IT WORKS!!!!!!! I am back to building motion sensors again. I am still baffled as to why the ones that I built at the end of the prior year worked and are still working. I can only assume that a change in a library or board file must have created the issue. But at this point all I can do is extend my gratitude to you for helping solving this problem.
With my best regards
Kent
Hi Kent.
I’m sorry for taking so long to answer your simple question. I’m glad it is working now.
When we built that tutorial, we didn’t need to declare the callback function in RAM. I suppose it was done automatically in an older version of the ESP8266 firmware?? I don’t know.
When we detected that something was wrong, we fixed the codes that use interrupts in the ESP8266 course and other projects in our website. However, we may have missed some of the projects and that was one of them.
We’ll fix that code right now.
As everything is working fine now, I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara