2
\$\begingroup\$

I wanted to control the LEDs on my model railroad with a microcontroller and (maybe Soft-)PWM, but just saw, that most of the LED stuff you can buy for model railroads runs at 12-16V and also the transformer supplies 14V.

Now I fear, that I can't do this with microcontrollers and PWM, because they provide just 5V.

So, is there a way to provide 16V with the microcontroller?

\$\endgroup\$
5
\$\begingroup\$

Here is a simple circuit for controlling a LED from a 5V digital output while powering it from a higher voltage:

When the digital output is low, the transistor is off and the LED unlit. When the digital output is high, the base of Q1 is held at 5V. With the emitter resistor, this causes Q1 to act like a reasonably constant current sink. If the B-E junction drops 700mV, then there will be 4.3V accross R1, which makes the current close to 10mA. At long as there is sufficient voltage for the transistor to sink this current, the current will be largely independent of the supply voltage. This also a good design if the supply has a lot of ripple but you want stead LED light output.

Let's say you are using a green LED that drops a little over 2V. The collector of Q1 can go down to a little below 5V and still act like a current sink. That means as long as you have around 7V or more on the anode of the LED, it will be driven with 10mA when the digital output is high.

\$\endgroup\$
4
\$\begingroup\$

Any voltage level or load you wish to drive can be controlled with suitable interface circuitry. You can eg switch 1000 Volts or 100 Amps "with ease" once you have the correct interface. When you need voltages of say under 50 volts and currents up to "a few amps" the task has been made relatively easy by the existence of many readily available and well priced interface IC's.

You can use separate transistors or there any number of ICs that will do this. An IC or transistor diver both allows any desired voltage to be used and can provide more current than the microcontroller can provide.

Here is an example using the common and popular and cheapish ULN2803 driver. This is shown being driven by a printer port but the Atmega8 will do the same job. They show 9 volts but you can use up to about 50 volts with a ULN2803 depending on manufacturer. This one is 50 volt rated.
The zener diode shown is not always needed - depending on what is being driven - but usually not a bad idea BUT they have shown it backwards ! - turn it around. A zener voltage of slightly more than the supply voltage will handle most load situations. It's purpose is to direct and dissipate turn off spikes - a discussion for later on. [That circuit was from here - related to IBM port issues so not 100% related but interesting.]

enter image description here

The above driver has the load referenced to V+.
If the load has one end grounded a driver like shown below will work. Values and transistors to use depend on applications and need discussing. Ask if interested.

enter image description here

\$\endgroup\$
2
\$\begingroup\$

Using a Darlington (ULN2803,etc) driver is really easy way to drive things that are close by, example engines, steppers LED's matrices, etc... yea.. further away too, but..

Now as a fan of model railway, I know that rewiring or putting in more wires can be a pain in the back. Usually you already have the wires there- you just need to switch them. Using a solid state relay can be a simple and quick solution and if you search around you can get them in packs for reasonable price.

All you need to do is connect the LED light you want to the existing wire on an Arduino output and by the LED connect it to the solid state relay Sensing Pins. Using your existing power source of whatever Volts you put the live on the Switch Pin Supply. Then connect the existing LED power supply to the Output Supply.

Some people may thing.. umm that is the same what we jsut answered using the Darlington.. well- at least you got another option in terms of wiring and expandability.

Example of SolidStateRelay

enter image description here

\$\endgroup\$
0
\$\begingroup\$

uln2803 peripheral driver is what you want. It is a chip with 8 darlington pairs that the microcontroller can use to switch up to 30v or so.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.