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.