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'.

7
  • 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. 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. Dec 28 '15 at 17:39
  • Also! I found this blog where the converter looks like the same one that I have... Dec 28 '15 at 17:46
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.

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