# Constant brightness headlights



## gunrunnerjohn (Nov 10, 2010)

I've always been annoyed that the headlights on my trains vary in brightness a bunch with the throttle setting, so today I set about fixing that. I just took and old shell that I had for a small switcher and altered it to fit my US Army switcher, since I'm still waiting on parts to fix the railing on that one. Here's the installation and the board, pretty simply constant current supply with a rectifier to generate DC from the A/C track voltage. It does really well from very slow speeds all the way up to full throttle. I suspect I'll hare to replicate this circuit for some other trains. I'm also considering a larger regulator to allow it to function with incandescent bulbs as well. This one is putting out 12.5 MA for the two LED's.


The actual circuit board.











A wider shot showing the A/C and D/C connections.











Here's my "connector" to allow me to remove the shell from the engine. I use IC sockets and plugs and cut them up, makes nice small connectors, and I have a ton of raw materials.











Here's the connection on the engine for the A/C input.











I pushed out the dummy headlight, then drilled the holes out for an exact pressure fit of the LED's, no glue required.











The rear light, same treatment.











The board installed in the front of the engine where there was some spare room.











Time for an "on-track" test!











Looking good coming and going, job done!












If anyone is interested, I can post a schematic, it's dirt simple, just a bridge rectifier, a resistor, a cap, and an LM117LZ regulator wired for a constant current output.


----------



## SkyArcher (Oct 20, 2010)

I'm interested, post the schematic, please.


----------



## erkenbrand (Dec 6, 2010)

That's really cool. I second that request for the schematic.


----------



## tjcruiser (Jan 10, 2010)

John,

That's fabulous ... and so tiny, too!

It'll likely be over my head, but I'd love to see a schematic, too. For us non-EE guys, can you offer a few comments of explanation, too? I.e. ...

My limited understanding is that a bridge rect alone would convert the AC to a DC (or nearly full DC) output stream. But you've added a "regulator" and some other bits, presumably to tighten up the variance/noise in the DC output. Can you elaborate here a bit, in layman's terms?

Thanks!

TJ


----------



## gunrunnerjohn (Nov 10, 2010)

Boy, here I thought nobody would be that interested. 

I'll gen up an "official" schematic.


----------



## gunrunnerjohn (Nov 10, 2010)

Before anyone asks, no it is not a mistake that the output comes from the adjustment terminal of the LM317. 

Obviously, you can also adapt this using a higher current LM117 for higher currents.


----------



## erkenbrand (Dec 6, 2010)

Thanks, John! That looks like a project I'm going to have to add to my ever growing list.  I feel Radio Shack calling . . .


----------



## gunrunnerjohn (Nov 10, 2010)

I got my parts at Digi-Key, I got 25 of the bridge rectifiers and 25 of the regulators, they were around $18. Radio Shack is an expensive place to buy stuff like this.

Part numbers: 

LM317LZ
DF005M

I had the capacitors and resistors already in quantity, so I didn't need those. Note that I socketed the resistor so I could change the value if I decided to later, once you figure it out, that wouldn't be necessary.

If was an easy thing to slap together, and I was curious if it would actually do the trick. Job done!


----------



## erkenbrand (Dec 6, 2010)

I'm pretty sure I have the caps and resistors too. I just have a problem with patience and end up paying the penalty at Radio Shack.

I might keep it under control today and concentrate on landscaping while waiting for the delivery from DigiKey.


----------



## gunrunnerjohn (Nov 10, 2010)

You'll be money ahead. For the price of a couple sets of parts, you can have a lifetime supply!


----------



## erkenbrand (Dec 6, 2010)

Yeah, I know, that's how I have the caps and resistors. Drawer after drawer of caps and resistors. 

I'll take your advice and go through our friends at DigiKey.


----------



## BNSF Fan (Feb 27, 2010)

How about that. Just this morning I was letting my Williams diesel get some run time since I got the bigger transformer and I realized that at the speeds I can run this, that the headlight is very dim. I was gonna post a question about it, but now see a fix. I am electronicaly challenged, and wouldn't attempt to mess with this for fear I'd end up blowing, or burning something up.  But it is good to see something can be done.


----------



## gunrunnerjohn (Nov 10, 2010)

It's actually very easy to build this, and you can test the little board directly on the transformer before sticking it in. If you're not so inclined, you don't need the little connector, that was just icing on the cake, and since I had the stuff to do it...

As I said before, you can also scale this up for more current, perhaps to run a 3V incandescent bulb at constant current, simply substitute the 1A regulator for the 100MA one I used here.


----------



## tjcruiser (Jan 10, 2010)

John,

Thanks for the schematic. Neat (and relatively simple) gizmo. Well done!

TJ


----------



## gunrunnerjohn (Nov 10, 2010)

I knew about using these regulators for constant current for many years, I just hit on the idea of a practical use for it in my trains.  It really is simple, and does the job.


----------



## T-Man (May 16, 2008)

John I like it. Right off I don't think I have used the LM317. Currently I am just usug a bridge, diodes and resistors for My LED head lights. They take so little power I don't notice any dimming. I really like the small size. That is cool. My first attempt at LED engine lights burned up over time. Adding the bridge helped, but this is very doable and small. Thanks! my education just uses the t -120 cases the 7812 and the 7805.


----------



## rayins (Dec 31, 2010)

John, Does this circuit produce much heat, my concern is plastic shell on some of my locomotives?


----------



## gunrunnerjohn (Nov 10, 2010)

Well, the jury is still out on my circuit. Works great on the bench, but I ran the engine for about 1/2 an hour, and it killed the LM317! I suspect I need transient protection. I added a 100 ohm resistor in front of the regulator, hoping the RC network would nail most of the big transients, but I may need a real choke of some kind of a Transient voltage suppression diode to really do the trick.

I'm curious about the bridge and the diodes, the bridge would give you DC, then a resistor would put the finishing touch on it.


----------



## gunrunnerjohn (Nov 10, 2010)

rayins said:


> John, Does this circuit produce much heat, my concern is plastic shell on some of my locomotives?


No heat of any kind that you can detect, it's only passing 12.5MA, do the math.  I just need to have better transient protection, especially with A/C motor engines.


----------



## rayins (Dec 31, 2010)

Thanks John,
I am not an electronics wizard so I don't know the math but I can follow the schematic. I enjoy trying these projects and will monitor this thread as I also have a number of engines with AC motors
Thanks again
Ray


----------



## T-Man (May 16, 2008)

I looking for the article all I could could find now was the 5 volt power source I used this in an HO engine once It should work on AC . It gives some of my sources too if you are interested. The power spikes on engines are a pain on HO with an Old Tyco transformer I could never get a simple lighting unless it had the regulator.


----------



## gunrunnerjohn (Nov 10, 2010)

I'll have to rethink my transient protection before I proceed. I'm going to test the resistor fix to see if that makes it work, but I have my doubts... I'll test the same little engine, since it killed the part the first time.


----------



## T-Man (May 16, 2008)

I do have dimmimg with the throttle. The 212 is just one LED with a lead off the e unit, a resistor, (750 ohms ?) and a diode off the short side and connected to the frame. The 2333 and the 600 MKT have the four diodes forming the bridge.

I checked the 212 and it died I have a bulb in the cab so I just didn't notice it burned out. So I will have to look into where I left off and see what I can find. Rob Paisley, and Bill Bowden have the best sites for diagrams on line.


----------



## gunrunnerjohn (Nov 10, 2010)

Doing the math, I don't see any way to make it better with the regulator. I'm thinking a Zener diode to drop it to 3-4V, then a small resistor, say 22 ohms. The resistor in front of the Zener diode would limit the current as well. This may be a more robust circuit than the regulator, I'll have to do a mock-up.


----------



## T-Man (May 16, 2008)

Not to let this subject die I found this info tucked away in my notes.
Bill Bowden LM 317t page.

I also have a uk site with grids and a voltage calculator.

I am looking at my old Peter THorne books and found the 5 volt supply. These are great and not expensive. The Electronic Projects for Model Railroaders, page 29 if you can view a portion of it on line.


----------



## gunrunnerjohn (Nov 10, 2010)

Well, the problem isn't the circuitry, but rather the spikes coming from the motor and E-Unit in A/C motor locos. As far as the UK site, you'll see his formula is exactly the same as the one I presented.

I'm ordering some Zener diodes to try an alternative circuit, they're a lot more "robust" and won't be nuked as easily by the spikes from the motor/e-unit.

FWIW, with the addition of a series resistor before the .1 cap, the circuit seems to work nearly as well, and so far it's still alive.


----------



## T-Man (May 16, 2008)

I found this about lighting a caboose. A Bob Nelson plan. It is nowhere near small, like yours. The spikes drove me crazy in HO engines. I gave up on LEDs and used incadescent rice bulbs. The engines didn't have the roo m fo rthe power supply/converter.


----------



## gunrunnerjohn (Nov 10, 2010)

Well, that's a picture of a trainset, so maybe you should post the real link you're talking about. 

I ordered the Zener diodes, I'll see if these work.


----------



## T-Man (May 16, 2008)

It was a nice trainset.
I corrected it.

I have used the 5 volt power supply from this site. Rollins.


----------



## gunrunnerjohn (Nov 10, 2010)

I'm trying to eliminate the regulator, they're too touchy about transient spikes. I've got some Zener diodes on the way, I'll see how that does.


----------

