Constant current lighting for model trains

I had a lot of old style passenger carriers in my HO collection and i wanted to add LED lighting to them. So i quickly threw in a Schottky diode bridge, followed by a 470uf capacitor to convert the pulsing DC to DC. The 470uf cap should help over dirty tracks. Most of LEDs were the 0603 or 0805 SMD type. So i used 1k-ohm to drop the current to about 12/1k = 12mA.

However during running, there was constant flickering of the LED. Initially i wondered if the capacitor was not sufficient. Then it hit me. LED’s are primarily current driven. It means, you can actually apply 110v DC across an LED, just as long you can maintain its forward current to be within limits.

See what happens here is that we have a series circuit involving a resistor and an LED. Say over a dirty track, the power connection is lost for a brief moment. The capacitor can supply the current. However its voltage will dip slightly. Now the resistor is a voltage controlled device with its current I = V/R. So as V drops, I drops. And the LED dims. when the carriage again connects with power, current increases, LED brightens: It flickers.

The flickering was too annoying and i wanted the carriages to have the same constant brightness. So i was looking for a device that could maintain the same current (I) even with voltage variations. So you’ll need a Mosfet to that.  I came across this great current regulator from NXP, available from Digikey :  PSSI2021SAY. This tiny little Mosfet can regulate current up-to 50mA, for voltages up-to 75V. This fits the bill. It is about $0.50 for quantities of 10+.

So i pulled up EagleCAD, got a quick board layout done and sent it off to OSHW for pcb prototyping. Back in about 3 weeks and assembled, the board under a magnifying loupe.

The board is really tiny. About 0.25″x0.25″. All you need are 2 components. The PSSI2021SAY device and a resistor to determine the current setting. I chose about 7ma. The foot-prints are small, but the soldering is not that bad. Total cost?

Board = $0.50, PSSI2012SAY = $0.75, Resistor = $0.10. Thats less than 2 dollars. Of-course not counting the time and soldering work needed.


Then I test-rigged it with the LED strip. Success!. I put the strip back into the carriage. Ran it on the tracks. No flickering. No dimming. Great lighting!.


Moral of the story? : While using just a bridge and a capacitor and series resistor might be okay for lighting, go one step further and get a constant current regulator. It does not cost that much, but it makes your lighting much more prototypical.

Tagged with: , ,
Posted in Electronics, Model trains, Uncategorized

DSM2 Antenna mod for turnigy 9x radio

I have a turnigy9x radio that came with a 2.4Ghz module. However i also had some DSM2 receivers (Orange rx) that i wanted to use. I came across lots of posts that describe the process of adding a DSM2 module to the 9x radio. But not of them had a way of using both the antennas in a pleasing way. So if you are looking to use both the existing 2.4ghz radio module and the DSM2 module, read up.

So here’s what you need (or similar)

  • Turnigy 9x Radio
  • DSM2 module (I got mine from a HP6DSM radio)
  • Two 2.4Ghz antennas (I got mine here from HK)
  • Two Right angle SMA female connectors (I got them from Ebay)
  • Two PCB strips that connect the SMA connectors to the back of the TX (Gerbers attached)
  • 3.3v UBEC (it was cheap here at HK)
  • 50ohm Co-ax wire for antenna connections


With the 2 antennas bent, that’s how the modified TX looks.

The interior of the Turnigy 9X radio with the DSM2 module secured and the 3.3v UBEC wired in.

The black spots on the wire are the ‘liquid tape’ from Home-Depot.

The power is switched manually between the DSM2 module and the Turnigy module. The switch is at the back of the TX.


Close-up of the SMA connector and the PCB-board. I used OSH-Park for the PCB service.  The screws are 2mm socket head.


Finished TX. The switch at the back right above the Turnigy TX module controls the power to the DSM2 or the turnigy module.



Some links that help in adding the DSM2 module to the turnigy 9X radio.




Tagged with: , ,
Posted in Electronics, r/c

USBASP & AVRDUDE: Reading fuse bits

Recently the USBASP programmer has become a hot favorite to program AVR chips. It is small, inexpensive and works great with avrdude.

I was recently working with an RC brushless speed controller (ESC) and wanted to read the fuse values of the on-board Atmega8L chip. After running through some iterations i got it working. Here it is

avrdude.exe -c usbasp -p m8 -U lfuse:r:low_fuse_val.hex:h -U hfuse:r:high_fuse_val.hex:h

-c usbasp : Is the USBASP programmer. You do not need to mention the port to be USB. Seems like avrdude picks the programmer up without that info

-p m8 : The atmel device. In my case it was an Atmega8.

-U lfuse:r:low_fuse_val.hex:h

Here, ‘lfuse’ is a keyword that lower fuse byte is being accessed. Other keywords are ‘efuse’, ‘hfuse’, ‘flash’

