ESP Easy is a firmware designed to create devices easily with ESP modules. Here we’ll use a Wemos D1 Mini with a 230V relay shield.
This is is a short demonstration of a co-simulation between Siemens PLCSIM Advanced and C#.
The goal is simple : have the ability to conditionally change inputs.
We’ll do a proof of concept with a small exemple for a safety relay monitored by a feedback.
2 Simulator configuration
First let’s start an instance with the following parameters :
Once started, it should be like that :
3 PLC Programming
3.1 Hardware configuration
Let’s do a simple configuration as follow :
Network configuration :
– PLC_1 : 192.168.1.1/24
– IO device_1 : 192.168.1.2/24Note : On the simulator, we have different IP addresses for all the network interfaces : Ethernet adapter, PLCSIM virtual ethernet adapter, PLC and I/Os !
With the following I/Os :
Note that you’ll need to activate this option in the project settings :
Our program will be very simple !
OB1 will toggle a bit every second :
And FB1 will do a safety check between the relay output and the input feedback :
3.3 Compiling and loading
You should be able to compile and load :
As soon as you’ll run the program, you should have an error on the feedback monitoring :
5 C# Co-simulation
To solve this issue, we’ll running co-simulation with C#. The script will check the output value (%Q9.0) and set the feedback (%I0.0) accordingly.
We’ll be using sharpdevelop as IDE.
5.1 Import DLL
Importing the DLL is easy :
Then we write a short program :
* Created by SharpDevelop.
public static void Main(string args)
//Use it for local instance
//IInstance myInstance = SimulationRuntimeManager.CreateInterface("Golf8");
//Use it for remote instance
IRemoteRuntimeManager myRemoteInstance = SimulationRuntimeManager.RemoteConnect("192.168.1.101:50000");
IInstance myInstance = myRemoteInstance.CreateInterface("1515F");
//Update tag list from API
//Start a thread to synchronize feedbacks inputs
Thread tFeedbacks = new Thread(()=>synchroFeedbacks(myInstance));
//Allow the user to quit simulation
Console.WriteLine("Press any key to quit . . . ");
static void synchroFeedbacks(IInstance myInstance)
//Keep %I and %Q opposite
And run it :
Once acknowledged, we should not have any issue.
Using the trace tool, we can confirm that it’s running perfectly fine, updating the input in around 100ms.
RFLink is a great, flexible and opensource RF gateway for 433Mhz devices. I use it with Domoticz. Every few months, a new firmware is released and they add a lot of new devices. This post describe how to update an RFLink gateway in a Linux environment.
Continue reading Update RFLink gateway on Linux (Ubuntu)
I used to use a Raspberry Pi as a data logger for many sensors, here is how I create a nice front-end for data visualization.
– Store data : SQLite
– Serve content : Python with Flask
– Plot data : Hightcharts / Highstock
In this example, we’ll use a Raspberry Pi and a DHT22 temperature and humidity sensor to print values on a web interface.
Continue reading Web interface for Raspberry’s sensors (GPIO)
Led brightness regulation using PWM based on a light sensor and a proportional–integral–derivative controller implemented on a Arduino UNO.
Continue reading PID regulation – Led brightness regulation with Arduino
The goal is to prototype a temperature and humidity sensor that will be able to send data through Wi-Fi using the open-source platform ThingSpeak.
1. New visual studio project
This post is following the one on Siemens PLC simulation with PlcSim.
We need a running program on PlcSim. PlcSim has to use the PLCSIM(TCP/IP) interface and has to be listening on the same IP as the computer.
Your PLC side is ready !
SIMATIC S7-PLCSIM allows you to simulate a controller for functional testing on the programming device/PC.
2.1 New project
As a first step, we start SIMATIC Manager and create a new project.
Continue reading Siemens PLC simulation – Step7 / PlcSim