Saturday, December 23, 2017

Digital Loggers PLDuino Customizable PLC (sold by Adafruit among others)

If you just wondered onto this page, let me explain...

A PLC is a Programmable Logic Controller...according to the Wiki, it is an industrial, ruggedized controller.

OK.

It is more simple to explain that in this case the PLDuino is a heavy duty package consisting of an Arduino Mega processor, wifi, SD card, touchscreen, onboard relays, and opto-isolated digital inputs, and protected analog inputs.

So if you are familar with Arduino boards...consider this one on steroids will all the bells and whistles.
https://www.adafruit.com/product/3418


SO WHY?

It depends...

Actually in my case...the reason I bought one... is if you go back a few entries you will read about the Arduino controller for a Halloween display.  I programmed the Arduino, built a relay controller board and tucked it all into a case.   Biggest issue was that I now needed more relay controls...I need to be able to externally illuminate the display with some kind of spotlight.   So I would probably have to build another Arduino setup, or try to get some kind of I2C running...


Well this board already has multiple 10A relays built in.   AND all the other things.


LINKS:

http://www.digital-loggers.com/plc.html

https://github.com/digitalloggers/PLDuino

http://www.digital-loggers.com/plcsw.html

https://nodemcu.readthedocs.io/en/master/en/modules/wifi/

https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/installing-the-esp8266-arduino-addon


I don't think I will add to much to this entry...just some documentation for my implementation...


Here is the first piece...the PLDuino comes loaded with a demo package that shows off all the features.   The one that really surprised me was the WIFI AP and web server control.

The machine sets up an AP and you can log into it...the very simple web page that you open has among other things, buttons to control the onboard relays...so out of the box, remote relay control.

I am definately going to build my setup with this starting point...so I started digging through the .ino files that you can download from github (including the exact demo that comes installed) .  The one thing I couldn't figure out was the wifi.   It has an AP name, password, and IP address at boot...but I was trying to find out where that info is hidden.

Short notes... 

WIFI first:

btnWIFI  calls   MODE_WIFI    (in select_mode.ino)

case MODE_WIFI  calls    testWiFi()  (in plduino_firmware.ino)

test_esp8266 (ESP8266 is the wifi radio module) initializes the wifi.

ok, so how do you adjust anything...well in another folder in the PLDuino github download is one called ... wait for it...  ESP8266.

Inside that folder is a lot of stuff...but the top items are some .lua files, and the .html file the demo webserver uses.

init.lua has the wifi settings...that through some googleing...

HERE are the docs...so all the changes to if it an access point, or if it logs into a network, or what IP address it has, is dealt with in init.lua 


Display next:

Touchscreen stuff is pretty easy to find, but note the .bmp images displayed are stored on the SD card...including the touchscreen overlays (or underlays?)

Again, that stuff comes in the github download in a folder labeled...SD.   Two good starting images are slash.bmp, which has the 3 touch points main menu...and relays.bmp which has 6 touch points and a return to previous menu touch point.


To do:

I will probably use one or both of those .bmp files for my project...so I will need to look at the associated .ino files...luckily it mostly seems very well documented, so I will probably simply edit the demo, and leave everything intact.

I am not sure how the wifi part is handled, as far as the .lua files...so more TBD.