‘r’ indicates that a read is being performed.

low_fuse_val.hex is just a name of a file into which the lower fuse byte will be written

‘h’ indicates that value will be in raw hex format. ‘i’ gives you the intel-hex format.

Tagged with: , ,
Posted in Electronics, r/c

Complete remotoring of kleinbahn krokodil loco

I recently came across KleinBahn locomotives on Ebay. Never heard of them until then. Apparently they are a small local model train seller in Austria that makes Austrian/German? model trains. The general consensus was that the locos are good, but detailing is not like in Roco or Fleischmann.

So i grabbed some Kleinbahn locomotives from Ebay when i found a good deal. One of them was the famous “Krokodil” electric locomotive. The loco was in decent shape, but had trouble running when i powered it. As usual, my goal was to update it by adding LED lighting and a decoder.

Here’s what i found when i removed the loco shell.


I took this photo after some mods (like LED lighting) and milling out the middle area. But what immediately struck me were the 2 motors that independently drove the two trucks. The wheel arrangement was 0-6-0.

The drive mechanism was worm wheel, but with a twist !!. The worm was basically a spring mounted on the 3mm dia shaft of the motor(s).

LED lighting was going to be a breeze because the loco was big and secondly it used light pipes. So all i needed were 2 sets of RED and white LED diodes to do the job.

However the bigger problem was on the decoder side. There were 2 motors that needed to be driven. Each of these motors had a stall current of approx 1Amp. Higher than the rating of the ESU basic (700mA stall), my favorite decoder. So i would need 2 decoders, one for each motor. Then programming the decoders would become a slightly more complicated task of having to set them to behave as a consist. Also, this loco did not have a flywheel, something that i think gives good prototypical behavior in a model trains. And finally, the motors were 3 pole armatures. The newer 5pole armature motors are much more smoother.

So i made my decision. I would replace this 2 motor independent truck drive system with a single 5-pole skewed-armature can motor, using shafts to drive the truck assembly.

So i had solve some problems during this conversion.The big ones were.

1: I could not find any plastic worm gears to engage the spur gear on the truck. And i did not want to change the gearing on the truck. That meant i had to use the existing ‘spring’ based worm gear. So i had to make a bearing blocks to replace the existing motors.

2: The loco body shell secures to the chassis via a long screw that screws into a bolt hole on the chassis(next to the V in the above photo). My by new plan involves putting a motor in that area. So i had to figure out a new way to secure the body shell to the chassis.

So first i decided to make a bearing block that mimics the existing motor to mount the ‘spring’ worm. Here’s the existing motor with the spring worm removed. A good tug on the spring with a noseplier did the job. I was amazed at the quality of the motor. It was extremely well constructed. I hated replacing such a fine motor from the loco…


And here’s the bearing block i milled from some acrylic sheets i had. I wanted a 1/2″ thick sheet, but had only 1/4″ thick ones. So i superglued 2 sheets together. The result was quite good. A sharp HSS endmill cuts through the acrylic like butter. It was a dream to machine this plastic. Just make sure that the bits are sharp. Or else the plastic could melt.


I also installed a 3mm ID bearings that would support a 3mm shaft. The height of the shaft from the base matches the existing motor. The blue color you see is the marking dye. The screw hole at the bottom of the block secures the block to the truck, just like the motor. I made 2 such blocks, one for each truck.

Here you can see how the bearing block fits in place of the motor. I also milled about 0.1″ at the base area so that motor would not touch the roof of the loco shell.


A close up shot of the Truck/bearing block assembly. The bearing block also links the base of the loco to the truck.


Next step was to secure the motor to the base. So i made a motor mounting block from a 1/4″ scrap aluminum piece. I also had to turn down the heads of the M2 securing screws so that they would not contact the flywheel that would be fitted there. The motor was a great deal from Ebay. A 5 pole, skewed armature motor that draws about 500mA stall current. I was too lazy to clean up the blue marking dye.


So here’s the flywheel press fitted to the motor. I ended up making my own flywheel on my mini-lathe because i had some scrap brass rod pieces. Size is 17mmx11mm. The most frustrating part about making a flywheel with a Chinese lathe is to make sure it is concentric. Otherwise the whole loco is going to wobble like crazy @11000rpm of the motor!

Mine was good. Not as good as an NWSL flywheel, but definitely did not have vibrations at the full RPM rating. Thats a good sign.


Next, the ‘spring’ worms were fitted on 3mm shafts (from McMaster). I used nylon washers on either ends of the bearing blocks and finally the assembly was secured along the shaft axis by using E-clips. At the opposite end of the worm was an NWSL 2.0 universal joint assembly. This was a great U-joint coupler system. Affordable, strong and small for a HO scale. The motor was secured to the base of the loco with 2 screws mounting from under the base, securing to the motor mount block.

