So I previously defined the basic parameters of this project, but let's throw out a block diagram to make things clearer.
That's pretty much it. You may have noticed that there is no "input power". And you'd be correct. The input supply voltage comes from either the headlights being turned on or from the turn signal flashing. They powered the incandescent bulb, a little microcontroller and LED should be no problem.
It also may have occurred to you then that the mcu would be unpowered between signal flashes. Again you'd be correct. Every time the signal flashes, the micro will have to start up and figure out what's going on, and do the right thing. But not a problem really, it'll be instantaneous as far as anyone will be able to tell.
Since an LED is already picked out, the next course of action would be to figure out how to drive it. We know we need to achieve at least two brightness levels, and we also know we that we don't know what those brightnesses will be. We're gonna need a PWM. The other requirement is constant brightness over our expected voltage input (roughly 12 to 14 volts). This can be handled in hardware using a constant current source.
A simple but handy circuit. I've always that this was a clever design. We don't know what V+ will be at any given time and we cant change R2, so how do we regulate the current thru D1? With Q1. Since the base-emitter junction of Q1 is effectively a diode, we know that its going to be a pretty consistent 0.7V (approximately... whatever it's actual value is, it won't really vary with V+).
Q1 will regulate how current goes into the base of Q2 to ensure this. Now we just need to figure out what current we want. Determining the resistor then becomes: $R = \frac{0.7V}{I_{desired}}$. I am aiming for about 0.5A.... giving: $R = \frac{0.7V}{500mA} = 1.4\Omega$. We'll just round to $1.5\Omega$.
Another alternative would have been to use the built in ADC of the microcontroller and try to compensate the PWM duty cycle. But what a hassle, and we're going to be short on I/O as it is. There would need to be look up tables and scaling done to improve accuracy and more work than is worth doing. This method may ultimately be less parts too.
I'll quit here for now. As a head's up, the microcontroller to be used will be a PIC10F322. This heavy hitter has 6 pins, 64 bytes of RAM, and 512 words of program memory. Yup, this little guy barely has the RAM to store this sentence. Barely. And the text of this post probably wouldn't even fit into it's program memory. But we don't need to get that much done.


No comments:
Post a Comment