Pages: [1] 2 3   Go Down
Author Topic: Gator/Arduino Compatible PLC (Part I) (Programmabl  (Read 10668 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Gator/Arduino Compatible PLC (Part I) (Programmable Logic Controller)

A customer/contractor wanted a "Internet Controlled Water Sprinkler Valve Controller."
By having the Internet to automatically predict "local" weather projections and by using  local rain guage sensors,
water consumption and usage could be greatly reduced. ($$$$)

We decided build a "generic" programmable logic controller using an Arduino compatible microcontroller. (See design specs. - below)
The isolated input / output interface board for the PLC (microcontroller - Arduino/Gator/Gator+) uses the Parallax Digital I/O Board Kit.
 
-------------------------
PLC Generic Design Specs.
Version: 1.0b
Date: 3/1/2010
Author: ArduinoAndy
-------------------------

#1.  +12 VDC single supply voltage operation.  
#2.  8 opto isolated digital inputs - +12 VDC inputs. <Parallax Digital I/O Board Kit (Parallax.com)>
#3.  8 relay outputs - 4 solid state for AC loads (8 amp) and/or 4 mechanical for AC/DC loads (12 amp). (can be mixed and matched - 8 total) <Parallax Digital I/O Board Kit (Parallax.com)>
#4.  Accurate real time clock with battery backup. +- 1 minute per year @ room temperature. <I2C Real Time Clock - ChronoDot (Macetech.com)>
#5.  LCD Display with software controlled backlight/contrast for PLC status and data. <New Haven 4 x 20 LCD serial Display (newhavendisplay.com)>
#6.  I/O Status LEDs on all digital inputs and outputs. <Parallax Digital I/O Board Kit (Parallax.com)>
#7.  All PLC sub modules are standoff mountable for easy repair and maintenance.
#8.  RGB LED status annunciator. <BlinkM RGB I2C LED Annunciator (Sparkfun.com)>
#9.  Modular analog and digital interface. <Electronic Bricks by Seeed Depot (seeedstudio.com)(compatible modules by Phidigets.com>)
#10. All modules and parts easily purchased via Internet for quick construction. (Except for Watchdog timer / 12 VDC Bus board, 5 VDC Distribution / I2C Bus Protoboard, which has to be constructed)
#11. PLC intended use (inside) for home automation, security, envir. control. <---- Not for use in an industrial or medical (life) applications!!!!
#12. PLC Watchdog Timer for output control safety and protection. <Still under design/construction/testing.> <----<<<< This Watchdog board is a design requirement.
#13. Rugged microcontroller inputs and outputs which are protected from ESD, shorts and overvoltage. <Gator/Gator+ (RuggedCircuits.com) [Also, can use the standard Arduino?]
#14. PLC controlled and polled via serial port by the Internet. <IOBridge with serial output module (IOBridge.com)> (Rugged Circuits Gator has two serial ports for easy external uploading and serial I/O)
Note: The IOBridge needs no PC but needs an Ethernet / Internet connection to function.

(Part I)
------------------------------
Parallax Digital I/O Board Kit
------------------------------

----------
General
----------

The main digital input/output "isolated" interface board is the Digital I/O Board KIT from Parallax. The Parallax Digital I/O Board Kit enables your microcontroller to interface to high voltage circuits allowing you to read up to 8 optically isolated inputs and control up to 8 isolated outputs. Inputs can be a voltage from 5-30VDC (AC compatible) and outputs can be either mechanical (AC/DC loads) or solid state relays (AC load only) that can switch up to 12A loads, such as cooling fans, solenoids, heating elements and more.

The Parallax Digital I/O Board Kit has the following features:
Mechanical and or Solid State Relay output
Configurable Input Voltage range
Serial or parallel interface to inputs/outputs
LED indication of power and input/output status


-------------
Hints & Tips
-------------

To use the Parallax I/O interface, 8 inputs and 8 outputs pins are needed - 16 I/O pins total. Since we are using the Gator/Gator+ with 28 I/O this was not an issue. We used this interface for easy I/O bit troubleshooting. For users with Arduino boards, the I/O requirement can be greatly reduced to 4 I/O pins by using the serial shifting in and out and using the built-in serial interface.

The cost of the board is fairly expensive but is well engineered ($50 USD) but it does not include the optional (extra) output mechanical or solid state relays. (User application requirement determined) For those, who are good at bread boarding, the cost can be greatly reduced by just buying the components needed and constructing a perf board. The schematic and instruction PDFs can be obtained at the Parallax.com website.

The Parallax I/O board needs two sources of power. The input 12 VDC "relay power" which supplies the control voltage for the mechanical and solid state relays. The "logic power" is a +5 VDC power for the opto isolator logic on the board. Both supplies will be needed and "sized" for the high current to the control to the circuits.

Since, the 8 amp solid state relay (AC loads only) and 12 amp mechanical relays (AC/DC loads only) have high amperage outputs, then only thru soldering can the relays be attached to the board.
There are no easy to use plug-in pin sockets due to the high amperage outputs. So, by chosing what type (Solid state or mechanical) and how many relays are critical due to the fact that
all outputs relays will have to be soldered on the board. Note: The relays can be mixed and/or matched.

The Parallax Digital I/O board has current limiting resistors (resistor pack) to limit excessive output current from the microcontroller. Since the Gator/Gator+ plus has 510 ohm resistors built-in, then we jumpered the resistors out on the digital I/O board. Using a standard Arduino, these resistors will save your board in case of excessive current draws or short circuits.

The I/O connections to the I/O board are done via ribbon headers. We used 22 guage wire in the header holes for a better reliable connection(s) to the microcontroller. There is also an option that uses the input +12 VDC "supply power" for the "relay power" VDD that goes to the microcontroller to supply the 12 VDC to the microcontroller board input regulator and then feeds back +5 VDC from the microcontroller supply to the I/O board for "logic power". Proper power supply "sizing" is required.

We installed 1.0K input resistors for 12 VDC photo isolated inputs instead of the 1.5K inputs resistors (default) for 15 VDC isolator inputs, which came with the kit.
Note: Different voltage photo isolated levels can be designed per user requirements.

---------------------------------
Watchdog - Digital I/O Board
---------------------------------

Safety and protection is always designed into a PLC and having an external Watchdog is a standard PLC design requirement. (This is NOT optional!)

Fault #1 What happens if the microcontroller fails or becomes "bricked"? (Device failure?)
Fault #2 What happens if you lose the 5 VDC "logic power" on the digital I/O board? (Device failure?)
Fault #3 What happens if the I2C bus hangs or halts the microcontroller instruction execution? (This does happens with the 2 wire.h library!) (Software or device failure?)
Fault #4 What happens if the local 5 VDC power supply is shorted / overheats or fails? (Device failure?)
Fault #5 What happens if the microcontroller has faulty, buggy software (sketch or rev.) that causes the microcontroller execution to hang, to loop forever or to halt? (Software?)
Fault #6 What happens if a microcontroller critical component like the RTC fails? (Device failure?)
Fault #7 What happens if a microcontroller, during a "fixed timed scan sequence", times out or overruns? (Software?)

You guess it !!! --> The control digital outputs could be activated and stay on all the time without the microcontroller! This loss of control is a severe safety and protection failure that can be easily preventable by proper system design. An external Watchdog will, in most cases (above), will disconnect the control output "relay power" when there is a fault, failure or error. This would stop all control outputs from functioning until the fault, failure or error is fixed or repaired.  
    
By using one output from a microcontroller, which pulses a "missing pulse detector" watchdog relay. This watchdog relay is activated (ON) all the time, which supplies power to the digital I/O board. On any failure event, which causes the output pulse to stop, the watchdog relay will drop and the control output voltage is removed from the control output relays. The watchdog has a timed R/C 2.2 second time out delay, a manual reset and an optional "auto reset" on restart input (dry contact NO).

Note 1: By losing the "input supply" +12 VDC to the digital I/O board, all control voltage is removed from the digital I/O board. All control outputs are turned off.
(Warning ...Do not use the NC contacts on the mechanical relays!)      

 8-) 8-) 8-)
