IRIV PiControl - Reading from 3 in 1 moist Sensor

IRIV PiControl - Reading from 3 in 1 moist Sensor

By the end of this guide you will be able to get readings from 3 in 1 moist Sensor  on IRIV .

 

Hardware

 

 

Connection Diagram

 

Note: Please remember to handle all connections with care and double-check connections for accuracy.

Note : the DC voltage used is 24V.

 

 

 Programming with Node-RED

 

From the pllater manager install the node-red-contrin-modbus package.

 

 

Inser an inject node from the coomon platter.

 

 

Double click on the inject node and set an interval for every one second.

 

 

Insert a modbus getter node (delay node is optional) .

 

 

Set the modbus getteras following: Name = "sensor" ( optional), Unit-id = 1 (default), FC = FC 3: Read Holding Register, Address = 6, and Quantity = 3 and create a new server.

This tutorial will help you to chabge the address.

More to know:

In this step we are asking the getter node to read 3 register starting from regestier 6 (Address), the readings will be stored in a list of length 3 (Quantity).

Temperature value is in regestier 6 and it is indexed in the list as item 0.

Humidity value is in regestier 7 and it is indexed in the list as item 1.

Conductivity value is in regestier 8 and it is indexed in the list as item 2.

 

 

Set the server as following: Type = Serial, Serial port = /dev/ttyACM0, Serial type = RTU and Baud rate = 9600.

Note: in case you get no respone try changing the baud rate to 4800.

 

 

Insert three functions from the platter and name them Temeperature , Humidity and Conductivity.

 

 

Set the code of the Temperature  function as follows:

 

 

Set the code of the Humidity  function as follows:

 

 

Set the code of the Conductivity function as follows:

 

 

Insert a debug function for each function and make the connections.

Now you will be able to see the readings in the debug section in the right side bar.