Ultrasonic level indicator and energy monitoring via Modbus using ARMtronix wifi RS485 to IIOT(IA010)

In this blog we would like to show you Energy Monitoring using RS485 WC4400 energy meter and fetching the readings from the Ultrasonic Level Indicator simultaneously using the ARMtronix device(IA010-RS485 to IIOT Board). In this setup we are reading WC4400 and sensor measurement values using ESP32 via RS485 and publishing measurement data via mqtt.

Block Diagram:

Components Required:

  • WC4400 energy meter.
  • UL R760 Ultrasonic Level Indicator.
  • ARMtronix IA010 (RS485 to IIOT).
  • 230V AC to 24V DC SMPS.

Loading firmware on ESP32:

We have to install the following libraries in Arduino IDE.

  • pubSubClient
  • ArduinoJson
  • Esp32 Arduino Core

So to upload the code on Esp32 of IA010 you need to have programmer cable (FTDI cable) and Arduino IDE installed and make sure that the programmer cable connected properly on header J15 as shown in the below fig.

Once you are done with adding all the libraries and code is compiled, you can upload the code by selecting following upload settings and proper port.

i.e..Board: NodeMCU-32S

Upload speed:115200

Connection:

Make the connection as per the wiring diagram shown below.

Ultrasonic Level Indicator:

Connect the Ultrasonic Level Indicator to the setup as show in the above figure. It has inbuilt current sensor, so that we can also get the current readings from it. Here in this setup make the settings in the ultrasonic level indicator as follows.

  • RS485 Baud Rate: 9600.
  • Slave address: 1.
  • Parity: No parity.

WC4400 Energy Meter:

Connect the WC4400 Energy Meter to the ARMtronix device IA010(RS485 to IIOT) as shown in the above figure. Here energy meter is used to get the measurement values like frequency, total current, Watts per hour received, total voltage etc….Make sure that the parameter settings are done as follows according to our code.

  • RS485 Baud Rate: 9600.
  • Slave address: 2.
  • Parity: No parity.

Application diagram:

Our proposed system will expected to be same as shown in the above diagram. The applications of the system as follows.

The system contains the Ultrasonic level indicator placed at the top of the water tank, which is used to know about the water level in the tank. From the ultrasonic level indicator we get the water level readings, by those readings one should able to predict that how much water is there in the tank. i.e. if the readings are almost matching the height of the tank, it means that the tank is empty and we can turn on the pump to fill the tank. If the readings are equal to zero, then the tank is full. And ultrasonic level indicator has in-built temperature sensor form that we can also read the temperature of the water inside the tank.

The system also has the energy meter, which gives the energy measurement values i.e voltage, current, frequency, power factor and so on. From the energy meter readings we came to know that how much voltage, current consuming the load (water pump). and whether the pump is turned on or off (state of the pump). If the readings as crossing the limiting values then there might be any misbehaviour in the system or pump, so before the any incident may occur, we can take suitable precautionary actions.

Configuration of ESP32:

Once you are done with the proper connection, turn on the main supply and connect the IA010 board to router using lan cable. When the IA010 is turned on for the first time you have to configure it using IP address which you assigned in the code. In our case the IP is 192.168.1.99

Enter the IP address 192.168.1.99 in your browser, a webpage will be loaded as shown below.

Once the webpage is opened you have to just fill the mqtt broker, mqtt username(if exist), mqtt username (if exist), mqtt password(if exist), publish topic, subscribe topic, device name and click on submit.

MQTT topics example:

If the device MQTT publish topic is “/MI/002” and Subscribe topic is “/MO/002”. Then you can subscribe to the topic to get the values as shown below.

The following are the messeges, you need to send to the topic to get the Energy meter values.

  • “Watts_Total” for total power in watts.
  • “Watts_R_phase” for R-phase power in watts.
  • “Watts_Y_phase” for Y-phase power in watts.
  • “Watts_B_phase” for B-phase power in watts.
  • “PF_Ave” for Average power factor.
  • “PF_R_phase” for R-phase power factor.
  • “PF_Y_phase” for Y-phase power factor.
  • “PF_B_phase” for B-phase power factor.
  • “VA_Total” for total voltage.
  • “VA_R_phase” for R-phase voltage.
  • “VA_Y_phase” for Y-phase voltage.
  • “VA_B_phase” for B-phase voltage.
  • “Current_Total” for total current.
  • “Current_R_phase” for R-phase current.
  • “Current_Y_phase” for Y-phase current.
  • “Current_B_phase” for B-phase current.
  • “Freq” for Frequency.
  • “Wh_Received” for energy in Wh.

If you want the Ultrasonic Level Indicator values ,then you need to send the following messages to the Connect the WC4400 Energy Meter to the Armtronix device IA010(RS485 to IIOT) as shown in the above figure. Here energy meter is used to get the measurement values like frequency, total current, Watts per hour received, total voltage etc….Make sure that the parameter settings are done as follows according to our code.mqtt topic.

  • “Water_Level” or “Distance” for distance in meter.
  • “Temperature” for temperature value in degree Celsius.

All the setup is done ,Now if you send these messages to the topic, you will get the values in the subscriber terminal as shown below.

Here in this figure, we are publishing the messeges through pub topic(left terminal) and we are getting the respective values in the subscriber window(right terminal). For example, from terminal window if we send publish command i.e. “mosquitto_pub -h 192.168.1.33 -m Freq -t /MO/002” we will get the frequency value in the subscriber window i.e. “mosquitto_sub -h 192.168.1.33 -t /MI/#”.

Leave a Reply