sequentially turn on lights

mgreen_ATC

Member
Join Date
Nov 2022
Location
Alaska
Posts
2
I am a beginner with PLCs. I have a Koyo DL205 from AutomationDirect. I want to create a program to light 3 lights turning them on and off sequentially. Ultimately once I get it doing what I want I want to used it to light 3 strings of Christmas lights toggling them on and off for periods of time. Could someone help? I could also use some direction on how to wire the input and output modules.
 
Please define "to light 3 lights turning them on and off sequentially."

E.g. it sounds like there will be 3 discrete outputs, and each output will have either a value of 1 for on or a value of 0 for off, and you want to see some pattern of the 3 lights for a time, then another pattern, etc., changing over time.

So can you be more specific about the pattern? For example, have light 1 on and the other two off for 10s, then light 2 on and the other two off, then light 3 on and the other two off, then go back to 1 and repeatt, or perhaps reverse then repeat: 1, 2, 3, 2, 1, 2, 4, ... i.e. a bouncing light.

I would assume for the wiring you might need a relay, depending on the power needed to run each set of lights.
 
I want to turn on 1 light for 10 seconds, turn off
turn on the second light for 10 seconds, turn off
turn on the third light for 10 seconds, turn off
repeat
 
ok,
you have said what you wanted to do.
questions and hints for you.
what will tell the plc to start the sequence?
also, what command is used to time things?
think of it like this, tell the plc to turn on only 1 light for 10 seconds and then turn off.
when this is done, add the 2nd light and repeat.
then add the third light.

you must break things down into a step by step logic, otherwise, you will be overwhelmed with stuff to do.
look at this link
https://www.plctalk.net/qanda/showthread.php?p=907619#post907619
james
 
There are many ways to achieve this for example:
Use a counter & compares, resetting the counter when last light has been on for the required time (include timer for the delays).
Use latching bits so the first bit plus time latches in the next bit but de-latches the previous bit.
Another way is to use a rotate function (This is 16 bit so some other logic may be required to limit to the required number probably not worth it).
How good is your understnding of PLC's ? really no idea or at least understand the operation etc.
As for wiring there should be documents from AD that show wiring, also be aware of the types of output cards i.e. transistor relay triac etc. if mains are going to be switched then it would need to be relay or triac, be aware that relays have a limited operation life typically guaranteed 300,000 operations the output rating is also important for example a relay or triac card may have individual retings of 3 or 4 amp but the total rating of an 8 way card may be 10 amp i.e. not 4 x 8 32 amp, xmas lights probably will not consume any real power unless you intend to plaster your whole house with lights.

Xmas.jpg
 
All programming prowess aside, I'd tackle it this way.

Rung 1

A self resetting timer of 10 seconds with a branch that increments an INT variable when the timer runs out.

Rung 2
A compare of said variable to see if it was higher than the number of lamps you have, in this case, 3. If it's higher than three, set it back to 1.

Rung 3
A compare if the INT variable is equal to 1. If it is, turn on lamp 1. No latching.

Rung 4
A compare if the INT variable is equal to 2. If it is, turn on lamp 2. No latching.

Rung 5
A compare if the INT variable is equal to 3. If it is, turn on lamp 3. No latching.

Rung 6
End.


If you want to throw some "randomness" into the lights where some are turned on at the same time and so on, you can assign the bits of the INT counter to the lamps directly. So if you did bits 0 to 2, the sequence would be:

001
010
011

IF you choose other bits, it can get "randomer", but you'd probably want to play with the timer settings as well. Or create your own sequence as well.
 
Long time since I used DL so here is something to get you started based on the above post by Cardosocea.

---|/|------------------------[T0 K100] // NOT T0 TMR 0 K100 (timer 10 seconds.
This is a self resetting timer in other words, The NOT contact of the timer will be false so starts the timer, after 10 seconds the timer contact turns on so on the following scan the NOT timer contact is NOT true so the timer resets.
This gives a pulse every 10 seconds (Timers are usually based on 100ms)
This timer pulse is only on for one scan of the PLC so it is a sort of one shot, useful if you want to count pulses in a memory word.
Then to increment the memory word it is
T 0
-----| |--------------[ADD V2000, K1, V2000] so you add 1 to a V Memory every time the timer times out i.e. every 10 seconds
From that you need to do some compares with V2000 & some constants to turn on the respective outputs, also you need to reset or put 0 into the V memory when it equals the number of cycles i.e. 3 thi needs to be done on the first ladder before the timer to implement it correctly.
 
three rungs ;) LES/GRT would cleaner with seconds-of-minute, but would require a fourth rung (AND time.seconds 31 secs) with seconds since the epoch.

not exactly 10-10-10, but possibly close enough. secs could be some internal continuous time value (long integer seconds since the epoch e.g. since 1970-01-01), or could be seconds of minute from a real time wall clock (0-59).
Code:
  secs.4      secs.2       lights3
----] [----+----] [----+-----( )---
           |           |
           |  secs.3   |
           +----] [----+

     secs.3         secs.1        lights3 lights2
---+---] [------+----] [----+--+---]/[------( )---
   |            |           |  |
   |            |  secs.2   |  |
   |            +----] [----+  |
   | secs.4                    |
   +---] [---------------------+

  light3      lights2       lights1
----]/[---------]/[----------( )---
 
I know some on this site do not like to post actual code to begginers but I see no problem, after all, giving answers in code for the OP to try may get them motivated to look more deeply into different ways of doing things so here is some code using a single timer & variable with compares.
Perhaps once the OP has played with it, gets to understand what the logic does they can go on to developing other patterns i.e. binary sequence running back/forth even combining them to do a varying display (I await the comments) o_O

Xmas lights.png
 
in the Koyo/DL system, memory location V7766 is seconds of minute, 0-59. So


Code:
LD V7766        ### Load seconds into accumulator
DIV 30          ### Divide accumulator by 30, put quotient in accum, remainder in stack
POP             ### Pop accum, move stack (remainder) into accum

CMP 10          ### Compare remainder (accum) to 10

SP60  L1
-] [--( )-      ### Light 1 is on if remainder less than 10

CMP 20          ### Compare remainder (accum) to 20

SP60  L1  L2
-] [--]/[-( )-  ### Light 2 is on if remainder less than 20 AND Light 1 is off

SP60 L3
-]/[-( )-       ### Light 3 is on if remainder not less than 20
 
It's been a LONG time since I worked with a Koyo/AD DL, so I don't remember. Can you access the timer accumulator and do compares? If so, as a first, simple implementation, have a 30 second self-resetting timer and use limit or GRT/LES instructions to turn on the outputs while the accumulator is within certain ranges.
 
Yes that is correct, some V memories are allocated to the timers acc.
Cannot remember what the defult range is though
 
Here's mine. It was painful though. Is it me or does every other IDE absolutely pale in comparison to RSLogix 500 for coding? It's spoiled me so bad I can't even stand RSLogix/Studio 5000.
Untitled.png
 

Similar Topics

Hi all, I have faced with a confusing problem, Dose anybody have a solution or comment?:huh: In our plant we have about 30 set Siemens PLC (400...
Replies
3
Views
7,493
Giving myself a headache here! I have worked with plc's for a few years, but new to programming. Basically I am wanting to check the status of 8...
Replies
11
Views
7,020
Hi, I have a 1500 that controls a station with diferents warehouses, but i also have a 1200 that controls one of those warehouses, i have been...
Replies
9
Views
224
I have a Type C to RS485 adapter connect to my Siemens RWF55. I use modscan to scan it to get a value from the Siemens controller. In the...
Replies
4
Views
71
I'm new to the TotalFLow XIO and it has an attached TFIO DI/DO combo module. All I'm trying to do is close an output on the TFIO module. I'm...
Replies
3
Views
600
Back
Top Bottom