Real time electrical consumption monitoring with m-duino

July 15, 2019 by
Real time electrical consumption monitoring with m-duino
Joan F. Aubets - Industrial Shields

In this project, we will show you how to read electrical consumption using Modbus communication. Modbus is an industry standard communications protocol for electronic devices.
Hardware I: Equipment to be used

The electrical consumption monitoring system consists of:
  • An M-Duino PLC: This controller is the heart of the system. It controls the display, generates interrupts, and controls the communication.

  • A Panel PC: Used to read on the status of a counter and display the graph of monthly consumption over the Panel Pc. – Switch will work as the interface between slaves and Master in our control network. 

  • A Power Meter with Modbus TCP/IP communication capabilities (as TCP is Transmission Control Protocol and IP is Internet Protocol.)

  • Wires and some programming experience J.

Hardware II:  Communication The nice feature of the Panel PC we used is that it has many interfaces such as Ethernet, USB  and I²C as well. We´ve expressly chosen Ethernet because our PLC  and our I2C panel have this Ethernet connectivity. See the following picture to understand it:

Software and code Arduino sketch essentially uses the Modbus TCP library for Arduino  (see the Arduino installer tutorial here). Some important things to take care of when we use this library:

  1. Insert the modbus_update function in the loop, because. takes care of the received modbus commands and will modify the registers accordingly in case of writing or reading requests.

  2. Declare an integer array (named holdingRegs) that stores the modbus registers.

  3. We recommend to review modbus tcp basics at

After that, just start sending values to the panel PC through USB  I2C communication.

You can find the code to be uploaded to the PLC here: 2014111_arduino_code

You need to download  libraries:

And what about the software to install in our Panel PC to start visualizing graphs? In this case, we recommend using Tesla Scada, which is able to work on Android systems. The panel pc will start receiving data and print out data in graphs!

Key Benefits

The main benefits of the purposed solution are:

  • Time Saving: Forget to go to view and write values in notebooks, your control system will do this job for you.

  • Real time measurement: The system provides reliable data quickly.

  • Digital data analysis: If you can measure it, you can improve it!

​Search in our Blog

Real time electrical consumption monitoring with m-duino
Joan F. Aubets - Industrial Shields July 15, 2019
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC comparison >>>