impExplorer™ Developer Kit + Rs485 modbus



I’ve been reviewing and I see that the ModbusSerialMaster.device.lib.nut: 2.0.0 libraries are designed for the impAccelerator ™ Fieldbus Gateway (imp005) which uses hardware.uart2 for communication. where the C7 & B18 pin are for Tx & Rx. and the L pin for nRE

I am trying to develop this communication but with an impExplorer ™ Developer Kit (imp001) + TTL / Rs485 module. in this imp001 the Tx & Rx are in other pins so I have doubts about how to configure them (hardware.uart2) to use the library.

I’m using this test code to try to read a modbus slave with the imp explorer kit

#require "CRC16.class.nut: 1.0.0"
#require "ModbusRTU.device.lib.nut: 1.0.1"
#require "ModbusMaster.device.lib.nut: 1.0.1"
#require "ModbusSerialMaster.device.lib.nut: 2.0.0"

local params = {"baudRate": 19200, "dataBits": 8, "parity": PARITY_NONE, "stopBits": 2, "timeout": 5, "debug": true};

modbus <- ModbusSerialMaster (hardware.uart2, hardware.pin5, params);

// Read from multiple registers (0x01, MODBUSRTU_TARGET_TYPE.INPUT_REGISTER, 0x0000, 2, function (error, results) {
  if (error) {
    server.error (error);
  } else {
    foreach (key, value in results) {
      server.log (key + ":" + value);
} .bindenv (this));


Hi again, so there are two problems here, first one is why hardware.uart2 does not give you error, as imp001 does not have uart2 (then you might confuse with uart2 on imp005 you have used before). Then second one is need correct wiring for the available uart you can use from imp Explorer kit. I suggest to use uart57:

#require "CRC16.class.nut:1.0.0"
#require "ModbusRTU.device.lib.nut:1.0.1"
#require "ModbusMaster.device.lib.nut:1.0.1"
#require "ModbusSerialMaster.device.lib.nut:2.0.0"

local params = {"baudRate" : 19200, "dataBits" : 8, "parity" : PARITY_NONE, "stopBits": 2, "timeout": 10, "debug" : true };
modbus <- ModbusSerialMaster(hardware.uart57, hardware.pin2, params);, MODBUSRTU_TARGET_TYPE.INPUT_REGISTER, 0x0000 , 10, function(error, results) {
  if (error) {
  } else {
    foreach(key, value in results) {
      server.log(key + " : " + value);


The only problem with this is that the explorer kit, with its limited I/O, doesn’t have a single UART available on external pins.

The two uncommitted pins (on the grove analog/digital headers) are pin2 and pin5; pin7 is an input to the RGB LED. This is still usable, but the LED may go crazy :slight_smile:

You really need to pick this off before it gets to the 5v buffer though (U6). Getting at it on the SD socekt pins may be the easiest option… or just use an April breakout board where all pins are available.


Hello, I finally got to communicate the April Dev + imp001 + external RS485 transceiver as a ModbusSerialMaster.

I have used an modbus industrial radio with I / O as a slave, getting read and write records, without any problem.

If the slave goes off and the imp device continues on, it sends me the log “Error 80” of timeout. After a lapse of time, when the slave is switched on, the correct reading of modbus registers continues in the log.


if the imp device shuts down, and the slave continues to turn on, after a lapse of time, when the imp device is turned on it connects and only gets “Error 80”

I need to reset the slave so I can have readings again.

I have modified the timeout in the parameters of the code but without success.
some idea or suggest?


As this requires the slave to be reset, I would suspect that during the imp power cycle, maybe there’s a bus condition which is upsetting the slave.

This would be easy to spot with a scope or logic analyzer - do you have anything like that?

Aside from that, one suggestion would be to ensure that the TX enable pin (pin2 in this case) has a pull up/down to hold it in the inactive state when the imp is in reset.


I do not have equipment for signal analysis, I’ll test with a pullup resistor