Sign in to follow this  
Followers 0
perpetual98

Turning Lights On And Off With Plc

27 posts in this topic

Hi all. First post here, so be gentle. I just started playing around with an AB Micrologix 1500 with RTC installed and RSLogix 500 to program it. Here's what I'm after: A PLC that will control/automate all of the functions of my two 120 gallon saltwater fishtanks in my living room. I've set up some rather basic things now using DC inputs turning on DC outputs, but one of the things that I thought would be the easiest, it turning out to be the hardest. I've searched all over and can't find what I'm looking for. What I'm trying to do is figure out the logic that turns outputs on at certain times of the day so that I can control the lights. For example, at 2:00PM I want an output to turn on so an outlet gets energized and a set of lights turns on. At 2:30, another output turns on, etc. Then at 9:30PM the first outlet turns off..... I can't imagine that it would be that hard, but for a newbie like me, it's becoming frustrating. Any help would be appreciated. Thank you! Eric

Share this post


Link to post
Share on other sites
Here is a basic example we use to determine if 1st shift is running that you should be able to adapt it to do what you are trying to do. The minute and hour are Long Integers but they can be integers L20:9 = 1st shift starting hour L20:10 = 1st shift starting minute L20:11 = 1st shift ending hour L20:12 = 1st shift ending minute You could put when you want the output to turn on and off in place of these and put your output in place of the 1st shift running.

Share this post


Link to post
Share on other sites
Hmm, i entered that logic and i'm totally lost and it gives me an error. Maybe I'm already in over my head. You'd think this would be an easy thing, but it must not be too common in the industrial world.

Share this post


Link to post
Share on other sites
What error are you getting? What series Micrologix do you have? My example used L20 data file. You would get an error if you didn't create the data file. Change the L20 to an N7 and see if that works. N7 is created by default so you won't have to create it Edited by TWControls

Share this post


Link to post
Share on other sites
I'm sure that's the problem. i didn't do anything with the data file, but I was looking at them when I got your response. I'm going to wrap it up for today and try again tomorrow. Thanks for your help thus far! Eric

Share this post


Link to post
Share on other sites
No problem. Hopefully Ron Beaufort will chime in and give one of his wonderful explanations. He is much more thorough than me and we haven't had an entertaining post by him for a few weeks.

Share this post


Link to post
Share on other sites
Simply use constants in the compare functions. Replace the L20:x with the actual values.

Share this post


Link to post
Share on other sites
Now why didn't I think of that. Our shift times change and that why they are variables. Your right he wouldn't need that for a fishtank at home

Share this post


Link to post
Share on other sites
Thanks for the help guys. I'll try the constants when I get home. I got some programming help from a guy at work too, but I can't open up the file because I didn't bring my laptop to work. D'oh! If he comes up with something different, I'll let you guys know too. Eric

Share this post


Link to post
Share on other sites
Lookin' good! I used manually entered constants, and I also used the ladder from the top response so that I could enter the minutes and it works like a champ! Thanks for your help guys! Now on to analog inputs... He he he Eric

Share this post


Link to post
Share on other sites
Ok, I got the hardware side built and wired this weekend. Now I realize that my ladder is not working. I'm trying to control several sets of lights. One of the rungs uses a GRT and LES command (I've tried GEQ and LEQ) too and it's set to turn on output O:0/1 and uses the RTC:0.HR to energize the output from 14:00 to 22:00. The second run uses the GRT and LES setup like TWControls gave me so I can manually enter the minutes, i.e. turn on at 14:30 and off at 21:30. My issue comes up that it only lets me do one set of lights. Can you not use multiple rungs referencing the RTC? Thanks! Eric

Share this post


Link to post
Share on other sites
Should be able to make multiple refereces to RTC, if not then perhaps you can move the data from the RTC into an INT file at the start of the scan and then just reference the INT in subsequent rungs. Keep working at it, one of the best ways to learn.

Share this post


Link to post
Share on other sites
Well, I accidentally fixed it. Not sure how. I think it had to do with the fact that I had two rungs for the same output. I wanted one of the rungs to energize and output twice in one day (morning/evening) and maybe that's what was screwing it up. Anyway, here's some pictures of a prototype I made this weekend.

Share this post


Link to post
Share on other sites
This may work better for you, the clock time sets and unsets latched bits that then drive the outputs. This way you can easily build multiple time controls. Only possible problems is that a power failure during one of the switch times would leave the socket in its last state, until the next control time.

Share this post


Link to post
Share on other sites
Having the same output in two places can cause problems you were having. The way the scan cycle works input states are read, the program then executes sequentially, then the outputs are set. Whatever the last state computed for a given output is the one that shows up. For the most part other bits are modified as each rung is scanned.

Share this post


Link to post
Share on other sites
Eric Would you mind sharing the source of the enclosures shown in your photographs? Thanks

Share this post


Link to post
Share on other sites
You can see the Hoffman logo in one of the Photos.

Share this post


Link to post
Share on other sites
I've been all through the hoffman book and can't find them. I wouldn't use them for a control panel but they could make some nice looking demos. Anyone know the part numbers of these?

Share this post


Link to post
Share on other sites
Panel looks cool. Very neatly done, but I have to nitpick 24VDC control wires should be blue not red DC COM wires should be white/Blue not black

Share this post


Link to post
Share on other sites
Good work. How about a shot of the aquarium as well>>

Share this post


Link to post
Share on other sites
Start a GALLERY album and add your pictures in there.

Share this post


Link to post
Share on other sites
Where is the gallery at? I know you were adding it but did not know it was up

Share this post


Link to post
Share on other sites
Go here: http://forums.mrplc.com/index.php?act=module&module=gallery If you want to add a personal photo album to share with everyone, go to "My Controls" and add one in there. If you have a panel picture, just browse to that spot and upload a picture to the correct category.

Share this post


Link to post
Share on other sites
Ok, thanks. I didn't know it was up So does anyone know the part number of the panels?

Share this post


Link to post
Share on other sites
I think that this is the Hoffman catalog page. Looks like they are the QLINE D Polycarbonate and ABS enclosures. http://www.hoffmanonline.com/PDFCatalog/Sp...Guide/index.htm Select Chpt 6 from left menu, then Polycarbonate and ABS Enclosures. The relays look like Allen Bradley Cat # 700HK3Z24 (assuming that they are 24 vdc) with Relay base 700HN121. hoffman1.pdf hoffman2.pdf

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0