Home

Awesome

Exo Sense Py Modbus

Modbus RTU Slave and Modbus TCP Server app for Exo Sense Py, configurable via FTP or Web server.

Installation

Just copy all the files in this repo into the Pycom's flash memory.

User guide

Power on Exo Sense Py, the internal LED light will turn on as fixed red. Wait for the LED to turn blue or green.

If green, the module is already configured and ready to process Modbus requests. On the first Modbus request received the LED will go off.

If blue, the module is not configured and is set to access point mode. After some time (see below) the access point will be automatically disabled.

Configuration

All configuration parameters are in the config.py file.

To access this file on the module, enable access point mode and join its WiFi network. Depending on the configuration, a Web server and/or an FTP server will be enabled. Using any Web browser or FTP client application, connect to 192.168.4.1 using the credentials specified in the configuration.

Refer to config.py for the default WiFi, Web and FTP credentials.

Download the configuration file, edit it and re-upload it. If using the Web interface, after the upload, Exo will automatically restart using the new configuration, otherwise, on the next power-on, it will start with the new configuration.

Configure it to work as Modbus RTU slave or Modbus TCP server, by setting MB_RTU_ADDRESS or MB_TCP_IP to a valid value. If both are set, the TCP configuration will be ignored. If neither are, it will boot as not configured and enable the access point at power-on.

When configured as Modbus TCP server, the configuration Web interface and/or FTP server will be available at the configured IP address. If Exo cannot connect to the specified WiFi, after the time specified by the AP_ON_TIMEOUT_SEC configuration parameter, it will go into access point mode.

When configured as RTU slave, to re-enable access point mode, write register 5 via Modbus (see below), or power on the module and wait without making any Modbus requests for the time specified by the AP_ON_TIMEOUT_SEC parameter.

The above access point mode auto-enable routine can be disabled by setting AP_ON_TIMEOUT_SEC to 0.

The access point is automatically disabled after the time specified by AP_ON_TIME_SEC.

LED status table

LED statusDescription
RedStarting up
GreenReady and waiting for first Modbus request
Off or Blue blinkRunning (HEARTBEAT_LED config option)
BlueAccess point on
YellowEnabling access point
Purple blinkConnecting to WiFi (TCP mode)
Red blinkNot configured and AP timeout expired, reboot to re-enable access point

Modbus registers

Refer to the following table for the list of available registers and corresponding supported Modbus functions.

For the "Functions" column:
1 = Read coils
2 = Read discrete inputs
3 = Read holding registers
4 = Read input registers
5 = Write single coil
6 = Write single register
15 = Write multiple coils
16 = Write multiple registers

AddressR/WFunctionsSize (bits)Data typeUnitDescription
5W51--Write ON (0xFF00) to enable access point mode (RTU only)
101R21--Digital input DI1
102R21--Digital input DI2
201R/W1,51--Digital output DO1
211W616unsigned shortmsDO1 pulse
301R416signed short°C/10Temperature
302R416unsigned shortRelative humidity
303R416unsigned shorthPa/10Atmospheric pressure
304R416unsigned shortKΩAir resistance (quality indication)
305R416unsigned shortlx/10Light intensity
306R416unsigned short-Noise intensity
307R416unsigned short-Peak programme meter simulation on noise value
308R416unsigned short-IAQ index (see below)
309R416signed short-IAQ trend: a positive value represents an IAQ improvement, a negative value an IAQ worsening, a value of zero represents a stable IAQ
401W616unsigned shortmsBuzzer beep

IAQ index

IAQ (Indoor Air Quality) index description:

IAQ indexAir Quality
0-50Good
51-100Average
101-150Little bad
151-200Bad
201-300Worse
301-500Very bad