RSS

Posts Tagged ‘LED’

Simple LED and Transistor Switch

Sunday, January 2nd, 2011

In my previous post I mentioned that I was working towards controlling a LED from the Netduino.  In fact the aim is to be able to control more than an LED but this is a start.  Step two is to use a transistor to control the LED by using the transistor as a switch.  By doing this I hope to be able to use this knowledge to control other devices which draw more current than the Netduino can supply (i.e. motors etc.).

Objective

The aim of this experiment is to control the circuit in the simple LED experiment using a transistor as a switch.  The LED should light when the input to the transistor is high and the LED should turn off when the input to the transistor is low.

The circuit should draw as little current as possible in order to switch the LED on in order that the switch can be used by the Netduino Plus.

Design

The circuit is a simple transistor circuit using the transistor as a switch.  In this case the transistor is either off or fully on (The voltage across the collector and emitter is almost zero and the transistor is saturated and cannot pass any more collector current).  The circuit design becomes something like this:

Note that the current limiting resistor for the LED circuit has been change to 100 ohms (as opposed to 47 ohms in the previous post).

The resistor R2 is used to drive the transistor. By breaking the connection we turn the transistor off and hence turn the LED off.  By restoring the connection we turn the transistor back on and hence turn the LED on.  The value of R2 has been chosen to provide a very small current to the base of the transistor.

Current to base of the transistor = V / R (from ohms law)
  = 3.3V / 2200 ohms
  = 1.5 mA

This falls well below the maximum current of 8 mA per pin provided by the Netduino Plus.

So we now have the limited current to trigger the switch and then only thing remaining is to work out which transistor to use.  For this I used The Electronics Club pages regarding transistors.  By following their calculations regarding choosing a suitable NPN transistor we get the following:

Load current on the collector = Supply voltage / Load resistance
  = 19 mA (modified from the last post)

The transistors minimum current gain (hFE) should be at least five times the current being driven through the load (Ic) divided by the maximum output from the chip driving the switch (i.e. from the Netduino Plus).

hFE(min) = 5 * (load current Ic / maximum current from the chip driving the circuit)
  = 5 * (26 mA / 8 mA)
  = 16.25 (minimum value)

On this basis the BC108 transistor was chosen as the hFE and the Ic values fall well within those calculated.  For the BC108:

IC 100 mA
hFE 110

The next step is to calculate the value for the resistor placed between the base of the transistor and the switching current.

RB = (Vc * hFE) / (5 * Ic)
  = (3.3V * 100) / (5 * 19mA)
  = 3473 ohms

The value for RB was set to 3k3 ohms.

Putting It All Together

The circuit was assembled using the values in the diagram above.  By connecting the base of the transistor to the 3.3V line through the 2K2 LED turned the LED on, disconnecting the resistor turned the LED off:

And so some measurements:

Measurement Value
Voltage drop across R1 1.34 V
Voltage drop across LED 1.86 V
Voltage drop across R2 2.52 V
Current through R2 0.5 mA

The next stage of the project is to connect this to the Netduino Plus and use this to turn the LED on / off preferably without burning it out :).

Simple LED Circuit

Saturday, January 1st, 2011

I suppose every journey starts with a single step, and often a small step at that.  Relearning the skills of yesteryear will be no different.  I’m slowly working myself up to controlling the LED from the Netduino Plus.  On this basis I’ll be taking it steady and tackle this in three parts:

  1. Light a LED from a 3.3V power supply
  2. Use a transistor as a switch to control the LED circuit above (more here)
  3. Use the Netduino Plus to control the transistor/LED circuit

The reason for taking this slowly is the Netduino Plus can only supply a small amount of current and I’m taking care to draw as little current as possible whilst still having a usable project.

So step one, a simple LED circuit from a static power supply

The design is simple (I’m not taxing myself too much) and requires little more knowledge that that provided by the LED data sheet and Ohms Law.  The task is to use a stable 3.3V power supply and use this to light up a red LED.  Minor complication here, I don’t have the datasheet for the LED so I’m not sure how much current it will take.  A quick search on Google provides a whole list of web sites with information on LEDs and the consensus of opinion is that modern red LEDs draw about 20mA max and have a typical voltage drop of around 2.5V (along with one comment that burning LEDs make a rather unpleasant smell).

Note 8 Jan 2011: Finally found the data sheet for the red LED being used and Vf = 2.5V and If = 20 mA.

Armed with this information I need to include a series resistor in the circuit to take the additional voltage drop and limit the current.

And for the calculations:

Voltage drop across the resistor = supply voltage – 2.5
  = 3.3 – 2.5 V
  = 0.8 V

Working on the resistor we get the following:

V = I * R
R = V / R
  = 0.8 V / 20 mA
  = 40 ohms

Now this resistor is not available as a standard component.  The nearest ones are 39 ohms and 43 ohms.  A quick look through my supply and I’ve got 33 ohms and 47 ohms.  So I plump for the 47 ohms and the circuit becomes:

The power supply itself will come from a breadboard power supply stick from Cool Components.

Theory over, now for the application

First job is to solder a couple of male header row connectors to the power supply to make it easier to connect to the power supply to the breadboard.  Next add the resistor and the LED and plug it all in.

The good news is it didn’t go bang and no hint of the smell of burning LEDs.  In fact it worked, one glowing red LED.

Simple LED Working

A quick check with the multi-meter revealed that

  1. The power supply is in fact delivering 3.25V and not the rated 3.3V.
  2. The voltage drop over the series resistor was 1.25V which means the circuit is drawing 26mA and the voltage drop across the LED is in fact only 2V.

All in all a small and simple first step.