PLC IoT based Project using SCADA, ESP8266 Wifi Module & Smart Phone– PLCs were not built with the internet, not to mention the Internet of Things, in mind.
Yet today, the IoT space has matured to the point that it is driving real business value to industrial customers. It goes to follow that people are naturally starting to ask questions about the impact IoT will have on the established field of PLC programming.
There are many options available when it comes to combining PLCs and IoT technologies, all of which share the common goal of successfully merging the hard real-time guarantees and rugged form factor of PLCs with the remote monitoring, alerting, and advanced data analytics of the IoT.
In this project I am not going to talk about the complex things, I will make it very simple. The PLC and IoT based project that you will learn in this tutorial is simply based on the Nodemcu ESP8266 Wifi Module, Fatek PLC 14FBs, Cell phone Application designed in Blynk IoT platform, and a computer SCADA application designed in Project Manager “Winlog”.
In this project, we will not monitor any sensors, but we will control different electrical loads directly from the designed computer application or from the cell phone app. As this project is based on the IoT “Internet of things” based technology so the electrical loads can be controlled from anywhere around the world.
So, basically this is a dual control system, you can control the loads using the computer application or you can you can use your cell phone and control the electrical loads from anywhere around the world, so far, you are connected with the internet.
In my previous tutorial, I have explained in very detail, how to design your own computer scada applilcation, I highly recommend you should read my previous article, as in this tutorial I will not explain the SCADA application designing, but I will only share with the gates addresses, the SCADA application layout, Nodemcu ESP8266 programming, complete circuit diagram, Ladder logic programming, and the Blynk application designing steps.
If incase your are completely new to the PLC programming, then don’t worry, I have so many PLC ladder logic programming tutorials which will help you in learning the basics.
Without any further delay, let’s get started!!!
The components and tools used in this project can be purchase from Amazon, the components purchase links are given below:
*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!
PLC IoT Project Introduction:
Technology is advancing by leaps and bounds in the field of Industrial Automation, Electronics and microcontrollers. Efforts are being laid in integration of different Industrial modules to design such an industrial system which is capable of performing different tasks efficiently and accurately and substitute human beings. The invention of PLC replaced many complicated systems with the simplest, cost effective and efficient systems.
In this project the industrial loads will be controlled through two methods
- Through SCADA using specially designed computer application.
- Through wifi using a specially designed android application in Blynk
Most of the PLC based projects implemented in industries don’t have real time wifi control system or if they have such system then I must be very expensive. Small industries cannot bear such expensive control systems. That’s why in most of the small scale industries these PLC’s are controlled using only switches or SCADA application. With the help of my proposed project any PLC can be controlled from computer software designed in Project Manager or Winlog and can also be controlled through cell phone from anywhere around the world in real time. The control commands can be executed in seconds.
PLC IoT Project Objectives:
The main objective of this project is to fully control the industrial machines/loads by the operators/supervisors at site from the control room giving them the power to control the machines through SCADA application, and also through cell phones from anywhere around the world using just a cell phone application.
PLC IoT project based Load Automation/Management, Block Diagram:
PLC IoT Project Methodology:
Initially the project will be divided in to six main parts
- Wifi control system programming
- Mobile application designing in Blynk
- Hardware Designing ( Electronics modules for interface circuit and PLC)
- Programming (PLC Ladder Logic programming in WinProladder Software)
- PLC Scada application designing
- Assembling the project, testing and commissioning.
PLC IoT based Load Automation Circuit Diagram:
This is the complete circuit diagram of the PLC IoT project based Load Automation/management system. In the circuit diagram only two relays are shown along with the driver circuits consisting of 2n2222 NPN transistors, 10k ohm resistors, and 1n4007 diodes. You can follow these connections, if you want to make your own relay module, or you can purchase a readymade relay module. You will need six relays. These relays will be connected with the Nodemcu ESP8266 Wifi Module pins D0 to D5.
A 24Vdc wire will be connected with the common pin of all the relays and the normally open “NO” pins of the relays will be connected with the Fatek PLC input contacts X0 to X5. So using these relays the PLC inputs in be turned ON or Turned OFF using the Nodemcu ESP8266 Wifi Module.
Another relay module will be connected at the output of the Fatek 14FBs PLC. You can see the inputs X0, X1, …, X7. These are the inputs. These inputs are connected with the relays connected with the Nodemcu module. I have explained everything about the Fatek PLC in my previous tutorial, read that article if you find it hard to understand.
On the left upper side is the 5V regulated power supply based on the LM7805 voltage regulator. J1 is the female power jack and this is where we connect a 12V adaptor. This 12V is used to power up the Relays and is also step down to the 5 volts using the voltage regulator. The 5V regulated voltage is used to power up the Nodemcu module. As you can see a wire from the output of the voltage regulator is connected with the Vin pin of the Nodemcu ESP8266 Module, while the ground of the power supply is connected with the ground of the Nodemcu module. So that’s all about the circuit connections. Now let’s have a look at the Nodemcu ESP8266 Wifi Module programming.
Note: Before you start the programming, first of all, make sure you download all the necessary libraries.
IoT PLC, Nodemcu Programming:
// PLC IoT Project based Load Automation/Management using Nodemcu and SCADA
// controlling loads
#define BLYNK_PRINT Serial
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = "5090557a443e488b85e2887b46997694";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid = "ZONG MBB-E8231-6E63"; //
char pass = "electroniclinic";
// This function sends Arduino's up time every second to Virtual Pin (1).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V1, millis() / 1000);
// Debug console
Blynk.begin(auth, ssid, pass);
timer.run(); // Initiates BlynkTimer
The Nodemcu ESP8266 programming is very easy, still if you find it hard to understand you can read my other articles based on the IoT. Now, let’s make the Blynk Application.
PLC IoT Project, Blynk Application Designing:
We will be using the same pins in the Blynk application, which are defined in the Nodemcu Programming. In the programming I used digital pins D0 to D5. Make sure you have downloaded and installed the Blynk application on your cell phone.
- First of all, open the blynk
- Click on the new project and enter the project name as “PLC control system”. If you want you can select any other name. Later you can also modify the name.
- Click on the choose device and select Nodemcu.
- Make sure the connection type is set to WIFI.
- Finally, click on the create button, an authentication token will be sent on your email id, which later will be used in the Nodemcu programming. As I have already created this application, so the authentication code “5090557a443e488b85e2887b46997694” was already available which I used in the above program.
- Now, click anywhere on the screen and search for the buttons and add 6 buttons, for the demonstration purpose I will add 5 buttons. Re-arrange the buttons by dragging.
- Click on the first button, the Button Settings will be opened, where you can set the name for the button. In the mode select Switch, and select large fonts if desired. On the output click PIN and select D0. That’s it. First button is ready.
- Now you can repeat the same steps for all the remaining buttons, but make sure you use D1 for button2, D2 for button 3, and so on.
You Blynk application should look something like this,
If you have followed everything as per my instructions, at this point you should be able to control the relays. So, before you proceed to the next step, which is Interfacing all the components, I highly recommend first test this circuit.
Simply, upload the program given above into the Nodemcu Module and connect the relay module with Nodemcu. Open the blynk application and click on the Play button. Make sure everything is connected with the Wifi and internet connection is available. You should be able to control all the relays. You will hear a tick sound when a relay is turned ON.
Iot PLC Project Ladder Logic Programming:
You will need to install WinProLadder for the Fatek PLC Ladder Logic Programming. I have already covered the basics e.g. how to use the WinProLadder software and how to write Ladder Logic programs. You can read my previous articles. Following is the Ladder logic Diagram of the PLC IoT project based Load Management/automation system.
Due to program size I am not able to share a complete screenshot. But you can download this Ladder logic Program.
Download Ladder Logic Program:Ladder logic program
A few words about the ladder logic code. As you can see the input X0 to X5 are connected in the OR configuration with the internal coils M0 to M5.
If any of the two switches X0 or M0 is ON the output Y0 will be ON. The internal coils M0 to M1 are controlled through the computer SCADA application, which we will discuss in a minute. X1 is used with M2 and so on.
If you don’t know how to upload a ladder logic program, then you should watch my video tutorials, available on my YouTube Channel “Electronic Clinic”.
So, after uploading the ladder logic programming. The final step is the SCADA application designing.
SCADA Application Designing using Project Manager “WinLog”:
This is the SCADA application I designed for this project. As I said earlier I have already explained in my previous tutorial how to make your own SCADA application. This application is just like my previously designed SCADA application. So I highly recommend read my previous article.
So, that’s all about the PLC IoT project based on the Nodemcu ESP8266 Wifi Module and Fatek. This was a simple technique explaining how to use PLC with IoT. I hope you have learned something new from this article. If you have any questions regarding this project, let me know in a comment.