« Last Edit: March 06, 2010, 07:59:36 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Picture of just released Parallax Digital I/O Board (Kit)
 8-) 8-) 8-)
« Last Edit: March 06, 2010, 03:51:14 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bigger picture of PLC. This development board is used for software/hardware design and testing.
Picture includes Parallax's Digital I/O Board Kit, Rugged Circuit's Gator/Gator+, Macetech's RTC "ChronoDot,  New Haven 4 x 20 serial LCD and  Futurlec +5 VDC 1 amp switching power supply.
Bottom right - Sharp Solid State Relays and Omron SPDT mechanical relays.
 8-) 8-) 8-)
« Last Edit: March 06, 2010, 04:20:12 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Very nice work as usual smiley Allen-Bradley are probably starting to become worried!
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You really meant to say "Automation Direct" with their Koyo PLC series product line should be worried.
Besides, those are "Industrial PLCs" with class certifications.  
 ;D ;D ;D

Also, how many Allen Bradley or Koyo PLC types do you know of that can be repaired by the end user at
a very low cost? The answer is 0 - ZERO.  Guess what? My Gator PLC, due to its modular construction,
can be easily repaired by the end user!
 8-) 8-) 8-)
« Last Edit: March 06, 2010, 07:22:29 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The I/O schematic - a better one can be obtained at their website.

 smiley-wink
