Control of LEDs
Forums:
Hi there,
I'm planning to use an UltraBorg as it's easy to implement ultrasonic sensors for an RPI project. Could I also use the servo outputs to control the three channels of an RGB LED? The LEDs are Common Cathode and I plan to use just the signal pin from each o/p.
Will I need to change the PWM settings & if so to what?
Thanks for your help.
:)
piborg
Thu, 02/01/2018 - 11:54
Permalink
Controlling an RGB LED from UltraBorg
Yes, it would be possible to control the three channels of this LED from three of the servo outputs.
In normal use the PWM is limited to a range suitable for servos, so you will have to use slightly different calls to get the full PWM range from each channel like this:
The board already has 510 Ω series resistors between the 5V supply and the servo signal outputs, so the maximum current output from each channel is 9.8 mA. If the LED channels are rated for a lower current than this you may want to add additional series resistors to drop the maximum current. If the LED channels are rated for higher currents then it may still work, but the LED will not be able to reach full brightness.
PurpleShark
Sat, 04/28/2018 - 16:45
Permalink
That's great and many thanks.
That's great and many thanks.
Each channel of the LED has a current of 20mA and a forward voltage of 3.0..3.2V and I was planning to use 8 arranged like a Lego brick as this project is for children! 8 LEDs together would be 160mA and a 15ohmn resistor would be needed to drop the voltage to 3V... might need some sort of a driver circuit me thinks?
Or, just looked at the board, are these the 4 resitors alongside the servo connectors? If I was to power the board separately (not from the RPI), could I then replace the resistors with links? At my risk of course!
Thanks, :)
piborg
Thu, 02/01/2018 - 16:35
Permalink
Yes they are :)
Those four resistors next to each servo connector are the ones in series with the 5V, you could carefully replace them with a more appropriate value or just bridge across them to remove the resistance.
When powering the board separately remember to remove the "5V link" jumper in the centre of the UltraBorg to keep the two 5V power supplies isolated :)
PurpleShark
Thu, 02/01/2018 - 17:17
Permalink
Thanks again
I'll give it a go! :)