Modbus library

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
MauroDiam
Posts: 7
Joined: Thu Jul 23, 2020 1:38 pm

Modbus library

Post by MauroDiam » Thu Jul 23, 2020 2:24 pm

Hello people, I'm starting an IoT project and I've decided to use the NodeMCU board. The project consists of remote monitoring of electrical grids, so then it is composed of a module which takes a lot of data from a power grid analyzer and then sends that to a remote server through the internet. I decided to use NodeMCU because it has already implemented a WiFi interface and it's very cheap. However, I have realized I'm going to have problems with the communication with the power grid analyzer because that one has an RS485 interface and implements the Modbus protocol. There is no problem with the RS485 interface because I'm going to use an adaptor to UART, but I wasn't been able to find a Modbus library for MicroPython. I have just found these options:

https://pypi.org/project/uModbus/ (Intended for CPython not MicroPython)
https://github.com/techbase123/micropython-modbus (Intended justo for ESP32)
https://github.com/riptideio/pymodbus (I'm not sure if it's compatible with MicroPython and NodeMCU)

Do you know some Modbus library I can use? Or is it possible to adapt one of the mentioned library to MicroPython? :ugeek:

eiRee9e
Posts: 1
Joined: Sun Aug 09, 2020 8:31 pm

Re: Modbus library

Post by eiRee9e » Sun Aug 09, 2020 9:05 pm

I have searched all over for such a library but it's not implemented yet.
I'm assuming you need to read data from the nodemcu device running micropython.
At the present there is only modbus libraries which will make the micropython device act as a master but not as a slave, this is one of your links to ESP32.
Master = will read a modbus slave/server device on the network
Slave = will be read by a master device on the network
So exactly the same functions to work as TCP and RTU slave will be required, the link below is for a master device only.
https://github.com/techbase123/micropython-modbus
I'd like to help with this library to be implemented and by no means I'm a programmer by I can modify software and tinker with it.
Also this library would make MicroPython's entry into industrial automation communicating via modbus which is used everywhere since it is a robust and reliable means of communication.

DivePeak
Posts: 1
Joined: Thu Aug 26, 2021 4:04 am

Re: Modbus library

Post by DivePeak » Thu Aug 26, 2021 4:11 am

Hi, I'm looking for the same. Wanting to use RP2040 to get data from a solar inverter that has a RS485 port. Happy to help out if there is a project in progress. I have some Python experience, but almost zero MicroPython. Wrote C++ many years ago if there is something that can be ported from that. I will take a look at the CPython link.

Post Reply