Arduino-tomation Part 2

by manu4371 in Circuits > Arduino

3046 Views, 7 Favorites, 0 Comments

Arduino-tomation Part 2

1-general schematic_Page-1.jpg

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.

The PLC Desciption

2-PLC description_Page-1.jpg

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.

The Shematic of the PLC

SCHEMAPLATINE2.jpg

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

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.

The Dash Board Use to Simulate a System

3-The dashboard_Page-1.jpg

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

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.

The Sequence You Aim To

6-State diagram.jpg
7-SFC diagram.jpg

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).

When You Use Atmegas 40 DIP Clone on the PCB

4-Switch settings atmegas clone PLC_Page-1.jpg

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.

When You Use MEGA2560 Board on the PCB

5-Switch settings MEGA2560 PLC_Page-1.jpg
8-The SCADA.jpg
9-yakindu.jpg

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.

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.