# LED as Indicator...Multi State

Discussion in 'The Projects Forum' started by dledge, Nov 30, 2014.

1. ### dledge Thread Starter Member

Feb 11, 2014
60
1
I'm creating a logic circuit to manage the position of a door which is controlled by a DC motor.

I'm attempting to utilize a 555 chip along with an "OR" logic chip to make use of an LED as an error indicator.

1. Solid Light - Door is closed.
a. Door is in transit
b. System is operating on back-up power

The LED is connected to a Logic OR gate.
(1) is feed into the OR logic gate as one of the two inputs.
(2a) is managed by feeding a signal into a 555 chip which then outputs to the OR logic gate
(2b) I cannot figure out how to get 2b to work.

I'm thinking I need to feed the source signal from 2a and 2b into another OR logic gate, the output of which would feed itno the 555; however, the back-up power signal would be 9vdc (logic gates are only expecting 5vdc). I'm reluctant to use a voltage divider, as that could flucuate too much and I don't have room for another voltage regulator.

2. ### Retiredguy Member

Feb 24, 2007
28
5
Dledge,
To solve your voltage issues, just go with CMOS chips to do your logic. They work between 3 and 15 volt so you could just have the system work off 9 volts instead of 5. You can also get 555's in CMOS as well

3. ### Bernard AAC Fanatic!

Aug 7, 2008
4,532
476
A quick sketch: SW-A NC when door fully open, SW-B NO whed door is open or in transition. AS shown door is fully closed. Power is supplied to ckt; if power supply A, 10V, is present & Battery is connected then NAND A out is low, inverted by NAND -B, output high, both inputs to NAND -C high, output low. Low on 555 reset = LED on steady. Any condition to change on inputs to NAND & reset goes high = LED blinks if Vdd present.

File size:
140.5 KB
Views:
43
4. ### dledge Thread Starter Member

Feb 11, 2014
60
1
Well...that would almost be too easy. I had no idea.

May I assume the logic would operate as expected if the voltage hitting one input was 3-5 vdc and the other input was seeing 9-12vdc? If this was an AND gate, would the result be True?

5. ### Alec_t AAC Fanatic!

Sep 17, 2013
7,021
1,453
Why aren't your main and backup supply voltages the same?

6. ### dledge Thread Starter Member

Feb 11, 2014
60
1
The inputs are:
• 12VDC (main power is on)
• Logic voltage (Door Closed)
• Logic voltage (Door not closed AND door not in expected position)
Light is connected to a 5vdc logic gate via a transistor.
OR Logic gate currently sees output from 555 chip (error), and Reed switch (door closed)

I would like to add additional logic so that IF the system is running on backup power, the light continues to blink.

I can derive the logic necessary, but I was concerned about running a 12vdc input along with a 5dc input into a logic gate.

7. ### Alec_t AAC Fanatic!

Sep 17, 2013
7,021
1,453
You didn't answer my post #5 question.
Why use the 5V? The 555 and CMOS logic will work happily up to 12V. See Retiredguy's post #2.

8. ### Bernard AAC Fanatic!

Aug 7, 2008
4,532
476
LED blinks when on Battery, post # 3. Main supply slightly higher than Battery allows OR'ing of power, post #3.
If you insist on using 5 V logic, V dividers can adjust input levels. On 12 V, logic 0 might be a 1 on 3-5 V logic.

9. ### dledge Thread Starter Member

Feb 11, 2014
60
1
I've made the switch to 12V logic and CMOS chips. What I am wondering now, any issue with continuing to use the 2N2222 transistors? I ask because the Base voltage will be 12V rather than 5V.

10. ### Alec_t AAC Fanatic!

Sep 17, 2013
7,021
1,453
Which 2N222 transistors? You haven't posted a schematic of your circuit .

11. ### dledge Thread Starter Member

Feb 11, 2014
60
1
Ah, you're right...I'll try this again.

This circuit moves a door to either an Open or Closed position based on environmental conditions.

