I'm searching a modbus library

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
P@T
Posts: 33
Joined: Tue Nov 06, 2018 2:37 pm

I'm searching a modbus library

Post by P@T » Thu May 09, 2019 7:53 am

Hi all,

I work in the electronics industry. For me it lacks a great standard to introduce micropython into this field: modbus
It would be very easy to integrate a new Modbus slave on an existing network. (modbus master is rarely a small microcontroller)

Thanks,

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: I'm searching a modbus library

Post by pythoncoder » Thu May 09, 2019 4:39 pm

This is something of a FAQ and there is evident interest in a library. As far as I can see the Pyboard could support Modbus but nobody has written a library. It needs someone with access to a Modbus master to roll up their sleeves and get coding.
Peter Hinch
Index to my micropython libraries.

rpr
Posts: 99
Joined: Sat Oct 27, 2018 5:17 pm

Re: I'm searching a modbus library

Post by rpr » Fri May 10, 2019 12:37 am

I just want to clarify what you are asking:

You want to setup a Pyboard as a modbus slave on an existing TCP network so that it can be controlled by a master device on same network. I presume you want to be able to use the digital inputs/outputs as well as analog in/out.

In the past I have used standard linux computers (acting as master) with modbustcp (python) to control modbus devices such as Advantech ADAM modules. I think I have recently seen some code which allows a Raspberry PI to act as a Modbus slave. Maybe such a code can be adapted for your use.

P@T
Posts: 33
Joined: Tue Nov 06, 2018 2:37 pm

Re: I'm searching a modbus library

Post by P@T » Fri May 10, 2019 7:37 am

rpr wrote:You want to setup a Pyboard as a modbus slave on an existing TCP network so that it can be controlled by a master device on same network. I presume you want to be able to use the digital inputs/outputs as well as analog in/out.
Exactly, in RTU mode
rpr wrote:In the past I have used standard linux computers (acting as master) with modbustcp (python) to control modbus devices such as Advantech ADAM modules. I think I have recently seen some code which allows a Raspberry PI to act as a Modbus slave. Maybe such a code can be adapted for your use.
Yes ;)

I have already programmed modbus servers to control the slave (with minimalmodbus) but never in slave mode (I haven't found library).
Today I will be able to decode all the frames and then send the answers in the right format and with the CRC (manualy) but a library help me a lot :oops:

thanks,

rpr
Posts: 99
Joined: Sat Oct 27, 2018 5:17 pm

Re: I'm searching a modbus library

Post by rpr » Fri May 10, 2019 10:17 am

P@T wrote:
Fri May 10, 2019 7:37 am

Yes ;)

I have already programmed modbus servers to control the slave (with minimalmodbus) but never in slave mode (I haven't found library).
Today I will be able to decode all the frames and then send the answers in the right format and with the CRC (manualy) but a library help me a lot :oops:

thanks,
That is fantastic. I'd be interested in seeing the resulting code. If possible, may I ask what is the application that you are developing? Thanks.

JumpZero
Posts: 54
Joined: Mon Oct 30, 2017 5:54 am
Location: Arcachon - France

Re: I'm searching a modbus library

Post by JumpZero » Fri May 10, 2019 4:09 pm

Hi!
Not sure if this help but a few years ago I used pymodbus on Raspberry pi it was not very difficult and worked well, it's Python not microPython but may help
Also there is this micropython-modbus for ESP32 (never tested) https://github.com/techbase123/micropython-modbus

P@T
Posts: 33
Joined: Tue Nov 06, 2018 2:37 pm

Re: I'm searching a modbus library

Post by P@T » Fri May 10, 2019 7:50 pm

rpr wrote:That is fantastic. I'd be interested in seeing the resulting code. If possible, may I ask what is the application that you are developing? Thanks.
:?: I have already programmed modbus servers to control the slave (with minimalmodbus) on a PC with python not micropython and with VB6 without library
Sorry, i have not clarify

Post Reply