• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Serial2 communication with load cells

Q&A Forum › Category: ESP32 › Serial2 communication with load cells
0 Vote Up Vote Down
Paul French asked 3 years ago

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.  

5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
Paul French answered 3 years ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

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

0 Vote Up Vote Down
Paul French answered 3 years ago

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?

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
Yes, it can be. But, without further information, it is very difficult to know what might be causing the issue.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.