This project is a open source code Ladder Editor that generates code for IoT devices. Through the MQTT protocol it is possible to interact with the program variables. The current version generates Arduino code (.ino) for ESP32.
It's a desktop Java application developed with Eclipse IDE + WindowBuilder plug-in.
- Install Java 8 (JRE) from Oracle if doesn't already installed
- To compile the generated code and load it on ESP32 board install the Arduino IDE and setup it, read README_arduino_ide_setup.md to do this
- Download the latest executable Jar file (here) and double click to execute it.
- Install Java 8 (JDK) from Oracle
- Download the Eclipse IDE, unzip and execute it
- Import the project on Eclipse IDE, read the README_importing_into_eclipse.md to do this
- On the project, click with the right mouse click and select Run As>Java Application
To understand about the Ladder Language read README_ladder_language.md.
- Use drag and drop to place instructions on the Rung and associate input/output variables to instructions
- Go to Project>Build to generate the output code
- The output file plc.ino will be created in the folder "current folder"/out/plc
- Double click to open Arduino IDE
- Put the ESP32 board in programming mode
- Click on Update icon on the Arduino IDE to load the program on the ESP32 board
- After success, reset the ESP32 board to run the program
Click on picture below to see the demo video:
The table below shows recommended/equivalent Ladder Instruction for the input/output schematic.
Input (pull-down resistor) |
Input (pull-up resistor) |
Output (active high) |
Output (active low) |
|
---|---|---|---|---|
Schematic | ||||
Ladder Instruction |
You can change the pin mapping on the Project>Properties, on the tab "Pin Mapping".
Before building, go to Project>Properties
Set the Wi-fi connection and on the tab MQTT set your Broker connection.
Only Integer and Floating program variable can be modified by MQTT messages.
Set the topic to subscribe on the tab MQTT/Topic.
Example of message: sending value 1 to variable MI01:
{
"MI01": 1
}
... associate the Integer variable to instruction
Set the topic to publish on the tab MQTT/Topic.
On the tab MQTT/Telemetry set the period and variables to send.