Browsed by
Tag: ethernet

Real time electrical consumption monitoring with M-Duino

Real time electrical consumption monitoring with M-Duino

In this Project, we will show you how to read electrical consumption using Modbus communication. Modbus is an industry standard communications protocol for electronic device 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: Switch will work as the interface between slaves and Master in our control network.


  • A Power Meter witch 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 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 connecitivity. See the following picture to understand it: sch2   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 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 to use Tesla Scada, wich 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 Opiron 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: System provides reliable data quickly.
  • Digital data analysis: If you can measure it, you can improve it!
Contact us!
Do you have a process to be automated? Contact Opiron to implement the entire solution and Industrialshields to buy the proper hardware.
How to Modbus-Ethernet

How to Modbus-Ethernet

  • Modbus is a Serial communications protocol and it is used for communicating with several industrial devices. It may run over RS485, Ethernet, or whatever hardware interface.
  • If we have an ethernet connection between a lot of devices, we can use this hardware connection (eth), and over it, we can use our own protocol (custom protocol,…), or for instance, Modbus protocol. The way is the same as using RS485, but hardware connections will become much easier, the speed will be higher, and the possible frame errors will be controlled by TCP/IP layers.
  • So, if you know Modbus, you have an easier way to implement it!.
Ethernet Arduino PLC. How to connect M-duino PLC to Ethernet

Ethernet Arduino PLC. How to connect M-duino PLC to Ethernet

M-duino PLC is using an ENC28J60 chip in order to connect to Ethernet. You can choose two libraries in order to connect all M-duino family products

  1. UIPEthernet: you can find in Gitub. It uses the same functions as the Official Arduino Ethernet Shield.
  2. EtherCard: You can find this documentation and libraries in the Jeelabs website. You need to import all libraries:
 Sketch / Import Library / Add Library.

And then restart Arduino IDE. It’s important to take into account:

static byte mymac[] = {0xFF,...,0xFF}; // Valor de la MAC del ethernet.

if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)
    Serial.println("Failed to access Ethernet controller");