I have an ESP32 system publishing via Http to MySql and web as per your tutorial. Mostly everything works fine including a variety of sensor data. The Serial2 port is connected with a converter MAX232 to a DGT industrial load cell which returns it’s standard weight message on receiving a Read instruction from the ESP. The code runs a Finite State Machine which monitors the various states of a process. The ESP publishes every 15 minutes or on each change of system state.
However, after about 30 to 40 minutes the data from the Load cells degrades such that it becomes unintelligible, with missing and spurious characters which my code cannot parse. I have checked and rewired and fitted RF chokes and ferrite beads. I have upgraded the PSU to an industrial version as I had suspected noise from the home charger PSU. The Serial2 is configured at 9600 baud rate. 8None1
I have read that wifi can affect both Serial1 and Serial2 on the ESP32. Has anyone experienced issues with serial communications and what have you done to fix it? Any ideas why the data reads fine for a while before degrading? Am I right in assuming it has to be a hardware issue, or could my code be at fault.
Hi Paul.
That’s a weird issue.
I think that if it was a problem related to a conflict between wi-fi and serial, you wouldn’t get the first readings right.
So, it seems a hardware issue, but I’m not sure.
Have you tried resetting your ESP after the first readings? To check if it gets correct readings after reset? If that’s the case, it can be a problem related to the code.
Regards,
Sara
Hi Sara,
I implemented a millis() timer to send the READ command to the load cell every 5 seconds and that seems to have cleared up the issue. Now I am receiving correct data without errors. I don’t quite understand why this works, but it’s good enough for me!
Many thanks
Paul
Hi.
I’m glad it is working 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
It transpires that the sensor load cell readings work for about 30 hours and then they appear as Zeros. Could this be a buffer issue? Do I need to initialise Serial2 with some buffer setting?