Arduino mega PLC ( arduino_plc )

Hello

I busy to develop a micro-plc base on arduino mega 1280, with 2 serial prompts (usb and com1).

I want to know if some one have developed a hardware base on arduino mega + ENC28J60 Ethernet
and maybe some open transistor for output.

In short:

you put the label you want to use in your plc program in arduino_plc.

// #define your_label the_pin_name

#define switch1 i1
#define switch2 i2
#define light o3

You modify the timer in the def_timer

// Set the timer value use in your plc program in second.

#define temp1 11 //sec
#define temp2 12 //sec
#define temp3 13 //sec

And you write your logic equation in plc :
// Write your logic equation here (and more if you can).
light=switch1 or switch2;
ti2=m2;
ti3=m2;

You compile and put in arduino mega, the you have a plc, with serial interface to
See input, output, timer …..
strcat( reply, "You can type :\r\n\r\n" );
strcat( reply, " di Display input\r\n");
strcat( reply, " do Display output\r\n");
strcat( reply, " dm Display memory\r\n");
strcat( reply, " da Display analog value\r\n");
strcat( reply, " dt Display timer\r\n\r\n");
strcat( reply, " sm x Set the memory x\r\n");
strcat( reply, " rm x Reset the memory x\r\n\r\n");
strcat( reply, " dl Display the loop done by sec\r\n\r\n");

Thanks,
GG

arduino_plc.rar (16.9 KB)

I did a small and simple PLC design for the Arduino Uno last year. You can find the schematic here

I believe it was rugged circuits that had something like that already built. More of an Arduino-like board with isolated outputs and inputs, etc...

Look it up on his profile.

Ok, thanks,

I will make a backplane where i can plug the arduinomega, the ethernet board and maybe also a sd fo log,

Just for fun, i put the screenshot of the serial output of my arduino plc program.
You need to use putty in serial usb or com1, with the terminal config option for keyboard
Backspace key = control-h, then you can come back and modify you serial command.
the usbcom and com can be use at the same time ( 2 input buffer )

Arduino PLC

help
You can type :

di Display input
do Display output
dm Display memory
da Display analog value
dt Display timer

sm x Set the memory x
rm x Reset the memory x

dl Display the loop done by sec

di
Input
i8 to i1 : 00000000
i16 to i9 : 00000000
i24 to i17 : 00000000
i32 to i25 : 00000000

do
Output
O8 to O1 : 00000010
O16 to 09 : 00000000
dm
Memory
M8 to M1 : 00000000
M16 to M9 : 00000000
M24 to M17 : 00000000
M32 to M25 : 00000000
M40 to M33 : 00000000
M48 to M41 : 00000000
M56 to M49 : 00000000
M64 to M57 : 00000000
M72 to M65 : 00000000
M80 to M73 : 00000000
M88 to M81 : 00000000
M96 to M89 : 00000000
M104 to M97 : 00000000
M112 to M105: 00000000
M120 to M113: 00000000
M128 to M121: 00000000

help
You can type :

di Display input
do Display output
dm Display memory
da Display analog value
dt Display timer

sm x Set the memory x
rm x Reset the memory x

dl Display the loop done by sec

da
Analog value
Ad(0) : 101
Ad(1) : 102
Ad(2) : 102
Ad(3) : 103
Ad(4) : 102
Ad(5) : 103
Ad(6) : 105
Ad(7) : 104
Ad(8) : 102
Ad(9) : 102
Ad(10) : 101
Ad(11) : 102
Ad(12) : 102
Ad(13) : 101
Ad(14) : 101
Ad(15) : 99
dt
Input
ti8 to ti1 : 00000000
ti16 to ti9 : 00000000
Output
t8 to t1 : 00000000
t16 to t9 : 00000000
Timer value
T1 : 0
T2 : 0
T3 : 0
T4 : 0
T5 : 0
T6 : 0
T7 : 0
T8 : 0
T9 : 0
T10 : 0
T11 : 0
T12 : 0
T13 : 0
T14 : 0
T15 : 0
T16 : 0
help
You can type :

di Display input
do Display output
dm Display memory
da Display analog value
dt Display timer

sm x Set the memory x
rm x Reset the memory x

dl Display the loop done by sec

dl
Loop by sec : 2006

dl
Loop by sec : 2005

dm
Memory
M8 to M1 : 00000000
M16 to M9 : 00000000
M24 to M17 : 00000000
M32 to M25 : 00000000
M40 to M33 : 00000000
M48 to M41 : 00000000
M56 to M49 : 00000000
M64 to M57 : 00000000
M72 to M65 : 00000000
M80 to M73 : 00000000
M88 to M81 : 00000000
M96 to M89 : 00000000
M104 to M97 : 00000000
M112 to M105: 00000000
M120 to M113: 00000000
M128 to M121: 00000000
sm 1
Set memory 1
dm
Memory
M8 to M1 : 00000001
M16 to M9 : 00000000
M24 to M17 : 00000000
M32 to M25 : 00000000
M40 to M33 : 00000000
M48 to M41 : 00000000
M56 to M49 : 00000000
M64 to M57 : 00000000
M72 to M65 : 00000000
M80 to M73 : 00000000
M88 to M81 : 00000000
M96 to M89 : 00000000
M104 to M97 : 00000000
M112 to M105: 00000000
M120 to M113: 00000000
M128 to M121: 00000000
rm 1
Reset memory 1
dm
Memory
M8 to M1 : 00000000
M16 to M9 : 00000000
M24 to M17 : 00000000
M32 to M25 : 00000000
M40 to M33 : 00000000
M48 to M41 : 00000000
M56 to M49 : 00000000
M64 to M57 : 00000000
M72 to M65 : 00000000
M80 to M73 : 00000000
M88 to M81 : 00000000
M96 to M89 : 00000000
M104 to M97 : 00000000
M112 to M105: 00000000
M120 to M113: 00000000
M128 to M121: 00000000

I design my model: https://github.com/willianpaixao/VIKI/tree/unstable/src/cad/relay-card_direct
:slight_smile: