Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Timer loop

(you are viewing a thread; or go back to list of threads)

Timer loop (by John)
Hi all,

the ldmicro is my favorite plc program but i'm new and don't know how to handle my school project. I' ve tried to do it with TON and TOF timers with no luck.

I want to build a circuit with the following features:

1) In a round orbit we have two limit switches to find the START and FINISH. When the 1st double limit switch with NO and NC contacts start to move via a motor, i want to start a timer TOF and the motor goes CW for 5 mins, then stay stand waiting by and after 5 mins start running again in the same direction and do this loop until the 2nd limit switch goes to FINISH position.

2) When it comes to the end position, the motor start running CCW until the 1st limit switch goes to START position.

3) In the meantime, If it happens a short circuit via an NC contact, the motor must stop immediately until short circuit stops remain and then by pressing the reset button starts the running loop again.

I 've tried to do it in ldmicro but i'm newbee and i didnt make it. I give the file for anyone who can help me.

Any help would be appreciated.
Wed Jun 20 2018, 13:58:38, download attachment timer1a.ld
(no subject) (by MGP)
As far as I understood your question, here you have your program without start / stop.
Because you are a student you have to program your start / stop yourself.

I use 5sec instead of 5min to simulate, you have to set the timers to 5min yourself.
Also select the controller settings.

Your program has been made as clear as possible because you would understand it.
Thu Jun 21 2018, 02:47:20, download attachment motor.ld
Unable to understand the restart function (by John)
Dear MGP,

thank you for reply and the circuit you send me.
I 've studied the circuit a lot to fully understand how it works but i didn't manage to understand how to do the loop after restart.

I'm sure it's something quite easy but at this time i'm unable to find it.

I send you my tweak to this circuit asking you if possible to fill it with the appropriate missing function.

Thanking in advance
John
Thu Jun 21 2018, 08:23:01, download attachment motor_test2a.ld
(no subject) (by MGP)
In my version the engine runs back and forth, it stops only after 5min.and then continues until the beginning of the cycle and immediately starts back for the next run.

You can not stop the cycle without extra switching (start/stop).

If you simulate you have to set X_EAST and X_WEST correctly as the motor would do, otherwise it will not work.

So if the engine leave X_EAST you also have to open that contact again, also at X_WEST when the engine has arrived and is gone.
Thu Jun 21 2018, 08:52:18
A better description of the project (by John)
Dear MGP,
thank you for your concern.
My apologize for google translation about "school" project.
In fact i've finished school many years before!
I 'm trying to do a project for a friend as cheaper as possible.
Arduino mega is the cpu i 'm thinking about to do the job together with an RTC shield and also a 8 relay board. If possible I would like to show (optional), the current time to an oled spi display.
The system is a solar panel moving (not tracking) system.
It is little more complicated than mentioned before though.
The construction is already made and consist of an inverter omron MX2 and the mechanical construction too.
I was thinking use a modbus RTU commands to control the inverter but i didn't find a good way to engage modbus commands via arduino.
Anyway here is the working task:

When the RTC reached 6 pm, starts the motor by sending Forward command to inverter via a dry relay contact to direction WEST. When WEST limit switch reached, it send a RUN Reverse command through dry relay contact to inverter and the motor runs CCW until the EAST switch reached and then goes to sleep mode until 6 pm and does the loop again.
Of course there are safety switches like NC contacts from thermal or emergency which enables STOP command to the inverter and LED indicators.
I preferred to ask help for solving the start-stay problem but since the project is going i must find solution as sooner as possible.
Also i 've made a simple design in 3D to help clarify the all system.

Thanking in advance
John
Fri Jun 22 2018, 05:53:08, download attachment 1.jpg
(no subject) (by MGP)
Here the new program.
All contacts are programmed as NO, change if necessary.

Operation:

X_EAST is closed at start, (simulator is set with a ^)

X6pm impulse comes in and motor runs CW.

X_EAST opens

Motor always runs 5min and stops 5min until X_WEST is reached.

X_WEST is closed and engine returns CCW to X_EAST and waits for X6pm to close.

I hope this was your goal of the setup.
Fri Jun 22 2018, 07:56:07, download attachment motor_6pm.ld
(no subject) (by John)
Dear GMP,
thank you once more fro your concern and i appreciate it.
I 've tested your version and it works like a charm!

I have many questions though about my tweaked circuit.

1) I add a MANUAL MODE function just to override the orbit and regain position in case of thermal event. I' ve done the simulation and it was correct.

2) I did assign pins for arduino mega to test the circuit but even the .ino sketch compiled well, the timing process didn't work at all. It is working only the Manual overriding mode though.

3) Is it possible to un-assign all pins and do this job from beginning?

Thanking in advance

PS I send you my tweaked version and the arduino compiled files as well.
Sat Jun 23 2018, 04:43:08, download attachment motor_6pmOK-auto.zip
Its working fine now (by John)
Dear MGP,

i hope not to get bored with me!
The problem was a bad physical pins assignment. I did use the pin 23 and i thought it was 21 until i saw the arduino mega pins diagram. Now it is working with the manual overriding mode too.
The second approach now is to implement a RTC with DS1307 arduino shield. I will search for an article about it in this forum.
Last question (for now!): Is it possible to implement a modbus rtu commands by write single (or multiple) registers or the program can handle only coils?

TIA
Sat Jun 23 2018, 06:49:28
(no subject) (by MGP)
I can't help you with Arduino, I never use it because I'm a PIC user.

Un-assign all pins... simply select "no microcntroller" at the bottom of the menu.

BTW. I hate contacts in the middle of a rung, professional programmers use an inputcontact with an internal relay with the same name.
If something went wrong then you can see immediately which contacts are pressed or free.
Sat Jun 23 2018, 06:53:12
(no subject) (by MGP)
I never have used the modbus instruction...
Sat Jun 23 2018, 06:58:44
Better functioning now. (by John)
Yes you are right. I was used to program like relays and i forgot that i'm doing PLC programming.
Now i' ve fixed it and it works quite well.
About modbus your mention before, it's a very delicate opportunity to control the inverter remotely.
If i was able to push a switch and send a coil command like "RUN_FW" via RS485 protocol, i would be very pleased.
But since i didn't make it to work, i will keep on the main task.

PS I send the so far circuit for reference.
Sat Jun 23 2018, 07:21:22, download attachment motor_6pmOK2.ld
(no subject) (by MGP)
In rung 12..why a contact (R_manual) over X_manual? you never can switch R_manual off.
Sun Jun 24 2018, 02:23:04
RTC clock function almost finished (by John)
In rung 12 the start button x_manual latch with R_manual contact. When i re-position the panel into the desired orbit, i drop thermal and it does stop the latch. Then reset the thermal again to continue the orbit.

I 've managed to implement an DS1307 RTC clock code into .ino sketch and i will try to fetch the tm.hour function for the 6pm check.

The time is displayed to an 4 pins OLED and so far it works.
Sun Jun 24 2018, 06:19:00
Timer loop (por John) (by Calubert)
por John, MÍRATE ESTE HILO = Foro LDmicro - Variable de tiempo EN EL APARTADO TECNO CALUBERT ES UN TEMPORIZADOR DE ON-OFF QUE PUEDES MOVER LOS TIEMPOS DESDE FUERA DE LA MCU TANTO EL ARRANQUE COMO EL PARO, PUEDES HACER DIFERENTES TIEMPOS DE ON COMO OFF Y TAMBIÉN TIENES LA PLACA ELECTRÓNICA.
SOLO TIENES QUE AÑADIR LOS FINALES DE CARRERA.
Tue Jul 24 2018, 06:06:32
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):