ESP8266 reading espsoftwareserial data from RS232 Scale

Hi Everyone, Thanks in Advance

I've got a floor scale that has an RS232 output.

When I connect with a terminal program and a USB to RS232 adapter, I can see the output from the scale on my laptop in the format xxx LB

I'd like to use an ESP8266 to read that data and save the numerical value to a variable.

However, to start, I would just like to echo that data received from the software serial ports to the serial monitor of the IDE

I have a MAX232 module that is connected to the rs232 output of the scale, with TX on the Scale connected to the RX pin of the MAX232, the ESP8266 is connected to the TTL side of the MAX232.

#include <SoftwareSerial.h>

String TagData;

SoftwareSerial scaleSerial(D2, D3); // RX, TX

void setup() 
{
  Serial.begin(19200);
  scaleSerial.begin(9600);
  Serial.println("Ready...");
}

void loop() 
{            
      while(scaleSerial.available() > 0) 
      {
          byte incomingData = scaleSerial.read();
          TagData = TagData + String(incomingData);
      }
      Serial.println(TagData);
      TagData="";
}

All I see in the serial monitor is 255 repeated over and over again despite the scale being at zero.

Has anyone accomplished something similar that they could offer some guidance here?

Why not serial.print() your original incomingData and see what value it actually is?
Paul

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.