2

I have a modbus slave device and a rs485 to usb converter. I used the converter and successfully read data from the slave device with my laptop but when I try to use it with the Raspberry Pi I am unable to do so. I am using ssh and vnc to remote control the Pi. Do I need some special configuration for reading serial data from Pi? The converter is identified as '/dev/ttyUSB0'.

  • Which library you're using ? If it's libmodbus, you can use modbus_debug(ctx,true); to see debug messages to narrow down your issue. – dhruvvyas90 Dec 27 '15 at 17:18
  • Welcome to the Raspberry Pi community on Stack Exchange. Can you tell us (by editing your Question) something more about the RS485{Wikipedia link} converter you are using - the fact that it works with a (Windows ?) PC suggests that the two hardware peripherals are compatible but what about the RPi<==USB==>RS485-converter bit. From my (limited) understanding of RS485 it only specifies signal levels and physical connections but not what the signals mean - so I think you need a software library for the Pi to talk to the Modbus device. – SlySven Dec 27 '15 at 21:15
  • Created modbus tag as there are other questions that involve it, such as pymodbus-rtu-rs-485-communication - it does seem to be popular for single-RPi (master) to multiple Arduino (slaves), and the pymodbus and minimalmodbus libraries seem to be of possible use here. – SlySven Dec 27 '15 at 21:25
  • Hello everyone. When I first started working on Pi, I used nugets' 'nmodbus' library (on mono develop). I always kept receiving a transport exception. After this I tried using the pymodbus library which returns 'transaction : none'. I haven't yet tried libmodbus. The coding is pretty straight forward that's why I thought if I need to configure my Pi's serial port or anything. – Shounak Katyayan Dec 28 '15 at 17:39
  • Also! I found this blog where the converter looks like the same one that I have... – Shounak Katyayan Dec 28 '15 at 17:46
  • I have a similar project, i want to read data from multiple slaves which are daisy chained and read the data through pi as master and am using a usb to serial converter(Prolific). Can you share the code to read data on pi 2? – pritiaec10 Nov 16 '16 at 08:41
  • Could you please give more details on the USB modbus adapter you had success with. I’m currently struggling to get my pi to work with such adapter s. Also what software have you used and did you have to change any settings on the ports? – Fed Dec 16 '20 at 12:42

1 Answers1

1

Okay so turns out that the adapter "QinHeng Electronics HL-340 usb-serial" that I bought works well on windows but does not work with Linux. I bought a new adapter with an original FTDI chip and all the codes worked fine.