Electron Pi

My notebook on Raspberry Pi and Arduino projects

LED driving bakeoff

A thought – using a transistor to control an LED. There are at least two ways to do this – schematic:

bakeoff_schem

Circuit 2 is basically an inverter with an LED in. One thing I’m learning – “low” or “zero” does not mean “off”, rather, “ready to sink current”. Have I made this point before? Anyway, I’ve put a 100R resistor in series with a green LED, as that’s a sensible size resistor to have there. Circuit 2 uses a different principle. In both cases I’ve placed the ADC to measure the voltage across the resistor – this lets us work out the current going through the resistor and hence the LED. The 10k resistor is there to make life difficult but not too difficult – to simulate a case where we want to work with low-current signals. Anyway, graphs:

bakeoff

So blue and red are the measured voltages, on the primary y-axis, and green and purple are the calculated currents – plotted on the secondary axis. The first point is that Circuit 1 wins. It seems to be easier to sink current with the collector of your transistor, than to source it with the emitter. Second – note that not only does the green line turn on earlier (at a mere 0.7V or so – compare with just driving an LED!), the curve slopes up much more sharply. Third – note how curvy the curve gets. Once the current gets near 20mA the curve starts to get nonlinear, and seems to be close to saturating a bit above 25mA, although it looks like the curve has a little way to go yet.

Of course, if we wanted steeper curves, then a Darlington pair might be a way to get that.

Leave a comment