Maker Pro
Maker Pro

LED Circuit Question

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
So how do we get over the possibility of both switches being activated at the same time?

The easiest way is to design the circuit so that pressing both switches will not cause a problem.

The solution is to place resistors in series with the switches (about 4K7) and increase the resistor joining the two inverters to around 100K, and to use schmitt trigger inverters (as I mentioned earlier)

I propose to add the flipper to divert the cars to the other lane. C and C2 are the 2 switches to operate the lights.

OK, so what operates the flipper, is it independent of this circuit, or does this circuit have to trigger it?

And to go a little further with the circuit -- you wouldn't use the inverters forming the bistable to drive LEDs directly as it would probably load down their outputs. As shown in one of my earlier diagrams, use another inverter as a buffer to drive the LED (there's 6 inverters in a package, so you have plenty to play with).

So, for the basic bistable and LED driver you need

1 x 40106
2 x switch (I presume this a is part of your track layout)
2 x 4k7 resistors
1 x 100k resistor
2 x 220R resistor*
2 x LED

* the 220R resistors are to limit the LED current. These may need to be different (these are "safe" values)
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Thanks Steve,

The flipper will be activated when the first switch is activated and is part of this "add on".

Once the flipper is made, it needs to be able to move, model railways use a similar system to set track points but I cant find specifically something to use. I've browsed maplin with no such luck.

So from the circuit we have so far, which 2 led are operated? IS it the 2 green entry/exit ones?
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
I have been sourcing parts from maplin online, the switches that would suit this would be NO micro-switches allowing the lever to make contact with part of the car as it passes. However I can only find SPDT micro-switches on the site.
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
So i drew this from memory, with you saying that there is a power supply inbetween the inverters, does it make this possible in a practical way?



$ 1 5.0E-6 10.20027730826997 52 5.0 50
R 160 144 160 96 0 0 40.0 5.0 0.0 0.0 0.5
s 160 144 160 192 0 1 true
w 160 192 160 240 0
w 160 240 240 240 0
I 240 240 304 240 0 0.5
I 304 240 368 240 0 0.5
w 160 240 160 288 0
g 160 352 160 416 0
w 368 240 368 304 0
162 368 304 368 368 1 2.1024259 1.0 0.0 0.0
g 368 368 368 416 0
w 240 240 240 176 0
s 160 288 160 352 0 1 true
w 368 176 240 176 0
r 304 240 304 288 0 100.0
r 880 48 864 48 0 100.0
w 160 352 304 352 0
162 304 288 304 352 1 2.1024259 1.0 0.0 0.0
r 368 176 368 240 0 100.0
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
No, like this (as I described)

$ 1 5.0E-6 0.12316236423470497 50 5.0 50
I 176 176 272 176 0 0.5
I 272 176 352 176 0 0.5
r 352 176 352 80 0 100000.0
w 352 80 176 80 0
w 176 80 176 176 0
R 16 16 16 32 0 0 40.0 5.0 0.0 0.0 0.5
w 16 16 128 16 0
r 128 32 128 80 0 4700.0
s 128 80 128 176 0 1 true
s 128 272 128 176 0 1 true
r 128 272 128 336 0 4700.0
g 128 336 128 352 0
w 176 176 128 176 0
w 128 16 128 32 0
I 352 176 432 176 0 0.5
w 128 16 432 16 0
g 432 336 432 352 0
I 352 224 432 224 0 0.5
w 352 176 352 224 0
162 432 224 432 272 1 2.1024259 1.0 0.0 0.0
162 432 112 432 176 1 2.1024259 0.0 1.0 0.0
r 432 272 432 336 0 220.0
r 432 16 432 112 0 220.0

Note that the simulation fails to work. I have no idea what a convergence error is.

NO microswitches or SPDT microswitches are OK (the latter have one set of NO contacts, and another set of NC contacts)

I can't really help you with the flipper. Since that is a core requirement, maybe you should figure out how to do this first?
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Hi steve,

I imported the circuit, deleted the input voltage and then inserted it again and the circuit worked!

I will have a word with the guys in maplins about the flipper and what I could use.

So now we have 2 LEDs working with the switches, i have added the other green LED and 2 other red LEDs. The diode helps keep the second green led on as required when the first swith is activated.

So if this looks ok, and you are happy could we use the feed to the red LEDs to feed a 555 timer for the blue flashers or am i getting a bit ahead of myself.


