Open Source PLC based on Arduino Mega 2560.  You could spend as much to buy all of the components and packaging and still not achieve the quality of this ready to use system. The unit is programmed from the USB port using the standard Arduino IDE software, and the unit is supplied pre-programmed with the Arduino bootloader and (2) demo programs.  The demo program allows you to use the unit right out of the box to remotely control the relays (turn things on and off) and digital outputs or to read values from the analog and digital inputs using any web browser (cell phone, laptop, PC, etc).

ATMEGA2560 CPU @ 16MHz, with 8 optically isolated digital inputs that can sense either AC or DC inputs in the range of 3 to 24 volts.  External current limiting resistors may be added for higher input voltages.  The 8 analog inputs are set up for 0 to 10 volt signals.  Input resistor packs can easily be switched to allow for higher input voltages and inputs are protected from negative voltages or over voltage by zener diodes and current limiting resistors.  Analog inputs are connected to Arduino pins A0 through A7 and can be used as digital (TTL) inputs by changing the input resistor pack.  Analog input A8 is used to measure the input voltage (12-24VDC) so the system may be shut down if the supply voltage goes below 11V to prevent unreliable operation.  Protection is provided for reverse supply voltage by a diode in the supply input. 

There are 6 relay outputs, each with a SPDT relay capable of up to 6 amps at 120VAC or 24VDC.  Relays are fused at 10A and external 6A fuses for each circuit are recommended.  There are 8 digital open-collector outputs that cab be used for logic outputs or to drive external loads of up to 500mA maximum.  Protection is provided for inductive kickback from relays, solenoids and other inductive loads.  There is also a 3 wire RS232 Serial port (data leads only), a Dallas DS3231 real time clock chip with CR2032 lithium battery backup, and a speaker driven from Arduino digital pin 9 (a PWM pin) with a 1W audio amplifier.   The real time clock is compatible with Arduino DS1307RTC.h codes and Time.h libraries and uses I2C for communications so the Wire.h library can be used.

There is a 2.4" 320 X 240 Color LCD panel with touch screen (compatible with Adafuit IL9341 and GFX graphics library) and the backlight brightness is controlled by Arduino pin D46 (PWM).  The LCD uses 16 bits for color information providing for almost truce color displays.  There is a micro SD card slot and a  32K EEPROM (socketed) that can be used for no-volatile storage, both also connected to the I2C bus.  A 4Gb micro SD card containing pictures and audio for the demo routine is included.  There is also on board WiFi using the ESP8266 chip (ESP-02 module) with 128Kb on board flash (32Kb is the typical size for ESP8266), and Node MCU firmware.  The WiFi radio uses Arduino pin 26 and Atmel serial port 2 for communication.  The WiFi radio, LCD touch screen and SD card can be individually turn off and on (or reset) by Arduino pins D26 and D27 respectively.  Demo code is included in the unit allowing you to connect to the unit as a WiFi access point and control relays, read analog or digital inputs, set the digital outputs, etc from a web browser as a WiFi client.  The WiFi radio uses an external antenna via the common RPSMA (reverse polarity SMA) connector, and a small WiFi antenna is included.

Most chips that could be damaged by external inputs or outputs, or that you might desire to replace with different values (opto isolators, dip resistor packs, digital output drivers, RS232 driver, EEPROM) are socketed for easy replacement.   The unit is designed to run on 12 to 24 volts DC at 300 to 500mA.  Schematics, parts lists, source code for demo routines, and example wiring diagrams and code are provided.  The unit may be mounted by screw holes at the corners of the unit or on a standard 35mm DIN rail.  We can provide an optional kit with a 10" section of DIN rail, a 12V DC 500 ma power supply, and a 10cm antenna extension (for RPSMA or RPTNC antenna) or external antenna (1M cable with magnetic base antenna) for $30 additional.

You might spend almost as much money ordering small modules from Chinese suppliers, waiting weeks for delivery and then spending hours and hours of time bread-boarding, interconnecting, building an enclosure, mounting modules, figuring out how to program all of the code and collecting the software libraries, etc ... and you still would not have all of the features, flexibility and input/output protections that are incorporated into this beautiful device!  With the included - already programmed - demo code in the unit you can use this right out of the box to control the relays and digital outputs, or read the digital or analog inputs from a web browser on your PC or Cell Phone (by WiFi connection). Get one now and have it in your hands in just two or three days by priority mail!

This KIT now includes power pigtail (w/standard 2.1mm coaxial jack), 12V power supply w/2.1mm coaxial plug, and 6" section of DIN Rail for mounting.

I previously had a listing for just the main unit - with no accessories as listed just above, but that configuration is currently not available.

Please note this is not a replacement for an Arduino Mega 2560 for use in other applications as not all pins and signals are available for external use.  This is an embedded Mega 2560, programmed as usual with only the inputs and outputs (optically isolated inputs, open collector and relay outputs, embedded ESP8266 WiFi, Color Touch Screen LCD, Sound, etc) as listed/specified.  Please ask questions before you buy.  No returns because it does not suit your purpose, and no returns once you have reprogrammed the unit with software other than the demo software that comes in the unit when you buy it.

If you are familiar with the Arduino IDE, programming for Arduino Mega 2560 and Node MCU commands for the ESP8266, you should be able to program this unit sucessfully.