The little assembly on top the motor  addressess one of my original issues on how to secure the shell to the chassis. The cylinder at the top is a spacer nut tapped with #2-56 threads. This nut connects to the motor block. The shell has a securing screw hole on the roof that allows the shell to be secured to the chassis.


Closeup the of the motor block, the bearing block and the couplers.


Skipping some steps, here’s a photo with the DCC decoder and lighting block. The decoder is an ESU basic decoder. I never connect the decoder wires directly to the motor, tracks or lights. Instead i make a connection PCB which in turn connects to the tracks, motors and the LED’s. The LED’s used were 0603.


A closeup shot of the LED’s. The resistor is a 0805 1K.


Closeup of the decoder wiring. I used the thin 0.5mm ESU wires for wiring. They are amazing!!

Again, the black stuff you see is the liquid-tape from home-depot. Used as a glue to secure wires to the frame. The best part is that bond is not very strong. So if rework is needed, take a toothpick to peel the layer off.


Another shot of the assembled loco. This then got tested on the track. It runs good, albeit with some higher noise. I guess it is the extra rotary contacts like the bearing blocks. Next time i think i’ll use Acetal bushings instead of metal bearings. Less noise.


Another shot. I left the marking dye as a reminder to myself on the work it took to remotor this loco.


The final assembled loco. It looks great !!


Running test while pulling a lighted passenger car….


Tagged with: , , , ,
Posted in Metalworking, Model trains

The best fine gauge stranded wire you can get!

Having a fine gauge wire is really important with HO scale and finer gauge model railways. These locomotives are small and you really don’t want the wires to be the show stoppers to finishing your models.

In the past i have used 32Awg servo wire from Hobbyking. These were very good. Very flexible and quite thin compared to the others i was using at the time. Then i ran into the really tiny European locomotives. While modding these locos, i ran into a wall with the wiring as there was absolutely no space in the loco for my 32awg wires!

Then i decided to try the Kynar single strand wire from my local Fry’s. While this wire was really thin (40awg i think), it was only a single strand. That meant that the wire was not at all flexible and broke easily. Also, it could not carry more than 500mA.

That is when i ran into these. They are 36awg multi-strand wires from ESU used for their decoders. I bought 6 colors and boy am i happy. Awesome wires !!. Quite flexible, insulation does not melt with heat and can carry up to 2Amps! I have used these wires for my other electronics projects too.I am a happy camper.


Posted in Electronics

Roco BR118 remotoring + dcc

This documents my re-motoring and DCC mod of my Roco BR118 loco. This was an older loco that came with a great Roco motor. However there were 2 issues.

1: The motor’s stall current was about 1amp

2: The loco did not have any flywheels.

At my disposal were couple of ESU basic DCC decoders that i wanted to use. Their Max current rating was about 700ma. I also wanted to add in a flywheel. So i decided to replace the stock motor with a smaller can motor from Igarashi with skewed armature.

This loco also had a peculiar spring type coupling and not cardan shafts like in the newer models. Here’s a close up shot of the spring coupling (after the modification).

This type of coupling seems to be great when the distance between the motor and truck assembly is small.


The partly assembled chassis with a custom made PCB. The 2 smaller boards at the right and left of the main board carry the 0603 LED’s. This loco uses light pipes.


Closeup of the ESU decoder and the LED board. No more NEM connector after the i discovered the issues with capacitive coupling with my home made PCB’s. So the decoder is directly soldered to the PCB. Again, liberal use of the liquid tape to secure the wires.


The final assembled loco.

This is a great looking locomotive. It runs great, except for a slightly higher noise from the spring coupling.


Tagged with: , ,
Posted in Electronics, Model trains

Diy pinata ??

It is not always model trains and electronics for me. Here’s another project that i made for my 4 year old daughter for her birthday.Yup, she’s into princesses, ponies and the only 2 colors she knows are pink and purple!


This project was not so hard once you have hot glue gun, some tape, paint, some old boxes, wrapping paper and about 2 hours of time.

The 2 floors are made of 2 mail boxes that were lying in my garage. I wrapped them with pink wrapping paper from the ‘dollar tree’ store. Then i drew in the bricks and painted the windows. For the towers, i rolled some cardboard into a cylinder wrapped them and painted them. For the tower roofs, circle cut cardboard made into a cone and hot glued to the towers. The 2 floors are not stuck to each other. The top floor can be removed, revealing a space inside the bottom cardboard box to add candies and other goodies.

For decorations, i bought some princess and ponies greeting cards from dollar store. Cut the outlines and stuck them to the palace with tape!

Tagged with: ,
Posted in Crafts, Uncategorized