« Last Edit: March 06, 2010, 07:39:16 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Part II - PLC Watchdog - design and schematic.

Below is the preliminary PLC WatchDog Schematic we used to build a "missing pulse detector" for our Home Automation PLC using
the Parallax Digital I/O Board. Arduino users can use this "preliminary" schematic as an engineering starting point to prevent equipment and property destruction
by disabling the digital control outputs when the following occurs:

#1. Microcontroller/Gator/Gator+/Arduino device failure.
#2. I2C lockups/hangs due to loss of device +5VDC vdc power or device failure, which hangs/halts the Arduino/CPU.
#3. Loss of device/system +5 VDC power.
#4. Microcontroller uploading which might cause the control digital outputs to turn on.
#5. Microcontroller software bugs or revision changes which could force the digital control outputs on.
#6. Software task timeouts or scan overruns. (Software stops the WatchDOG)


The microcontoller needs two digital outputs to control the PLC Watchdog.
One resets/restarts the WatchDog timer.
The other output pulses or "kicks the dog" to keep the WatchDog enabled via software control.
When the microcontroller fails, device fails or under software control the pulsing stops, all digital control outputs are disabled.

Note: You can use just one digital output but you need to manually reset the timer on all uploading, power blips or brownouts.
You could also prevent brownouts by using a computer UPS, which most modern PLCs already have built-in to their systems.

Note: There are no known problems with the PLC Watchdog ... yet ... further testing in progress.

Note: Watchdog part costs ~ $13 USD.

 8-) 8-) 8-)
« Last Edit: March 10, 2010, 09:48:52 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PLC WatchDog Schematic Rev. 1.0b
Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Picture of PLC WatchDog breadboard module.

 8-)
Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Below is a picture of the Home Automation Gator Programmable Logic Controller System Block Diagram.

8-)
Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The picture (below) of the Home Automation "Gator PLC" which is 3/4 complete. Still waiting on parts for the 3 pin A/D interface board, which connects to the upper left corner of the Gator microcontroller.

In the picture, from the top left, is the BlinkM I2C RGB annunciator and the ChronoDot RTC. Below that, is the 5 VDC and I2C bus board. Then comes the LCD terminal display, the 1 amp 5 VDC power supply, the Gator and Watchdog and 12 VDC Bus Board. Last is the Parallax Digital I/O Board.

