Oil contamination sensor

Hello friends,

I would like to develop a project with electricimp modules and read some particulate contamination sensor in hydraulic oil according to ISO contamination standards.

Someone is familiar with this type of sensors and cleanliness Codes?
and know that it would be better, if read through 4-20 mA , modbus rs-485 or analog signals in the imp.

Thank you!

Got a datasheet for one of these sensors?

Hello Hugo,
I do not have a sensor in specific I am looking to integrate OEM equipment, but in recent research, I have determined that the best option is through modbus rtu.

for this the impAccelerator ™ Fieldbus Gateway would be perfect, but the cost of using one in each machine is not competitive against existing equipment.

Ideally, I would have an impExplorer ™ Developer Kit + Modbus rtu at a lower cost

The fieldbus gateway accelerator is not intended to be an end product; it is just for PoC use. It has way, way too much stuff in there for most applications (PoE etc), but it’s a useful tool.

The designs are open source, so it’s easy for customers to cut out parts they don’t need and make something optimized.

Note also that RTU is multidrop so you would generally have one gateway for multiple RTU sensors, but that may require more wiring (no idea how far apart these machines are).

If you want something cheaper, you can use an imp devboard and an external RS485 transceiver, eg https://www.amazon.com/Conversion-Arduino-Overvoltage-protectionWith-indicator/dp/B078N1HTM5/

Connect DE and RE together and connect these to a “transmit enable” pin on the imp (pick one and tell the modbus library about it), then RO (receive out) connects to an imp UART RX pin and DI (data in) connects to an imp UART TX pin.

Thanks Hugo! I :raised_hands: have precisely one of those
I will test with the external module rs-485 :electric_plug:

I’m not an expert in PCB manufacturing to take a prototype to the final product.
Who could guide to know about this process and costs?

If you want to go with the 4-20ma method, there are 2 types sold here:
https://www.mikroe.com/4-20ma-r-click

You can hook to your 4-20ma loop and the imp can read it (SPI).

The t-click is a way to transmit 4-20ma (if you need to do that sometime).

Whether you use digital rs485 or analog 4-20ma depends on your accuracy required. Resolution will be different for different methods. Also, what existing transmitter you already use. Retransmitting a PV out of the analog output of your transmitter may “skew” the accuracy. A PV of 123.56, might end-up with an error of +/- .5

I like 4-20ma because the wire runs can be really long without losses. It’s simple too. You might already have the 4-20ma loop going to a PLC. You can tap into that loop anywhere and use the imp to monitor or log it.

A lot of new transmitters are now HART communications broadcast over the 4-20ma loop. Not sure about HART to SPI/I2C modules, but the imp can read SPI/I2C pretty slick.

Thanks mlseim , I find it very interesting to use 4-20 mA for future projects,
I will try to get a module for tests.

for this current project, I am trying to make a rs485master with the imp, to read and write the HR of a modbus slave sensor of oil quality.,
This sensor will deliver in registers numbers that are cleaning codes according to an ISO classification table. in this way, the accuracy depends on the brand of the sensor.

today I tested according to what Hugo told me, but without success. only error 80 time out…

tomorrow I’ll keep trying.

Thank you!

#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": 3, "debug" : true };
modbus <- ModbusSerialMaster(hardware.uart2, hardware.pin5,params);

// write values into 3 holding registers starting at address 9
modbus.write(0x01, MODBUSRTU_TARGET_TYPE.HOLDING_REGISTER, 9, 3, [188, 80, 18], function(error, res) {
    if (error) {
        server.error(error);
    } else {
        // read values from 3 holding registers starting at address 9
        modbus.read(DEVICE_ADDRESS, MODBUSRTU_TARGET_TYPE.HOLDING_REGISTER, 9, 3, function(error, res) {
            if (error) {
                server.error(error);
            } else {
                // 188
                server.log(res[0]);
                // 80
                server.log(res[1]);
                // 18
                server.log(res[2]);
            }
        });
    }
});

ps some pics…

I have recently need to use UART on imp Explorer Kit, and this combination would work:

local receiver = hardware.uart12;
local transmitter = hardware.uart57;
receiver.configure(19200, 8, PARITY_NONE, 1, NO_CTSRTS+NO_TX, readback);
transmitter.configure(19200, 8, PARITY_NONE, 1, NO_CTSRTS+NO_RX);

But on this case of ModbusSerialMaster library, looks like need to modify the constructor to take two UARTs, one for TX one for RX. May be better to get imp004-breakout for example?

Hi Akmandala,
i think in this case the ModbusSerialMaster are ready to make the constructor,

a few months ago, I made a project using an impAccelerator ™ Fieldbus Gateway, and it works perfectly, the equipment was installed and working in the factory many hours away from my location. the libraries are great, but since the gateway is more expensive for this new application, I want to reduce the cost with a prot explorer + rs485 ttl prototype.

some body can test this code, and verify the same error.

[Device]	ERROR: 80

#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.uart2, hardware.pin5,params);


modbus.read(0x01, MODBUSRTU_TARGET_TYPE.INPUT_REGISTER, 0x0000 , 10, function(error, results) {
  if (error) {
    server.error(error);
  } else {
    foreach(key, value in results) {
      server.log(key + " : " + value);
    }
  }
}.bindenv(this));

You are right, it does not throw error specifying hardware.uart2 on imp001, considering it was on pinmux: https://developer.electricimp.com/hardware/imp/imp001pinmux

Well the other option is to use hardware.uart57 and a bit of soldering needed to bring the pin7 out as RXD, and use pin2 for TX_EN. As long as pin1 kept low, you won’t see LED blinking.