Skip to content

An open source code Ladder Editor written in Java that generates code for IoT devices.

License

Notifications You must be signed in to change notification settings

K0rkunc/iot-ladder-editor

 
 

Repository files navigation

IoT Ladder Editor

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.

How to execute

  1. Install Java 8 (JRE) from Oracle if doesn't already installed
  2. 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
  3. Download the latest executable Jar file (here) and double click to execute it.

How to execute from source code

  1. Install Java 8 (JDK) from Oracle
  2. Download the Eclipse IDE, unzip and execute it
  3. Import the project on Eclipse IDE, read the README_importing_into_eclipse.md to do this
  4. On the project, click with the right mouse click and select Run As>Java Application

How to use the software

To understand about the Ladder Language read README_ladder_language.md.

  1. Use drag and drop to place instructions on the Rung and associate input/output variables to instructions
  2. Go to Project>Build to generate the output code
  3. The output file plc.ino will be created in the folder "current folder"/out/plc
  4. Double click to open Arduino IDE
  5. Put the ESP32 board in programming mode
  6. Click on Update icon on the Arduino IDE to load the program on the ESP32 board
  7. After success, reset the ESP32 board to run the program

Click on picture below to see the demo video:

Test Circuit

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".

Connecting to the MQTT broker

Before building, go to Project>Properties
Set the Wi-fi connection and on the tab MQTT set your Broker connection.

Sending messages to device

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

Sending messages from device

Set the topic to publish on the tab MQTT/Topic.
On the tab MQTT/Telemetry set the period and variables to send.

About

An open source code Ladder Editor written in Java that generates code for IoT devices.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%