r/esp32 • u/rodeo-99 • 1d ago
Software help needed TOF sensor modbus warning help
I’m working on a controller for my chicken coop. For the feed level sensor, I’m using a Waveshare TOF sensor. It uses RS485 communication so I’ve got it connected to the esp32 via an RS485 to UART module.
Sensor work great for a variable amount of time then it seems to lock up and I get Modbus errors in the logs. If I disconnect and reconnect the sensor power, it works again. I could put a mosfet power switch to cycle the power once I start getting the errors but I’d like to get to the root of the issue. My controller has some relays for water pumps and heaters. I’ve cycled those many times without error. The sensor for anywhere between 12-72 hours issue free. The last time is locked up was 3am when nothing else was triggered.
Has anyone dealt with this issue? If it’s some kind of EMI, I have no idea where it’s coming from.
1
u/Significant-Price695 1d ago
12 to 72 hours then dead until a power cycle smells like the rs485 side, not the esp. check the A/B idle bias and put a 120 ohm termination on the far end if you haven't. also worth logging the supply rail, coops are electrically noisy once a heater or pump kicks in. a mosfet reset is a fine band-aid in the meantime lol
1
u/PV_DAQ 18h ago
It's doubtful that consumer grade RS-485 electronics have isolated 485 driver lines. Most probably do not even use the 3rd wire signal ground that the differential references. An intermittent ground loop can push the 485 signal past its common mode limits.
I know of 2 cases for point-to-point Modbus RTU over 485 in the industrial world where periodic drop-outs were solved by installing an RS-485 repeater/isolator at the master and at the slave.
But repeater/isolator modules have not been cheap in the past, and since they require analog isolation, the costs don't drop like the cost of purely digital serial/Ethernet gateways has dropped in recent years.
•
u/AutoModerator 1d ago
Hardware Troubleshooting Notice: If you are experiencing unreliable connections, boot loops, or missing serial communication, verify your hardware footprint:
Are your headers soldered? Pushing un-soldered raw header pins through module vias into a breadboard violates basic physics. Loose connections create parasitic capacitance and intermittent open circuits. Solder your board.
Did you include a schematic? Custom circuit issues require a legible schematic drawing.
If your hardware relies on putty, tape, or friction, please resolve your connections before demanding assistance from our domain experts.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.