Hi,
I am currently working thru the XXXX with an Adafruit ESP32 Huzzah Feather. When I am using the code on page 150 it works as expected.
However, it looks like that I am constantly restarting. Looking at the serial monitor, the following repeats in a fast pace:
abort() was called at PC 0x4013c83b on core 1
Backtrace: 0x4008362d:0x3ffcafa0............
Connected to MQTT.
Session present: 0
Subscribing at QoS 2, packetId: 1
Publishing at QoS 0
Publishing at QoS 1, packetId: 3
Publishing at QoS 2, packetId: 4
Subscribe acknowledged.
packetId: 1
qos: 2
Any idea what can cause this? If I am running the pubSubClient version (old book) it seems not to do it.
Juergen
Hi.
What is the eBook and project that you’re following?
What sensor are you using? Are you connecting that sensor to which pin?
Regards,
Sara
Hi Sara,
sorry – I got distracted last night. I wanted to give the info in my original email. I am working out of the “Smart Home, Raspberry PI, ESP32,…INFLUX, MQTT” course. Which I really like.
The specific code is the one on page 150, publish/subscribe on page 150 (for ESP32). It compiles and uploads perfect. However, I did had some issues with AsyncMQTT and AsyncTCP libraries prior to getting the code working.
I am currently wondering, maybe I need to cleanup the Adruino IDE environment. But I am not sure how I could do this. Any advice how I can do so? I think a clean environment might be a good idea.
The only modification I made to the code I downloaded is inside the “onMqttMessage” function. I changed to my pin (23) on the Adafruit Huzzah Feather (see below).
// Turn the LED on or off accordingly to the message content
if(strcmp(topic, “led”) == 0)
{
if(receivedMessage == “true”)
{
// digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(RELAY_PIN, HIGH);
}
if (receivedMessage == “false”)
{
// digitalWrite(LED_BUILTIN, LOW);
digitalWrite(RELAY_PIN, LOW);
}
The program actually works. So the relay actually switches on/off (using NodeRed). It is just that the serial monitor is really freaking out.
I will do some more testing tonight.
Juergen
Hi
Do you know the pinout of your board? Have you checked that GPIO23 is not a “special” pin with critical functions?
To clean up those libraries you need to find your Arduino IDE libraries folder. Then, you just need to remove the folders related to those libraries.
What issues did you have when installing the libraries?
Regards,
Sara
Hi Sara,
I did some further testing.
First, I cleaned up my environment. The issue I had previous was that I tried to install the AsyncMQTT and AsynTCP using the Arduino library manager – which apparently is not working. Reason I am on a Mac and I had to figure out how downloaded Zip files are not automatically unzipped. Which I managed.
I changed to several different Pins on the ESP32 – no change.
Finally I looked at the code. The program runs stable – so not rebooting – if I am commenting out the following line in the loop function.
uint16_t packetIdPub1 = mqttClient.publish(“counter”, 1, true, String(random(0,20)).c_str());
If the line is not commented out the program starts and it runs several cycles until it stops:
packetId: 292
Publish acknowledged.
packetId: 293
abort() was called at PC 0x4013c6bf on core 1
Not sure where to take it from here. It might be a memory overflow. Any suggestions?
Regards,
Juergen
One more observation. I just tried the ESP8266 version on an Adafruit Huzzah ESP8266.
So far it runs fine. However, compared to the ESP32 version it runs really slow. After a few minutes I am at published packedID 40. While at it just takes maybe two seconds for the ESP32 to reach roughly packetId 300 and to fail.
Confused I am 🙂
Juergen
Well, the ESP8286 version on the Adafruit Huzzah ESP8266 just stops after some time. See below. I do found another ESP32 – not from Adafruit and will test with this one later on today.
Publishing on topic counter at QoS 1, packetId: 117Publish acknowledged.
packetId: 117
Publishing on topic counter at QoS 1, packetId: 118Publish acknowledged.
packetId: 118
Publishing on topic counter at QoS 1, packetId: 119Publish acknowledged.
packetId: 119
Hi Sara,
interesting results I got.
First I tried from AZ-Delivery an ESP32-WROOM-32. Same result as with the Adafruit ESP32.
Then I tried the rather new Arduino Nano ESP32. And the behavior is almost similar like the one on the ESP8266. Only that it unsuccessfully tries to connect to MQTT (see below).
Publish acknowledged.
packetId: 843
Publish acknowledged.
packetId: 844
Disconnected from MQTT.
Connecting to MQTT…
Disconnected from MQTT.
Connecting to MQTT...
Apparently I have the capability to debug directly with Arduino Nano ESP32. I will try to dig into this.
However, I do have a considerable set of Adafruit ESP32 which I am using for Halloween automation/party. I think I need to go back to the PubSubClient version of your earlier book. This approach was running fine.
I am open for any ideas.
Kind regards,
Juergen
Hi.
I’m not sure of the reason of the issue.
Are you using our original codes, or have you reduced the delay time between each send?
Regards,
Sara
Hi Sara,
i am using the original code. One change which I think should not have any impact. I am using Mosquito with out authentication. So I commented out the the two define statements as well as the mqttClient.setCredentials(BROKER_USER, BROKER_PASS) statement.
I left everything else the same, the interval is still 10000. I didn’t touch the wifi and mqtt reconnect timer lines at all. I do played with different OUTPUT Pins. But I am back to the original code here as well.
I am currently trying to get the debugging working for the Arduino NANO ESP32. As soon I have figured it out I will try to dig deeper into the issue.
For now I will continue with the pubSubClient version to get my stuff ready. But will also look into this issue at the same time since I really like to figure out why I get this wired behavior.
Juergen
Ok.
Thank you. Let me know if you figure out what’s causing the issue.
Regards,
Sara
Sara,
How critical is the version of ESP32 Core installed in Arduino IDE 2.x?
William
Hi William,
not sure where you up to. I checked my environment and I think ESP32 core is installed.
The path I wanted to try using the Arduino Nano ESP32 debugging is a dead-end for now. Arduino advertised the debugging as a feature but is is not there yet. Really a very big disappointment.
I am now trying to get the ESP32-Wroom to work with the Atmet-IEC. Not very successful yet….. Any guidance would be helpful.
Juergen
Hi Juergen,
One of my projects; I needed to install an earlier ESP32 Core in Board Manager. Might be something to try…
Have you tried a different USB Port on your computer?
William
Sometimes, earlier versions of the core have issues or incompatibilities with libraries.
So, sometimes downgrading the core version fixes some of the issues.
Regards,
Sara
ok,
I spend sometime yesterday to get a Windows 11 PC configured and setup. Same behavior like on my Mac. So I guess I can rule out the USB Port. Tried different ports on the Mac and Windows as well.
On the topic of ESP32 Core. I have Arduino ESP 32 Boards Version 2.0.11 (latest version) installed on the MAC. On my Windows PC none yet. I could try version 2.0.10. Not sure what to do?
Maybe I should actually take an earlier version of the esp32 by Espresso. Current version on both machines is 2.0.11.
Any suggestions?
Regards,
Juergen
Hi Sara,
I need to apologize. Stupid me.
It was all my mistake. I said earlier I didn’t change anything major in the code. Well, not exactly…. long story for unknown reason I set a closing bracket in the loop statement at the wrong place. So the interval was not calculated correctly and off it went.
I am so emphasized about that. Sorry for keeping you on this topic. The program just runs fine.
Juergen