PLC Trainer: Mixing Tank Simulation

It’s been a while since I’ve made a ladder logic program. I decided to go back to the mixing tank simulation that seems to come up wherever I go to learn about ladder logic programming.

The machine adds two ingredients into a tank, and then stirs it all for 10 seconds. The mixture is dumped from the tank and the process can be started over. A toggle switch allows for the ratio of the two ingredients to be changed. The process can be stopped at any time, at which point the tank will be emptied. This is all shown in the video.

Some notes:

– Along with the stop button, an overflow situation will also throw the program into a fault. I didn’t program in any intentional overflows, though that was part of the original plan. While I was debugging, there were times when errors in my program got the ingredient valves stuck open and the imaginary tank would overflow. If there are any hidden bugs that come out later on, hopefully that will catch it.

– Something that I discovered that I guess I forgot from my lessons is that outputs in subroutines will remain the way they are even if the subroutine isn’t called…

– Any time an ingredient valve is open, a counter is increased by 1 every second.  Any time the empty valve is open, 1 is deducted from the same counter every second. The float switches are simulated using compare instructions that compare constant numbers to the accumulator value of the counter. It’s two seconds between each float switch, so a full tank (not an overflowing tank) would take 14 seconds from empty because there are 7 LEDs, or 7 float switches.

So that’s it! I didn’t think it would be done this quickly. It took about a day to complete, but that’s thanks to planning everything in a Word document first.

Mail time + Project Lineup!

I got a package today from Dipmicro. I’m going to show off the things in this small package and then go through all of the projects I’ve got planned. See if you can guess a project or two by the end of the pictures.
IMG_20140214_210811They were having a sale on Atmega328 chips so I had to pick one up. If things work out, I’d definitely get more to make more projects that can stand by themselves without the entire Arduino development board.
IMG_20140214_210907Some capacitors and an oscillator for the Atmega chip.IMG_20140214_210648The only buttons I had before were pulled from toys and things. I don’t have any left so I got some more.IMG_20140214_210701A sound module because I didn’t feel like building an amplifier for the mic I have.IMG_20140214_210715Some photoresistors…IMG_20140214_210955These parts have joined the pile of parts on my desk. This sight means I’ve got a project upcoming. In this case, I’ve got five projects!

Light Timer Modification [REVISIT]

The Light Timer project has been running fine. However, since I don’t use really any of the extra features, I’ve stripped it down to the bare minimum. I’m taking it to the real basics. The lights are not going to be on a timer anymore. Rather, they’ll use the photoresistor to sense the light level in the area and adjust the lighting accordingly.

– Real-time clock and Arduino Uno board will be stripped from the Light Timer project.

– It will run on a circuit built using the Atmega chip.

– It will now use a photo resistor for the logic in turning on and off the lights.

Light Nametag [NEW]

I plan too many projects that end up going to waste. I’d like to have projects that I leave around to showcase. That’s why I’m thinking simple for this and the next project. This project will likely be two LED-lit name tags… one for my real first name and an ASIMOWALK5 one. Simple. If the Light Timer Modification project goes well (if the standalone Atmega circuit works), I will set up the same circuit for the two nametags so I can have them doing patterns. If that doesn’t work, I’m still fine with them just being on all the time.

– Two nametags. One spelling my real first name. One spelling ASIMOWALK5. They will each be their own solid colors.

– Possibly controlled by an Atmega chip, depending on how the Light Timer Modification project goes.

Desk Light Package [NEW]

There was a time not too long ago when I wanted to turn my desk into one “big” light show programmed to music. I just want a basic lighting system now. My desk is more of a station with bookshelves and drawers. I plan on giving parts of the desk different colors. No programming here, just a simple on/off switch on the battery pack.

– Lighting package for all of the areas of my desk.

– No “brains” (controllers) behind it; Battery powered and turned on and off by a switch.

Animatronic Head [NEW]

This is the big project of this group of plans. I’m still going back and forth on the details, but basically I want to create an animatronic desk buddy…

