0

I monitor 10 Modbus devices with a Raspberry Pi 3B. Each modbus device sits about 20-30cm from the Pi and sends signal to the Pi through a Modbus RS485 to USB converter, which is shown here: https://www.amazon.co.uk/gp/product/B08CRL6KHV

The Pi, through a cron job that runs every minute, sends the collected data to my server with an API call with the Python requests library operating through an Ethernet cable.

The above system is implemented with Pymodbus, and works flawlessly...for about 4-5 days. Then I notice that a test ping to my server (which runs on a cron to test the internet connection separately) happens, but that the subsequent readings which I expect to see after the test do not happen. Some minutes later the test pings also stop. Strangely, every now and again I will sometimes see an intermittent test ping from the Pi.

I tried a dirty fix of this problem which involved:

  1. Forcing a restart of the Pi with a cron job every 6 hours and
  2. Using an internal watchdog to restart in the event of memory running low

After the above measures the Pi would still freeze every 4-5 days.

The Pi is unfortunately on-site at the moment hundreds of km from me so I cannot check the log files (though I hope to get them soon).

Reading about similar spontaneous stoppages of Pi sensor systems elsewhere, I have seen the following possibilities surrounding failure:

  1. Voltage issues with the Pi (in my case the supply is a stable 5.1V and 2.5A)
  2. Poor wiring with the Modbus devices. I am not using the double-wound wiring (recommended to reduce electrical interference) but I presume this doesn't matter because the devices are only 20-30 cm from the Pi. When I used this same wiring setup on my desk it appeared to work perfectly.
  3. The FTDI chip in the Modbus-RS485 USB converter could (according to some people) be prone to spontaneously causing locks in the USB port. Some posts suggest using a more sophisticated RS485 converter, like this one: https://thepihut.com/products/rs422-rs485-serial-hat

Has anyone out there experienced spontaneous stoppages with their Pi Modbus devices? If you have, how did you fix them? And do you have an informed opinion on whether the FTDI chip in the RS485 converter could be a factor?

Many thanks in advance!

2 Answers 2

2

Try setting force_turbo=1 in config.txt. This will disable dynamic frequency scaling of the CPU. I have had four devices (all my three Zero W devices and one Raspi 4) which used to freeze, the Zeros when the Pi Cam was connected (and used to create timelapses), then they froze randomly after a couple of hours or after a couple of days and the Raspi 4 under some other conditions (a constant but low workload), also randomly after a couple of hours/days. Temperature was monitored and the power supply was not an issue.

I have a feeling that dynamic frequency scaling is somehow broken and in certain edge cases it will cause the device to freeze.

Only force_turbo=1 without any overclocking and overvolting (none of which I had to do) will not void the warranty.

See https://www.raspberrypi.org/forums/viewtopic.php?t=212777#p1674366

0

I found the answer. The problem was that the power source was low, and low voltage caused automatic throttling of my key processes without, I might add, reporting on it anywhere. So, for anyone experiencing seemingly random drops in your Pi functionality, make sure that you are not experiencing brown-outs on your electrical supply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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