This development PLC panel is used for software development and PLC I/O simulation.
The final PLC end product will be installed in a Nema enclosure.
BTW ... everything works fine, so far.



 8-) 8-) 8-)
« Last Edit: March 11, 2010, 11:06:05 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I know what you are all thinking ... "So what that we went through all the engineering effort to design a generic, very reliable, Home Automation Programmable Logic Controller" What are some of the unique home control applications that can be applied using this Gator PLC?

Applications:

1. "Internet controlled water sprinkler valve controller", uses four relay digital control outputs for 4 zone water valve solenoids. 2 digital photo isolator inputs are used for accumulated water detection. IoBridge via serial port, off loads the projected weather forcast to conserve water usage and to save money on the utility bills. The valve controller uses the built-in ChronoDot RTC for water scheduling. This PLC valve controller acts in tandem with the existing water sprinkler controller to allow transparent backup in case of PLC failure and adds greater uptime reliabilty to the system.

2. "Garage door automatic/manual, remote/local opener and closer" uses one photo isolator input (feedback) from the garage door magnetic open/close sensor and one relay output to pulse the open/close garage door switch. One A/D output is also connected to a beeper/buzzer to indicate pending door closure. An RTC along with "fast", ambient light sensor (TEMT6000- Sparkfun.com), also on the A/D bus, senses lighting conditions and closes the garage door automatically at night.

Using Wifi and a iPhone/iPod Touch, a home user can remotely or locally open and close the garage door. The IOBridge connected to the Internet and the PLC via serial port, can also open and close the garage door from any user PC.
 
Note: Using the isolated inputs and outputs from the Parallax Digital I/O Board allows long runs of remote wiring to and from the PLC.

Note: The garage door control electronics are NOT modified and is preserved to allow transparent garage door operation and reliability.

Note: The IOBridge can visually indicate, on their I/O Bridge internet website, garage door entry and exiting using the garage door feedback from the garage door magnetic sensor.    

3. "Garage Parking Assistant", which guides the driver by ultrasonic range finder sensor (EZ0 - MaxBotix - Sparkfun) and a mixed color I2C RGB BlinkM indicates the precise parking distance, in the garage, by changing color patterns. One A/D bus I/O is used along with the built-in IC2 BlinkM PLC system annunciator.

4. "Automatic garage lighting controller", automatically turns on/off ceiling lighting in the garage using Insteon, PIR Detector and one digital output contact are used in this controller. During the day, human presence allows preproprammed on/off time delays and at night using the RTC the lights are scheduled OFF.

The best part is that ALL of the above home controller applications can easily done using one Home Automation Gator PLC and still have left over digital and analog I/O.

"Let the power of the PLC be with you"
Enjoy
 8-) 8-) 8-)

« Last Edit: March 11, 2010, 11:09:41 pm by ArduinoAndy » Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

Phoenix, Arizona USA
Offline Offline
Faraday Member
**
Karma: 40
Posts: 5570
Where's the beer?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is pretty cool, and probably something I should do for my home's watering system (right now, we run in manually, even though it has an electronic timer system - it is just difficult and fussy to program, and it being outside (though under the porch area) means that the switch contacts for the programming buttons and such don't work great, and you have to remember to shut it off in case of rain, etc).

Are you planning on adding a "ladder-logic programming" system to it?
Logged

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 309
Progress is made by lazy people-H Ford/R Heinlein
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A definite NO.

The Arduino functions are more than sufficient and easy to use than the "Relay Ladder Logic" of yesteryear. Your can do more with the Arduino's function set than any vintage PLC with RLL. The key is to mimic the PLC scan with functions like millis() to make sure all control functions are executed within the proper time frame.
 smiley
Logged

"Never trust an Internet bully who insults and makes fun of your level of intelligence."

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then what justifies calling it a PLC, The external watchdog timer and industrial looking I/O modules? I've always associated PLCs with their most common programming method of ladder logic symbology.

Lefty
Logged

Pages: [1] 2 3   Go Up
Jump to: