Introduction of my first project and question about how to physically connect Modbus RTU devices

Dear openHAB-community,

i am completely new to openHAB and looking forward to work with this versatile platform, btw my name is Sancho and i live in the Netherlands. For a school project and for learning the real basics of openHAB, i want to read the values of a Modbus RTU sensor (temperature and humidity) and maybe later on on log them into a database with a certain frequency. I have a basic background in C/C++ programming but Java,Python etc. or even working with linux systems are completely new to me.

What I did until now:

  1. Installed the lastest version of openHABian on my Pi 3 Model B (1GB RAM/32GB SD)
  2. Established SSH connection via PuTTY and checked for any updates with the configuration tool
  3. Installed the Modbus binding, Visual Studio Code with openHAB extension and i mounted the openHAB-conf folder locally on my system (Windows 10)

My next steps will be to complete the ‘New User tutorial’, read the ‘Configuration guide’ and the documentation of the Modbus binding, but i would like to make sure that i have the appropriate hardware to make this project work.

My equipment:

My intentions was to use the RS-485 to TTL converter and the Pi’s UART (GPIO pins) to establish the physical connection between the sensor and the Pi with openHABian.

Questions:

  1. Is it possible to connect the sensor to the Pi’s GPIO using the RS-485 to TTL converter to establish the connection between ‘real’ Modbus network and the binding? Does it make this make the programming more complex/difficult?

  2. Could i otherwise connect the RS-485 to TTL converter to the USB to TTL converter?

OR

  1. Should i just get myself a RS-485 to USB converter?

I you have any tips/‘must reads’ regarding my little project it would be nice if you could share them with me. Thanks for helping me in advance!

With kind regards,
Sancho

Physically possible of course. So far as openHAB is concerned, you want that to present in Java as a standard system serial port, equivalent to /dev/ttyUSB0 or suchlike.
That’sa bit outside openHAB scope, I would imagine there is some driver/script for the job.

Yep.

They are cheap! but your USB ports might be limited.

EDIT - I’ll throw in another reason for at least having a USB adaptor or two available. Many Modbus devices require configuring - address, serial parameters, etc. It’s not at all easy to do that in openHAB, and not necessary for a one-time job. Easiest to use some Modbus utility on a laptop.

Hey rossko57,

thank you for your answer. I have ordered two USB to RS-485 converters.