– Head and facial features include: LED matrix eyes, LCD mouth, servos for neck (pan/tilt), 8ohm speaker for short audible feedback.

– Sensory features may include: Temperature/Humidity sensor, Real Time Clock, Light, Sound.

PLC Trainer Program [REVISIT]

The last project is to get me back to practicing my ladder logic programming. I will probably try my hand at another mixing tank program. I usually do a full write up of the scenario and layout the buttons and that sort of thing. It will be a while because this has the least priority, though I do want to make it ongoing while I work on other projects.

So that’s the plans I’ve got! I’m excited because even though the main project, the animatronic head, is somewhat ambitious, I’ve still got other smaller projects to keep me going. Stay tuned for updates!

PLC Trainer revisited: Addition complete!

Well, that took less time than I was expecting. I owe it all to my new soldering iron and helping hands which helped speed up that part of the build.

1This doesn’t look very different from the last time I touched the panel… which was a long time ago. It’s simple to just “click” the new output module on, as the name suggests. This PLC is branded as Click PLCs since the modules connect to each other by just snapping them onto each other without a backplane.2I used the 4 AAA battery holder to supply the power for the 8 LEDs. I don’t have a lot of useable cardboard around anymore so it came out really flimsy. I built it with a surface that big so that I could label each LED. 3Despite a weird brown piece of cardboard hanging off of the side now, I’m quite happy with how it turned out. It’s much better than my last attempt with random LEDs crapping out. The following is a short video of a lamp test. It came in handy this time as I had two of the LEDs swapped accidentally.

I’ll start programming some simulated processes now that the panel is at its full potential. Stay tuned for posts on that.

Before I end this, I thought I’d mention that I’m planning another Arduino project. I have no ideas yet, but I don’t like these parts just lying around.

Thanks for reading!

Only one LED was sacrificed

So I went ahead and tested the additional 8 LED outputs on a breadboard. The first problem I had was I accidentally had all of the LEDs reversed because I had made a mistake in the wiring and didn’t turn them around to reflect it. I’m still wrapping my head around the second issue, but I must have shorted an output branch somehow because one of the LEDs burned out and I was getting an insane current reading. I replaced the LED and did over the wiring for that branch and it worked as it should.IMG_20140206_105841The current readings check out fine. I’m getting about 11mA for each branch which makes sense ((4.8v-2.1v)/220Ω = ~12mA).

The next step is building a surface to put the LEDs on. Time to bring out the cardboard…

Battery pack care + PLC Trainer revisited

IMG_20140205_185252So I have a few of these battery holders laying around. The wires are not easy to work with because they’re all stranded wire. I’m usually plugging them into breadboards or female jumper wires so stranded wire just doesn’t work for me. I gathered them all up and decided to replace the wires for all three of them. IMG_20140205_205935It turned out well. I checked all of the connections using my multimeter.

I worked on these battery packs because I’m planning on revisiting the old PLC trainer. I want to bring back the additional 8 LEDs. It didn’t work out last time because I was using the same power supply for everything and I think it didn’t have enough current to drive the LEDs. This time I’ll be using a battery pack. If things go well, it shouldn’t take too long to complete. I’ll have more on this later. Stay tuned!

Back to school. Sort of.

I’m enrolled in the continuation of the Programmable Logic Controllers program at George Brown College (Toronto). This new program covers a newer system from Allen-Bradley, RSLogix5000. I’ve used it before when I was at Seneca, programming a CompactLogix PLC that was apparently sitting there for years unused until our section came along. It wasn’t even in the syllabus but I was lucky to have a good professor. I had completed the first PLC program (that covered RSLogix500 and SLC500) before I took that course at Seneca  so I found the Seneca course to be a little underwhelming and basic, but I got some good troubleshooting experience by helping out other people in the lab. Seeing as I felt that course to be basic, I was interested in doing this second program because I’m sure I missed out on a lot of things for this newer system.

I don’t have anything else to say, and I don’t have any of my own graphics for this post, so here’s a pretty picture from Wikipedia…… Bye.

English: This is a picture of one PLC or Progr...