The circuit has the following main sections:
• Power - regulated to 12V with a battery backup
• Logic - Consumes inputs from the 'real' world and derives correct logical state
• Motor - HBridge run by two relays that are activated by transistors
• Status - External LED light circuit (blinks when on backup power OR door position does not match logic...Solid when door position is closed)

The logic circuit is working great. Where I am running into some confusion, is when I move from the digital to the analog. I recently changed the entire circuit:
FROM 5vdc for the logic and 12vdc for the motor
TO 12vdc for everything

Running 5vdc into the base of a transistor is no issue. I've no idea if running 12vdc into the base will cause any issues. I've been reading up on transistor saturation, resistors, etc...but to be honest, its making my eyes cross a bit.

Do I need to get different transistors? Do I need to put in a voltage divider for each transistor? Something else I'm missing?

This is the first real circuit that I've designed in the last 20 years. I'm really rusty.

File size:
30 KB
Views:
29
12. ### eetech00 Active Member

Jun 8, 2013
815
148
Hmmm, questions...

1. No primary 12v regulator?
2. Why five 100uf caps?
3. LED D5 resistor looks low for 20ma(?) LED.
4. 2N2222 can drive 12v@16ma (750 ohm) Relay OK. Adjust base resistor.

eT

13. ### dledge Thread Starter Member

Feb 11, 2014
60
1
1. There is a primary 12v regulator. Both the plug in source and battery backup run through this. The LED bypasses this, as does one of the logic inputs so that I can have an external indication if the system is running on backup power.

2. I read that you cannot have too many caps. On the PCB, I put one cap next to the motor to handle the initial load. I put two caps next to the fuse where the power first hits the power layer. I put two caps next to the external inputs to handle the extra draw these may have.

3. What do you think it should be? I received this value using an online calculator.

4. To confirm...the 2N2222 can handle 12v into the BASE of the transistor? How should I adjust the base resistor? This is where I get really fuzzy.

14. ### eetech00 Active Member

Jun 8, 2013
815
148
Ok...didn't see that but will take a closer look.

How big is this board? Unless there are really long power supply traces, a single 470uf in parallel with a 0.1uf cap should be OK. You'll also need bypass caps ( 0.1uf) as close as possible at all IC +supply pins.

The resistor value depends on the recommended operating forward voltage and forward current of the LED.
For most low voltage/low power LEDS vfwd=2v and Ifwd=20mA but need to look up in datasheet.

Example:
Rt = 18/0.020 = 900 ohms
R = 900-(2.0/0.020) = 800 ohms
Rpwr = (18-2)*0.20 = 0.32 watts

Closest value to 800 ohms is 820 ohms, so need 820 ohm, .5 watt resistor (will be warm so maybe .75 watt, or, 1 watt)

Vb = 12
Vbe = .7
Ib = 0.0013

Rb = (Vb - Vbe)/Ib = (12.0 - 0.7)/ 0.0013 = 8692.308 ohms.

Next best standard value to 8692.3 is 8.2k (allows a few more uA's, but that's ok)
Also add an 82k resistor from base to ground to be sure transistor(s) turns off.

eT

15. ### dledge Thread Starter Member

Feb 11, 2014
60
1

This is fantastic information!!! Thank you very much.

I'm attaching the PCB schematic. I do have caps next to each IC (except for the 555timer). In regards to the external signals, I won't know how long those leads will be until the units are built, but they could be several feet.

For the pull down resistor on the transistors (base to ground), I've been using 10K pull down/up resistors everywhere else. Did you mean to say 8.2K or 82K? 82K seems like a huge resistor.

File size:
18.6 KB
Views:
26
16. ### eetech00 Active Member

Jun 8, 2013
815
148
I can't tell the PCB size but looks fairly small. I don't think you need to place big caps
all over the board. But...put a bypass cap at the 555 timer supply pin as well.

It should be 82k (approximately 10x the base resistor)
Also...with the base resistor value, the transistor can drive a little more than 100mA.

eT

Last edited: Dec 28, 2014