2
\$\begingroup\$

I have created an hydroponic system using modbus to communicate between a RaspberryPI server and plug&play arduino sensors. It works but as soon as I plug a sensor on the bus (physically), all the other plugged sensors are timed out for a couple of seconds.

The sensors are connected on the same PSU as the RaspberryPI.

I tried to power a sensor with another power supply (USB of my desktop computer) and everything works well. Other sensors are not timed out.

I tried to see what happens with an oscilloscope (on modbus lines A & B) but I can't interpret the result and I don't know how I could make them work on the main power supply. My electronics skills are very limited.

Here are pictures of the recorded data:

Schema Sensor powered by the same power supply as the server: Not working properly Sensor powered by USB cable from my computer: Working properly

Thanks for your time !!

\$\endgroup\$
5
  • \$\begingroup\$ nice, you improved the question. It will be picked up in no time here, this community is very active. I wonder where is the need to physically bring sensors online to the bus like that, it's something I don't think I've ever seen. It would help to know what are the sensors and what kind of power supply the have. It looks like you have a nasty transient. Many more questions come to mind: are the RS485 ports electrically isolated everywhere (do they share GND with their respective power supplies)? How long is the bus? Are you terminating it with resistors? \$\endgroup\$
    – Marcos G.
    Commented Dec 4, 2019 at 19:45
  • \$\begingroup\$ What about the power of the PSU? Is it enough for all sensors? Is it a switched power supply? What baud rate are you using? Is there any bias resistors (from the positive on the PSU and GND to the A and B bus lines) on the bus?, do the sensors have a microcontroller in them? If so, is it possible that the transient on the power supply is causing them to reboot? More questions than answers, sorry! \$\endgroup\$
    – Marcos G.
    Commented Dec 4, 2019 at 19:48
  • \$\begingroup\$ Woh. Lot of questions ! I plug or unplug the sensors physically because I wanna get a plug&play system like USB. This part works. I made the sensors with Arduino Pro Mini and a c25b modules for the communication. They are all done the same way. A sensor can measure the temperature or the light for example. As you can see on the wiring diagram, all sensors share the same PSU. The ports are not isolated because they are all connected together. The bus is very short (30cm) but each sensor have a 1 meter long cable. I've not terminated the bus with resistors. \$\endgroup\$ Commented Dec 4, 2019 at 20:20
  • \$\begingroup\$ The PSU is a 12V to 5V converter (3A / 15W). fr.aliexpress.com/item/4000074761446.html I think it's largely enough for a RaspberryPI and a few Arduino boards. The baudrate I use is 57600. There are no bias resistors on the bus. You could be right about the reboot of the sensors. I've not checked if other sensors reboot when I plug another sensor. I'll check that \$\endgroup\$ Commented Dec 4, 2019 at 20:21
  • \$\begingroup\$ I just checked if the other sensors reboot. They don't. \$\endgroup\$ Commented Dec 4, 2019 at 20:34

1 Answer 1

2
\$\begingroup\$

Based on your question and comments this is what I think is happening:

The RS485 transceiver you are using needs two (or at least one) control pins (DE or drive enable, which switches on the RS485 side when it is brought high and ~RE or not read enable which makes the chip accept messages from the bus when it's low).

Those two pins are likely connected directly to digital output pins on your Arduino microcontroller. That is fine as long as the micro is operating normally but during the boot up sequence some pins have different functions or are floating (not high nor low). That is probably making the DE signal on the transceiver go up for the whole boot up time (1-3 seconds) preventing all other devices on the bus to access it (a two-wire RS485 bus is half duplex so there is only one device driving the bus at all times).

To fix your issue you might want to add pull down resistors (probably 3.3 or 4.7 k Ohm) to the DE line. If that is not successful you might want to read the particulars of the behavior of the pins you are using at boot up.

If you are wondering why the same thing is not happening when you use a different power supply, the answer is right there on your scope captures: it is actually happening but to a lower extent, low enough not to interfere with the bus.

\$\endgroup\$
2
  • \$\begingroup\$ I didn't expect to get such a relevant answer! I really appreciate it ! The module has build-in 10k Ohm pull-up resistors on pins DE and RE. I tied both pins together and I control the module with only 1 MCU pin. I tried first with a 4.7k Ohm pull-down resistor but it was not enough. So I tried with a 3k Ohm resistor and now everything is working perfectly. You rock Marco !! Thank you so much !!!! Just a last question: Doesn't that pose a problem if there are two 10kOhm pull-up and one 3kOhm pull-down on the same line. It seems unusual \$\endgroup\$ Commented Dec 5, 2019 at 16:30
  • \$\begingroup\$ You are welcome. Resistances in parallel are no problem at all, they just combine to give a lower value of 10k*3k/(10k+3k) or approx. 2.3 k. You can make sure this value is not too low by checking the maximum current the pin is able to draw on the datasheet. Then you can compare it with Vhigh/2.3k. For 3.3V that is 1.4 mA. I guess for most ICs you should be OK but you can check against the datasheet to be sure \$\endgroup\$
    – Marcos G.
    Commented Dec 5, 2019 at 18:06

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.