1
\$\begingroup\$

I'm thinkering with a RS-485 connection (modbus) to read out my electrical power meter.

The setup is as follows:

ESP32 --> MAX3485 --> RS-485 to USB

when the ESP32 is powered via USB, on the same computer as the USB host is connected, I can see communication in both ways: The computer can read what the ESP is sending and vice versa.

When I power the ESP32 via mains power (converted to 3.3V offcourse), the computer can still see what the ESP32 is sending but when I return something, the ESP doesn't read anything.

Both ends are terminated with a 120Ohm resistor. Ground connected (I have a 100Ohm resistor in series) or not makes no difference.

I guess it has something to do with common ground but don't know how to solve...

Works: ESP32, powered through USB port from computer enter image description here

A, B and GND connected to a generic RS-485 to USB dongle to the same PC.

Doesn't work: Same ESP, now powered via a Hi-Link mains to 5V converter (0.6A), same schematic. A, B and GND connected to a generic RS-485 to USB dongle. Mind that data sent from the ESP is still received, but the ESP itself doesn't receive anything.

\$\endgroup\$
  • 1
    \$\begingroup\$ There are a few details missing here. Do you have a schematic of how the 485-bus is connected. What is your mains power supply? \$\endgroup\$ – sstobbe Oct 20 '18 at 20:03
  • \$\begingroup\$ Updated with a bit more info. I also removed the 10k pullup but it doesn't change much. \$\endgroup\$ – BMelis Oct 20 '18 at 20:21
  • \$\begingroup\$ Is the TxEnable line low when you want to receive? You need a high (3.3V) for transmitting and low (0V) for receiving on that line. Maybe add a pulldown to gnd on that line (ex 10k)... You do need the 10k pullup on the Rx pin, I think that is normally open collector. \$\endgroup\$ – Big6 Oct 20 '18 at 20:58
  • \$\begingroup\$ I'm confused about what you've done with your RS485 GND. in your question you write "Ground connected", but in your diagram you have "open (not connected)". Which is it, and what is your intent with the 100R resistor? \$\endgroup\$ – brhans Oct 20 '18 at 21:16
  • \$\begingroup\$ But how come it does work when the esp32 is powered through an USB port from my laptop? RST line is properly switched. \$\endgroup\$ – BMelis Oct 20 '18 at 21:18
0
\$\begingroup\$

I used the circuit from RS485 (MAX489) Biasing and it all works now. Communication with my modbus power meter works flawlessly. Basically, I added a 470Ohm pullup on A and a 470Ohm pulldown on B.

I reminded I bought the max3485 long ago on a big Chinese online shop. So my so called max3485 may not be a real max3485.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.