$ 1 5.0E-6 0.12316236423470497 50 5.0 50
I 176 256 272 256 0 0.5
I 272 256 352 256 0 0.5
r 352 256 352 160 0 100000.0
w 352 160 176 160 0
w 176 160 176 256 0
w 16 96 128 96 0
r 128 112 128 160 0 4700.0
s 128 160 128 256 0 1 true
s 128 352 128 256 0 1 true
r 128 352 128 416 0 4700.0
g 128 416 128 432 0
w 176 256 128 256 0
w 128 96 128 112 0
I 352 256 432 256 0 0.5
w 128 96 432 96 0
g 432 416 432 432 0
I 352 304 432 304 0 0.5
w 352 256 352 304 0
162 432 304 432 352 1 2.1024259 1.0 0.0 0.0
162 432 192 432 256 1 2.1024259 0.0 1.0 0.0
r 432 352 432 416 0 220.0
r 432 96 432 192 0 220.0
R 16 96 16 32 0 0 40.0 5.0 0.0 0.0 0.5
162 496 192 496 256 1 2.1024259 0.0 1.0 0.0
r 496 96 496 192 0 220.0
w 432 96 496 96 0
d 432 256 496 256 1 0.805904783
w 432 304 464 304 0
w 464 304 496 304 0
w 432 416 464 416 0
w 464 416 496 416 0
w 496 256 528 256 0
w 528 256 528 416 0
w 528 416 496 416 0
162 464 304 464 352 1 2.1024259 1.0 0.0 0.0
162 496 304 496 352 1 2.1024259 1.0 0.0 0.0
r 464 352 464 416 0 220.0
r 496 352 496 416 0 220.0
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Hi steve,

I imported the circuit, deleted the input voltage and then inserted it again and the circuit worked!

Yeah, well maybe I'd have to do that for your version below, because it had the same problem when I loaded it. Fortunately, for simple circuits like this I don't need the simulator :)

So now we have 2 LEDs working with the switches, i have added the other green LED and 2 other red LEDs. The diode helps keep the second green led on as required when the first swith is activated.

That diode will simply prevent the second LED from ever turning on. In addition, the inverters have a limited drive, and will simply not be able to provide sufficient current for 2 LEDs. You may be able to get away with placing 2 red or green LEDs in series (bur not blue)

You also seem to have extraneous connections going off the right of the simulator screen.

So if this looks ok, and you are happy could we use the feed to the red LEDs to feed a 555 timer for the blue flashers or am i getting a bit ahead of myself.

You're getting a little ahead of yourself.

You can't use the same inverter that is being used to drive the LED as the output voltage will sag. You need to use another inverter to buffer the output of the bistable (remember you have 6 to a package, so there's plenty of them available).

In addition, because of the same output drive issue, you can't power a 555 from the logic output.

But that's OK because there are easier ways :)

Let's just skip ahead a bit though... Once you have the bistable figured out you can use a much simpler oscillator.

One like this:

$ 1 5.0E-6 0.23009758908928252 89 5.0 50
I 192 208 320 208 0 0.5
c 192 208 192 304 0 1.0E-5 1.5212852784843263
g 192 304 192 336 0
r 192 144 320 144 0 10000.0
w 320 144 320 208 0
w 192 144 192 208 0
w 320 208 384 208 0

This DOES NOT simulate correctly because the device shown is an inverter not a schmitt trigger, however it is a very simple oscillator that will suit your purposes nicely. Because of the simplicity, you can have multiple oscillators if you like, so the flashing of LEDs and the counter can be happening at different rates.

How we stop and start this oscillator is something we'll come back to later...

Perhaps we should consider how to turn the LEDs on and off. At the moment we've been using inverters, but they are not the greatest because they have very limited output current. What you need is something that can drive several LEDs.

$ 1 5.0E-6 0.23009758908928252 89 5.0 50
I 192 208 320 208 0 0.5
c 192 208 192 304 0 1.0E-5 1.5212852784843263
g 192 304 192 336 0
r 192 144 320 144 0 10000.0
w 320 144 320 208 0
w 192 144 192 208 0
w 320 208 384 208 0

That will do it. The resistor values are not appropriate, but it illustrates what happens. Click on the H/L to change the state.

I think we need to have an additional module:

1) bistable
2) LED driver(s)
3) oscillator(s)
4) counter

both the bistable and one of the oscillators will need a LED driver to turn on LEDs. The LED driver is capable of driving other things too, perhaps the flipper can be controlled by one of these (with some slight modifications)

So we can simplify the bistable to look more like this (without the LEDs)

