Hi friends. In this article, 365evn guides you to control PLC S7-1200 on a Mobile/Smartphone using the Android app. The article in the series “Automation Training” on my blog. It is helpful when you need to control or monitor the S7-1200 PLC status on your smartphone.
Control S7-1200 PLC on Mobile – Hardware and Software
In this article, I used the software and hardware below:
- Hardware
- PLC Siemens S7-1200
- Smartphone used Android OS
- Wifi router, power …
- PC/Laptop installed the below software
- Software
- Siemens TIA Portal
- Android Studio
All the above software is used, you can download it free at the end of the article. However, to learn this tutorial of the “Automation Training” series you need some basics about S7-1200 PLC programming (download, upload program…), you can refer to it on my blog: “S7-1200 Getting Started“
The Steps to Control PLC Through Android App
Step 1 – Install The Software
To make the tutorial “Control S7-1200 PLC on Mobile with Android app“, I used two software:
- Step 7 on TIA Portal v18 – S7 1200 PLC programming software
With TIA Portal, you can use another version. I recommend using TIA Portal v15.1 or higher. However, if you do not have a real PLC, you can simulate the PLC and use the software “NetToPLC SIM“.
- Android Studio Electric Eel v2022.1.1 (or higher) – Android app development software
In the video below, I show you how to install Android Studio
If you can not watch the video above, please check another link in my Video Area (V0154) or give feedback to me via WhatsApp, Email, or Message. Thank you!
Step 2 – Connect the devices
To Control S7-1200 PLC on Mobile /Smartphone through Wifi on the Android App, we connect all devices as below
- Firstly, connect the S7-1200 PLC to the Wi-Fi router through the Ethernet cable
- Then, connect the PC/Laptop to the Wi-Fi router by using the cable or Wifi network
- Then, connect the Android Smartphone to the Wi-Fi router network
- Connect the PLC, and Wifi router to the power supply
If you can not watch the video above, please check another link in my Video Area (V0155) or give feedback to me via WhatsApp, Email, or Message. Thank you!
Step 3 – Create a new project on Android Studio
In this step, we create a new project on Android Studio, and with that, we can build a *.apk file. Then, install the file on the mobile and control the PLC S7-1200 on the smartphone through Wifi.
- Open Android Studio -> click “New”
- Select the temp for your device.
- Create a new basic activity with the navigation component: Name; Save location, Language, Minimum SDK…
- Then click “Next” and wait to complete the request action.
- After the process is completed you can click: App -> res -> layout -> Activity_main.xml to start programming your app for Control plc with Android app.
- You can refer to the below video for more detail
If you can not watch the video above, please check another link in my Video Area (V0156) or give feedback to me via WhatsApp, Email, or Message. Thank you!
Step 4 – Device Emulator
In this step, we will create a virtual device (like your mobile) on Android Studio. With that, we can run, and test the app to control S7-1200 PLC on mobile before building the apk file.
Details of this step please watch and follow the video below
If you can not watch the video above, please check another link in my Video Area (V0157) or give feedback to me via WhatsApp, Email, or Message. Thank you!
Step 5 – Add library to Control S7-1200 PLC on Mobile
To connect and control plc s7-1200 through the Android app we used a library “Moka7”, follow the steps to add it to Android Studio
- Download the “Moka7” library at the end of the article and extract it.
- Then, open the previous project (in step 3) and copy the folder to the java folder of the app folder: App -> src -> main -> java.
- Add the library to the project by adding “import Moka7.*;” in the file “MainActivity.java”.
Refer to the below video for more details
If you can not watch the video above, please check another link in my Video Area (V0158) or give feedback to me via WhatsApp, Email, or Message. Thank you!
Step 6 – Programming to Control PLC S7-1200 through Wifi with Android app
In this step, we must program S7-1200 PLC on the TIA Portal and the app on Android Studio.
- Create a new project on the TIA portal, and add some networks to test the control PLC with the Android app through Wifi.
- Then, connect PLC to PC/laptop and download the program to PLC
- Online and check the program
- Then, on Android Studio add some buttons to control S7-1200 plc on mobile.
- Program to connect and control it
- Then, run the app and test on the PC.
- Finally, build the APK file and test the control PLC S7 1200 on mobile.
You can watch and follow the video below to do this step
If you can not watch the video above, please check another link in my Video Area (V0159) or give feedback to me via WhatsApp, Email, or Message. Thank you!
Step 7 – Test Control S7-1200 PLC on a Smartphone with Android app
After we create the APK file in the previous step, copy it to your smartphone, install the file, and run the app to test your application.
If you can not watch the video above, please check another link in my Video Area (V0153) or give feedback to me via WhatsApp, Email, or Message. Thank you!
Some Notes For Control PLC Through Wifi on Android App
- In this tutorial, I guide you through the basic steps to connect and control PLC S7-1200 on a mobile, it is a simple application. You can use the library in this tutorial to develop your app more function.
- You can download all files in this tutorial (with a fee) here (No. 11). Contact me via Email/WhatsApp/Chat for more information.
- With this app, we can control S7-1200 plc on mobile with a local Wifi network (PLC and the mobile must connect to the same network.
- I upgraded the app to a new version – Control PLC on mobile with Android App from anywhere with internet. For details on this version please refer to my course: Link
Software Download
- TIA Portal V15.1 to V19 Download
- Android Studio Software – Iguana v2023.2.1 Download (File password: 365evn)
- Android Studio Software – Home page
- Moka7 Library Download
– 365evn Automation Training –
If you find this content valuable, please rate it (click the button above), share it with your friends or invite me for a coffee by clicking the button below.