BTW - got this really detailed response on the 16mm NGM forum. Not only has this helped me understand what seemed counter-intuitive, it's made me feel it might be worthwhile brushing up my knowledge of electronic theory.
I hope you find it interesting. (PS - I have the originator's permission to re-post here)
Now, this is going to be a bit of a guess, as I can?t know exactly how the LED dimmer works without looking at one and testing it. However, it?s a pretty fair guess, so I?ll try to describe what I think is happening, but first I need to describe how I think the LED dimmer is working.
I suspect that the LED dimmer will be a PWM current controlled unit. If you see my earlier mail on LEDs you?ll see that I was extolling the virtues of current control with LEDs, as opposed to voltage control. This way the controller will compensate for any variation in forward drop of the LEDs across batches (not something we need to worry about with when assembling one-offs, but if you?re designing something for which there may be 100,000+ built (as I do at work) then it is a serious consideration. So, I suspect that the LED dimmer works by sending out a constant current rather than constant voltage. This means that its voltage will depend on the load.
The easiest way to create a dimming function for LEDs is to use PWM (pulse width modulation). This means that it will send bursts of constant current out. By ?constant? I mean that the current will be either on or off, but when its on always be the same value, it won?t be variable. It will probably work at a set frequency (probably from 40k to 400kHz) , and the ratio between the ON and OFF pulses will be what sets the brightness, or in your case of the motor, its speed.
So, that said, let?s analyse what?s probably going on with your circuit (this only holds if my assumptions above are correct):
Because the LED dimmer is a current controlled unit, set pulses of current go through your motor. The voltage across the motor will therefore be related to the load on the motor. If the motor is free-running (not hauling a train) then there will be very little load, so the voltage developed across the terminals will be low. If this is below 3V (assuming you?re using white LEDs) then they may either not light at all, or very, very dimly. Essentially the motor has usurped the LED for current demand so the LED aren?t lit.
BUT
Between the periods of pulses of current from the controller, when the controller is not supplying any current, the motor is still rotating under its flywheel effect. During this period it is acting like a generator, because the motor contains coils and they cannot change current flow immediately ? it has to continue flowing. So, the motor acts like a generator and pushes current through the LEDs. The forward voltage of the LED is now achieved as the LED restricts current flow until its Vf has been achieved, so the ?generator? essentially winds up the voltage until the necessary current flows in the LED to maintain the equilibrium. I think this is what is dimly illuminating your LEDs ? not the controller, but the flyback effect from the motor operating as a generator in the gaps.
SO
Why does the LED dim at higher speeds? Well, if the above holds, then as you increase the dimmer, what is doing is changing the PWM duty cycle closer to 100% (the ON-OFF time of the pulses, becomes mostly ON and very little OFF). By now you?ll have realised that if this is the case, and there is little or no OFF time then there is no point where the motor is acting as a generator, so the LEDs are not lit.
OK, so a couple of interesting points. If the load on the motor is increased, then the voltage developed across the motor will be increased and at some point the LEDs may illuminate. Start the motor off and set it to about 50%. Now grab the shaft or wheels and really give it something to drive. Do the LEDs illuminate?
Right, so what can you do with your circuit? To be honest, not really a lot. I just don?t think there?s any reasonable way you can drive the LEDs from the dimmer that is also controlling the motor because of the interaction between the two. I think what I would do is either fit a 4 pole changover switch, and use two poles for the motor and the other two poles to switch whichever is the forward LED on, and drive the LED(s) simply using a ballast resistor and the 12V supply. If you want to illuminate 2 LEDs at each end for headlights you can just put the LEDs in series and then use a slightly smaller ballast resistor (don?t half it! See below). IF you can?t find a 4 pole switch then you could use a single pole switch to drive a 4 pole changeover relay to do the job. At least your lights will be a set brightness whatever the speed.
Lastly, LED ballast resistors. Assume the white LEDs are 3V. If you?re driving this from 12V the resistor will drop 9V. If you decide on 10mA in the LED (a good place to start for a typical 3-5mm LED) then the resistor is 900R. If you run two LEDs in series with one ballast resistor, then you can add the Vfs together, so the total dropped across the two LEDs is 6V, so there is 6V across the resistor, so to keep 10mA you need 600R (so not half).
Remember Ohms law ?> V = IR
Hope this has been of some interest, if not sadly being able to fix the problem.
Lyndon