This is a great news to the IoT community! ESP8266 is definitively the best and cheapest board for the Internet of Things, and it is now supported on the OpenPLC platform. 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.

I will later update the website with better instructions, but to install the process if fairly simple:

1) Update your OpenPLC on your Windows, Linux or RaspberryPi if you already have it installed. Just remove the OpenPLC_v2 directory, git clone it again and build. 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. The firmware requires the arduino IDE to be uploaded. Instructions on how to install the ESP8266 tools on the Arduino IDE are here:

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:

/*********ESP8266 CONFIGURATION*********/
#define WIFI_NAME      "My SSID"
#define WIFI_PASSWORD    "password"
#define DEVICE_ID      0

The OpenPLC Server IP is the IP Address of the 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 computer/raspberryPi

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.

Quote 5 0
Quote 0 0
This is really cool.  I recently started tinkering with rPi and an ESP8266 (12).  As a PLC programmer myself, this ties everything together nicely.

That being said... ;-)
Any chance at getting the I2C or SPI pins functional?  By using the SPI, you could expand on the I/O available to the ESP8266.
Quote 0 0
Hi. Thanks for the motivational words [biggrin]. I've been thinking about a good way to use the SPI bus on the supported platforms, but haven't come with a good solution yet. I'm putting together some drafts to create an OpenPLC-branded hardware platform (based on the concept hardware design) that will run the software smoothly and will support expansion somehow. Maybe when I have it finished I will be able to port some ideas to the currently available platforms as well.
Quote 0 0
Hi Thiago,
Could you tell me if it is possible to use the ESP8266's IO and the raspberry's IO at the same time, please?
(Like on the "8) Arduino+RaspberryPi" configuration)

Raspberry's IO address would be %QX0.0 to %QX1.5 and ESP would start from %QX2.0

Quote 0 0
Unfortunately not. I know you all have heard it a lot, but this is another feature that will be available on the v3. On v2 those external devices (like arduino and ESP8266) are considered as internal I/O, therefore when you choose the ESP8266 driver it replaces the control of the GPIO pins. On v3, external devices will be considered as external slave I/O, which makes more sense.

OpenPLC is a growing project. It started as just a draft. Version 2 was a nice improvement of this draft, but was still lacking a lot of functionality. As people started to use it, they came back with a lot of feedback which I've been collecting over the past months. This feedback from users helped me shape the architecture of OpenPLC v3. It won't be perfect yet, but will include a lot of things that people keep asking me to add.
Quote 1 0
Thanks again for your fast answer!

Don't worry! Esp are so dirty cheap that is not a problem to put many of them around.
You did a remarkable job! Don't put to much pressure on you and take your time to keep it enjoyable for you!
Quote 0 0