Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By thiagoralves
#50779 Hi guys,

I've been working with the ESP8266 for a while. Its for sure the best IoT platform, and a big part of it is this community. I'm also the creator of the OpenPLC project, the only fully open-source Programmable Logic Controller in the world. For those that don't know what a PLC is, basically it is a "robust microcontroller" that can be programmed in a standardized graphical language.

So, taking out the "robust" part (just because robust here means it can handle high voltages without burning), the ESP8266 would be an awesome PLC . For this reason I decided to port the OpenPLC to run on the ESP8266, and for me the result is absolutely fantastic!

I have a website where I host my project (http://www.openplcproject.com), but I haven't uploaded any information about the ESP8266 yet because I would like to do some testing before. I tested the code on my NodeMCU board and it runs smoothly! However, since there are so many ESP boards around, I would love to see other people testing it as well and reporting here the results.

To install the OpenPLC in your ESP8266 you will need to have the Arduino IDE configured to upload code to it (I believe most of you have already done that). Then, just follow these steps:

1) Downlaod OpenPLC to your host machine (Windows, Linux or RaspberryPi) by following the instructions on the getting started page (http://www.openplcproject.com/#!getting-started/dfjzr) At the end of the build process, choose the ESP8266 driver.

2) Download the firmware that is attached on this post to your ESP8266 board using the Arduino IDE.

3) Before uploading the firmware to the ESP8266 board, modify it according to your WiFi Network. The information you need to update is on the first lines of the code. Just change the name of your network, your password and the OpenPLC Server IP:
Code: Select all/*********ESP8266 CONFIGURATION*********/
#define WIFI_NAME      "My SSID"
#define WIFI_PASSWORD    "password"
#define OPENPLC_SERVER_IP  "192.168.0.1"
#define DEVICE_ID      0
/***************************************/

The OpenPLC Server IP is the IP Address of the host computer that is running the OpenPLC. Note that there is another parameter, called Device_ID. It means that you can have multiple ESP8266 connected to the same OpenPLC application. This is neat, but we will talk about it later. For now, leave it zero.

4) Upload the code to your board and then start the OpenPLC Application on your host computer. There are instructions on the website about how to start the OpenPLC, but basically you just need to open the terminal and type "sudo nodejs server.js" (or "node server_win.js" for windows)

5) Have fun and post here the results

The IO map for the board is:
Digital Inputs: D4, D5, D6 and D7
Digital Outputs: D0, D1, D2 and D3
Analog Input: A0
Analog Output: D8 (PWM based)

Note: these pin numbers are relative to the NodeMCU board. If you have a different board, check online the relation between pins.
You do not have the required permissions to view the files attached to this post.
User avatar
By Solutionist
#56610 Getting Stuck when trying to setup the server on a windows box using the below link. Can you help?
http://www.openplcproject.com/getting-started-windows

Thanks.

satwait@SSW-STWAIT-10 ~
$ lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
-bash: lynx: command not found

satwait@SSW-STWAIT-10 ~
$ install apt-cyg /bin

satwait@SSW-STWAIT-10 ~
$ apt-cyg install gcc-core gcc-g++ git

satwait@SSW-STWAIT-10 ~
$ apt-cyg install automake autoconf libtool make

satwait@SSW-STWAIT-10 ~
$ lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
-bash: lynx: command not found

satwait@SSW-STWAIT-10 ~
$