Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

MODBUS RTU - how connect a meter to rpi 3

szymon077
2019-02-09
2019-02-15
  • szymon077 - 2019-02-09

    Hi,

    I'd like to connect energy meter with modbus rtu protol (3 pins, gnd, rx, tx) to rpi 3. Do I need to use usb to rs485 converter or can I do it by connection directly to gpio pins (gnd, tx, rx)? What is the next step in codesys if I'd like to read registers from my device? The rpi is master then and meter is a slave? Should I prepare (install, upgrade files etc.) rpi for this connection or it is enought to use Codesys? My rpi is connected with Codesys and it works with other in/out pins well. Thank you very much for your answers.

     
  • John Martin

    John Martin - 2019-02-15

    szymon077 hat geschrieben:
    Hi,
    I'd like to connect energy meter with modbus rtu protol (3 pins, gnd, rx, tx) to rpi 3. Do I need to use usb to rs485 converter or can I do it by connection directly to gpio pins (gnd, tx, rx)? What is the next step in codesys if I'd like to read registers from my device? The rpi is master then and meter is a slave? Should I prepare (install, upgrade files etc.) rpi for this connection or it is enought to use Codesys? My rpi is connected with Codesys and it works with other in/out pins well. Thank you very much for your answers.

    Hello,

    In my case, I use a USB-RS485 adapter connect directly to USB raspberry pi.
    It is not necessary to upgrade anything.

    After connect USB adapter, use the command "dmesg" to check the port
    in my case it reports: ttyUSB0

    so you need to add in /etc/CODESYSControl.cfg
    (Attention you need to remove the 0 from USB0)

    [SysCom]
    Linux.Devicefile=/dev/ttyUSB

    And ...... voala !!!!!!!!

    IMG: Bild

     

Log in to post a comment.