Main > Main Forum
LED control idea
tetsujin:
--- Quote from: cholin on February 13, 2005, 10:27:16 pm ---I was going to connect them directly to the mircoswitches. For a switch to activate, you press the button right? So I will wire them to the button so when it's pressed, a circuit is complete, therefore, a LED will be lit.
--- End quote ---
That's not really a good way to think about how your encoder works, though. It doesn't detect a "closed circuit" so much as it detects a change in voltage level. Typically, the inputs will be on pull-up resistors that keep them at +5V, and that voltage will connect to the switch which leads to ground. When the circuit is closed, current will flow from +5V, through the pullup resistor, through the switch, to ground, and the current going through that resistor will be great enough that the voltage on the input pin will drop to zero.
If you put an LED in series with your switch, here's what will happen: When the switch closes, current will flow through the LED and resistor. This means that both the resistor and LED will have a voltage drop. So the voltage at the input will reflect the voltage across the LED. If it's only a volt or two that might be OK, depending on the circuit reading the input. If it's three, that might be enough for the encoder to think the input is still "high".
A better way would be to have another circuit which reads the same voltage as the input. One way to do this would be to wire the LED from the input, through a resistor to +5V. Then the LED will turn on when the voltage at the input goes low.
High School Physics classes sometimes have a good introduction to electrical circuits. Soak it up if you can.
And microswitches will have no problem passing a couple hundred mA. Typically they're rated for at least 1 amp.
cholin:
Heres what I came up with over the last few days, and I only understood half of what tetsujin said because, well, im an idiot in electronics.
Kremmit:
I'm a long way from being a transistors 'n diodes guru, but.. a microswitch has 3 terminals- NO, NC, and GND. If the I-Pac is connected to NO, then you ought to be able to build a circuit that will send power to the LED whenever the NC terminal opens. That way you don't have to worry about messing up your I-Pac inputs with your LED stuff. Won't work for leafswitches, though.
If I've got my head up Myanus (21st moon of the planet Uranus), feel free to tell me.
cholin:
What Im going to do, is connect the switches normally, there will be NO change to them at all. When you press the switch (NO I think) it will close. When a switch closes is when it will send the signal. Dont worry, I dont need advice on this becausse I drew up a circuit in Geography today and it should work, I just need to know how much power goes where and stuff like that.
ShinAce:
Kremmit, if the COM tab is connected to ground, that will work.
Ok, so now you've actually thought up a circuit. How are you going to switch between ALL ON and GAME?
You should just learn some digital electronics. www.allaboutcircuits.com . That way, you could use my initial suggestions of logic gates.