Ad

Thursday, March 11, 2010

Let there be light!

One of the most pleasant situations is when can execute an idea without using any of your budget. It occured to me that having some onboard lightsource could be useful for the car, specially if you plan on doing night driving. Well I took a look at my repository of electronic junk, and found a pcb with 9 white leds from a broken flashlight, and a bunch of broken 9g microservos.



So I thought, well...if I could get the leds to be turned on and off through a free channel on my radio, it would be sweet.. And then took a look at one of the servos, and thought: I remove the motor, replace the encoder pot with a set of resistors, connect the leds in series with a small value resistor, and it should do the trick.

And so I did it: first analysed the servo operation in its original form. Connected the motor to an oscilloscope, and verified that a PWM signal that varies in duty cycle is fed to the motor. The further you move the stick, the more the duty cycle approaches 100%. Without surprise the peak voltage would be 5 V at the motor terminals (the same voltage that powers the servo).

Measured the pot resistance, which was 2 KOhm. Measured the current consumed by the leds while being fed with 3.1 V (minimum voltage for enough luminosity). It would draw 60 mA.

Then all I had to do was applying Ohm's law to find the appropriate resistor to drop the voltage, given the current that we know the LEDs consume. Found that the ideal value was 52 Ohms (V=RI <=> R = V/I <=> R = 3.1 / 0.060 = 51.66 ~ 52 Ohms).

I did't had this value (the closest resistor is 51 Ohms), so I used the closest resistor I could find at hand. Found a 47 Ohm, which in spite of being slightly smaller, it shouldn't harm the leds as I was being conservative with the voltage in the first place (these were being used in a flashlight powered by 3 AAA batteries - meaning that the voltage could be up to 4.5 V). The typical voltage to which white LEDs are rated is 4 volts.


With a bit of experimentation found an appropriate value for the resistors replacing the pot. One 2 K resistor between pin 1 and pin 3 of the pot terminal, and a 1 K resistor between pin 1 and pin 2.



By doing this I trick the servo controller into thinking that the motor is always in the same position, while the user commands it to go to a different position. This causes the controller to continuously provide current to the motor, in an attempt to reach the desired position. Here instead of the motor we put the LEDs. The result is the LEDs being constantly lit while the stick is in a given region, and off in the remaining positions (because a negative voltage is fed to the LEDs - if a motor would be present instead, it would cause it to move in a different direction).

A little bit of soldering, and it was done! This way I had the cheapest possible RC headlight without spending a single cent.



And finally, after putting heatshrink around the PCB, the work was done:

No comments: