esp32 with (USB to TTL) problem reading Serial

Hello community, happy new year!!

About 127 days ago I started a topic similar, but I changed devices and upgrade components, now I have an esp32 trying to communicate with a Torrey Weight Scale, via USB. The data sheet of the scale indicates that if you send an ascii "P" (80), you will get back the weight reading. I have connected the esp32 trough a USB to TTL with CH340G chip, and even directly to the scale (3.3V).

the thing is that I'm not able to read the device. this is what I have:

#define RXD2 16
#define TXD2 17

void setup() {
  Serial.begin(115200);

  // initial bit + 8 bit + no parity + 1 stop bit; 9600 br according to scale manual (Torrey LEQ)
  Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);  
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);     // Turn the led off
  delay(1000);
}

void loop() {
  while (!Serial2.available()) {
    Serial2.write(80);                      // If Serial2 is not available, send 'P' in ascii
    digitalWrite(LED_BUILTIN, LOW);         // Turn off the led
  }
  while (Serial2.available()) {
    delay(15);                              // Wait for it to bytes to come in
    Serial.println(char(Serial2.read()));   // Print each character
    digitalWrite(LED_BUILTIN, HIGH);        // Turn LED on (means we received signal)
  }
  Serial.println("");
  delay (1000);
}

I get the LED on for quite a while, and it turns off and rapidly goes on again, I can asume it is getting data, but it can't read that well. I already tried:

  • Scale is working fine (Tried with program from manufacturer)
  • I have 3 other esp32 boards
  • Change the TX and RX pins back and forth in any permutation I could think
  • Remove GND and plug it again (get weird results)
  • Tried even to read bit by bit and arrange into bytes and try to figure out the ASCII character, no success.
  • Tried logic shift with 2k (TX and RX) and 1k (RX to GND and TX to GND) resistors

so, back to basics, I think have the right connections:


(esp32) TX to RXD (USB to TTL)
(esp32) RX to TXD (USB to TTL)
(esp32) GND to GND (USB to TTL)

on (USB to TTL) shorted 3V3 to VCC with yellow jumper


USB to TTL - on the USB terminal side soldered dupont cables (as a provisional solution)
(USB to TTL) TX to DM (Scale)
(USB to TTL) RX to DP (Scale)
(USB to TTL) GND to GND (Scale)

I really cant think of anything else, I have other USB to TTL modules, a MAX232, and even tried the esp32 directly to the scale.

I appreciate your orientation towards a solution, how fool I was thinking it was only:

 Serial2.write("P");

and

Serial.print(Seria2.read());

I currently can send a P trough USB cable, via Serial Port Utility, and it gives me the right data. So the scale and the cable is working, and somehow, this utility can send and receive the data correctly.

cheers!!!

Do make sure your USB adapter has power available. That may help wonders.

You're breaking the scale. The D+ and D- are USB signal wires, not to be connected to some serial TX RX signals. If the DM and DP markings are correct, you need a USB HOST IC to connect to it. Buy a USB cable with wire leads or maybe an adapter like this and wire your scale to it and connect to a PC.

If you've never seen the readout on a PC first, you should really see it to make sure it works.

The way your last photo looks, you soldered the DM and DP to a USB-TTL adapter. That won't work. The adapter already has a USB IC on board. Did you disable or remove it?

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