$ 1 5.0E-6 0.12316236423470497 50 5.0 50
I 160 224 256 224 0 0.5
I 256 224 336 224 0 0.5
r 336 224 336 128 0 100000.0
w 336 128 160 128 0
w 160 128 160 224 0
w 0 64 112 64 0
r 112 80 112 128 0 4700.0
s 112 128 112 224 0 1 true
s 112 320 112 224 0 1 true
r 112 320 112 384 0 4700.0
g 112 384 112 400 0
w 160 224 112 224 0
w 112 64 112 80 0
I 336 224 416 224 0 0.5
I 336 272 416 272 0 0.5
w 336 224 336 272 0
R 0 64 0 0 0 0 40.0 5.0 0.0 0.0 0.5
w 416 272 416 224 0
w 416 224 448 224 0
I 256 272 320 272 0 0.5
I 256 320 320 320 0 0.5
w 256 224 256 272 0
w 256 272 256 320 0
w 320 272 320 320 0
w 320 320 448 320 0
M 464 224 480 224 0 2.5
M 464 320 480 320 0 2.5
w 448 224 464 224 0
w 448 320 464 320 0

Note that I have paralleled 2 gates for each of the outputs -- that increases their drive capabilities. The use of all 6 gates means this part of the circuit use exactly 1 package, so it is a little easier to construct. It may be a little wasteful of gates, but it means you can create a list of components and place them to one side.

Do you understand how it operates?

Do you think you can find the datasheet on a 40106 and work out how you'd wire this up?
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Thanks again Steve,

Ive found data sheets but there are alot of variants with all sorts of different letters and dont want to get the wrong one. I was trying to find the CMOS 40106 at maplin but the closest I can find is the 40107. I shall be sourcing all parts from them.

I do understand to some extent what is happening. If we can identify a specific make/part number from maplin and get the data sheet I can then draw the schematic with the ic in place.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Gee Maplin are expensive! A 40107 is totally the wrong part.

look for 40106 or 74C14 74HC14 or 14584 or 4584. Make sure the description says something like "Hex Schmitt trigger inverter".

Not sure what the pound is worth at the moment, but I'd be looking at paying no more than about $US0.50c per item.

All the other letters can pretty much be ignored. so a CD40106BCN, or an MC74HC14ANG is fine :) Just make sure that the item is "through hole" or "DIL", not surface mount.

Note that for the 74xxxx chips, the letters in the middle ARE important. 74C14 or 74HC14 are fine, 74AC14, 74HCT14, etc are NOT.

Maybe you should post a question asking where people located near you buy components. I don't think Maplin are a great choice

This seems like a better price.
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Only reason I shall be using Maplin is because there is one close by and ive used them before for bits and bobs.

I had a look through the website and found what we are looking for i think.

Heres the link:

http://www.maplin.co.uk/module.aspx?moduleno=19100

Heres the datasheet i think):

http://www.nxp.com/documents/data_sheet/74HC_HCT14.pdf

I had a go at drawing the schematic as best as i could, does it look anything like what we should have upto now?

untitledDDDDD.jpg


I labeled the schematic you posted and went from there;

untitledasa.jpg
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
The 74HC14 is in the list on the bottom of the page, but not in the selection box. You may have to call them to see if they actually have them in stock.

If you can get away without postage then it's probably not such a poor deal.
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Il pop in and ask them if I can get exactly what I need, The parts are not too expensive and im not bothered about a few pence saving from somewhere else, they would probably order me one to pick up in store i think.

Did the schematic I posted look ok Steve?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Yes, I was going to suggest the 74C926. They're technically obsolete, and some people wast around $20 each, but there is a guy on eBay selling 2 at a time for $3.50 plus quite reasonable postage (OK, can't see him any more, but there is someone else selling them with a starting price of $0.99.

Grab 2 of them just in case you blow one up :)

Also please remember that these CMOS ICs (74HCxxx, 74Cxxx, 40xxx) are static sensitive and you shouldn't be handling them without taking anti-static precautions.
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Ok il try and get a hold of a couple, just in case lol.

If the schematic of what drives the LEDs is ok, I need to ensure the 2nd green LED stays on when the 1st switch is activated.

Once that is done, we can move to the flashing blue lights and start to piece everything together cant we?

I have an old RC helicopter with servos attached, i thought i could use one to build my flipper.
 
Last edited:

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Been looking all over for the mm74c926 to see if i could find it cheaper in the uk,

Is there an alternative ic that could be used. I found a data sheet and i can buy direct from the manufacturer (fairchild semiconductrs) for 16 dollars.If I could find a cheaper alternative, that would be great.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Like I said. Look on ebay. You'll be able to get them for a couple of dollars plus freight.
 

kris8583

Aug 25, 2010
23
Joined
Aug 25, 2010
Messages
23
Thanks steve, gonna have a bid on a couple,

Did the schematic look ok from my previous post for the light circuit?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Yes, although pretty much everything to the left of the 74c926 in that diagram will be replaced with something different :)

edit: Oh, and there's no real reason you have to have all 4 digits. You can use less if you wish to.
 
Top