Introduction: Arduino-tomation Part 2

Picture of Arduino-tomation Part 2

In order to control more complicated systems I decided to upgrade a previous project: Arduino tomation1. So this project will allow you to:

- use an atmegas 40 DIP inserted in a 32I/O PLC pcb and experimenting multitasking in LADDER programming, arduino C language programming

-or use a MEGA2560 board inserted in the same 32I/O PLC pcb and experimenting multitasking in LADDER programming, arduino C language programming, state diagram design programming and supervised with a SCADA

All the softwares used are free.

Step 1: The PLC Desciption

Picture of The PLC Desciption

It was a huge task to put on a same PCB 2 different microcontrollers (not at the same time!), then to use the good I/O for what you aim to and the connect the components and a too small PCB:

-the atmegas 8535/16/32/644p/1284p clones on which you can use 32 pins (the maximum possibilities) to provide 20 digital input, 12 digital outputs and 1 analog input and 2 analog outputs (owing to switches wihich transforms some digital I/O to analog I/O).

-the MEGA2560 board with no problems of number of pins.

Another problem: on LDmicro ladder programming. I have got some disapointments in using some pins of both microcontrollers:

-I1, I16, I17, I18 and I19 must be opto-amplified with a darlington schematic because the optocoupler were too weak

-only 2 special analog outputs and one special analog input available on atmegas 40 DIP

-special I/O available for MEGA2560 but not those you want??!!!

-some special function and settings to use on Arduino IDE and YAKINDU.

Step 2: The Shematic of the PLC

Picture of The Shematic of the PLC

A bit complicated with a special power supply (0/5/12/24V) seperated from the PLC.

Step 3: The Matrice of I/O Adresses

Refer to it to use the good I/O in both case: atmegas 40 DIP and MEGA2560. I write on it the settings of the switches and additional links to wire.

Step 4: The Dash Board Use to Simulate a System

Picture of The Dash Board Use to Simulate a System

You need industrial push buttons, rotating switches, trimers, 24VDC lights and LED lights for analog outputs.

Step 5: The Schematic of the Dashboard/the Power Supply/the PLC 32I/O

I used a mushroom pushbuttons for emergency stop which should:

-switch off the power on actuators

-and simultaneously reset the state diagram or ladder or SFC.

Step 6: The Sequence You Aim To

Picture of The Sequence You Aim To

2 diagrams to describe the sequence of task you aim to:

-a master machine to reset the 3 slave machines on emergency stop

-3 slave machines (with no link) on a multitask running

The SFC diagram desrcibes the same things than the state diagram. SFC is ruled by an automation norm (IEC61131) and not the state diagram. The diference between them: on a state diagram in the same machine: only one state activated at the same time (more in SFC).

Step 7: When You Use Atmegas 40 DIP Clone on the PCB

Picture of When You Use Atmegas 40 DIP Clone on the PCB

Put the switches on the good position and then program:

-use LDmicro (IEC61131) to program the previous diagrams in ladder and experimenting multasking and upload with KAHZAMA soft and USBasp

-use Arduino 1.8.2 with Mightycore and state machine librabrie (SMlib) and also experimenting multitasking

Enjoy.

I give a small tutorial with LDmicro4.3 ,the LADDER source codes and the arduino source code.

Step 8: When You Use MEGA2560 Board on the PCB

Picture of When You Use MEGA2560 Board on the PCB

Put the switch in the good positions.

In ladder programming you need Xloader to upload the program via usb.

Eperimenting multitasking with Arduino IDE.

Whith this board you can supervise your system with an ethernet shield and advancedHMI.

And then YAKINDU to program your PLC with a state diagram you draw and you supervise.

I give some additional libraries for Yakindu and my scripts. A tutorial is supplied to use all these files.

Step 9: Conclusion

This board can be used to control more or less complicated systems. It was a huge task and a way to integrate microcontroller in industrial applications: it's cheap, easy to program and safe I think. The bad part: making boards (with harvested and used components) but you can buy some built shields.

A good article to conclude:

http://www.automation-sense.com/blog/automatisme/a...

Thanks to all interesting tutorials and forums all over the net.

Comments

gada888 (author)2017-10-31

Wow,awesome post.

About This Instructable

244views

6favorites

License:

More by manu4371:Arduino-tomation Part 2Arduino 1.8.x Clone With Atmega 8535/32/644p/1284p: the MightycoreArduino PLC 32 I/O+State Machine+SCADA or HMI
Add instructable to: