Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Need some help...

Status
Not open for further replies.

Garry2005

New Member
I've got an application where I need a low-cost (reasonably uncomplicated) triggered latch circuit for turning on LED's (each one discrete) and holding them on until I turn them off. In simplest terms: I press a momentary switch and the LED comes on and stays on until I press the switch again, then stays off until I press the switch again...a toggle. Thing is, I need to do a number of these (like 30 or so of them) where a certain LED stays on (or off) until that switch is hit again. I've got a small board all set up, with a clock, so I'm all set for just about any approach. Should I be thinking flip-flops? Latches? Does anyone have a simple circuit that might work for this? If so, maybe something with quad inputs/outputs so I don't end up with a hundred IC's. I'm toying with the idea of a PIC microcontroller, but I've never played with them, and I can't see how it would, for example, hold a particular state for so many LED's independently. If anyone's interested in what the project is, email me direct and I'll be glad to fill in the gaps.

Thanks in advance for any help you folks may come up with.

Garry (garry@jetcoder.com)
 
A microcontroller would probably be the smallest and easiest solution.

You biggest requirement is pin number. 2 40 pin microcontrollers is probably the simplest way. There are ways you could do this with fewer pins but they might be a bit complicated for a beginner.

I can't see how it would, for example, hold a particular state for so many LED's independently.

Its actually a lot easier than you would think. A simple software loop would give you a decent timer. You just need one byte for each LED. The byte stores how long the LED has left to stay on. Each time the loop executes you subtract one from each byte. If the byte equals 0 then the LED should be turned off. If a button is pressed you load the byte with the time you want it to stay on and turn on the LED. Even very small microcontrollers will have more than 30 bytes for storing data.
 
looks like a D-latch would work (just looking at this truth table here) https://www.asic-world.com/digital/seq4.html You have to take into account switch debouncing as well. (mechanical oscilations in the switch will cause the ic to behave irratically.)

Now if you wanted to use a PIC, you would have the option to configure which LED would turn on when a certain switch is pressed in the software itself. I had a good pdf file with a schematic that explained it pretty well but I cant find it. Basically you use a bunch of shift registers to expand the I/O ports. Hopefully someone else can fill this in
 
An easier solution would be to use push on/push off push botton switches
 
Latching project...

Okay, guys...thanks for the input, and it'll probably help if I just outline the basic project. What I'm doing is creating a real-time "cockpit" that works in conjunction with MS-Flight Simulator 2004...the goal is to move as much functionality as possible away from the keyboard/mouse and out to the real world...switches, levers, buttons, knobs...things a real pilot would have to do. A typical scenario, for example, is raising/lowering the landing gear. With the Flight Simulator program, you mouse-click the gear handle and the landing gear comes up or goes down, and the appropriate indicators show you the status. With my project, there's a real gear handle that trips microswitches, and there'll be LED's on the real control panel (dashboard?). I've gathered most of the control-codes for the various functions for different aircraft, and my intent was hard-wire the "switching" into a keyboard decoder, to replicate what you'd do with the keyboard...(which works fine when I hot-wire the keyboard and do them singly). The mechanics are all done...throttle quadrant, control yoke, rudder pedals and toe brakes. Now I gotta tackle the smart-part...making those manual functions "talk" to the Flight Simulator program, and then lighting up the appropriate LED's. If you imagine a real "flight trainer" with manual everything, versus a PC program with mouse & keyboard, that's what I'm doing. Maybe this microcontroller thing is the way to go...it might make more sense than my approach with paralleling keybaord functions, and in firing the right LED's for the right action.

Anyway, that's what this madness is all about, and it's the "funnest" project I've ever tackled! I'm an engineer, by the way...I own Jetcoder International (we design/develop commercial inkjet printing systems) so I'm not new to technical stuff...I'm just looking for the most practical way to approach with this. If one of you smarties out there wants to get involved, let me know: I have a spreadsheet of the various functions and control-codes for each, and I'd more than welcome a brainiac or two onboard! I've also got a bunch of pix of the mechanical stuff during development, so you can see what gets fired and how.

That's it...Again, thanks for your input.

Garry
 
RE: K7elp60

I'm from the old school and tend to agree with you about discrete electronics. However, I can't conjure up a practical way how a push-on/push-off toggle switch would work for this: The switching for each function (raise/lower the gear, turn the magnetos on/off, set the navigation equipment to GPS or NAV, etc) goes to a keybaord decoder, and a locked toggle-switch would have the same effect as if I held down the "G" key on the keyboard...that's why momentary is needed. But I'm wrong in that, though, because really what's needed is one-shot (hit the keyboard decoder matrix and latch the LED into an opposing state...if it's on turn it off, if it's off turn it on, etc). So I guess it could be done with just hardware, but that's a lot of hardware...there are quite a few of these different "functions" to perform. Plus, with just hardware, I'd need TWO one-shot circuits for every function...one for ON and one for OFF.

Maybe I'm seeing the forest instead of the tree, though...do you have some actual ideas in mind that might work?

Garry
(garry@jetcoder.com)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top