Application Note AN-2
By Magnus Pettersson
September 26 1996
Connecting LEDs to the ADB I/O
The following notes are for those of you who are a bit inexperienced with hardware components. This introduction will show how simple it is to connect a hardware component to interface with the ADB I/O. The first one will explain how to hook up LEDs to the ADB I/O.
The ADB I/O port A has 4 relays that can be used to control external components like LED-lamps, higher power relays, and motors etc. The Port B is an analog input, digital input or digital output port. In the digital output mode this port can be used to control external components as well.
A LED is short for Light Emitting Diode. It is used extensively as indicator lights on all sorts of electronic devices. An LED always emits colored light, usually red, green, yellow or orange. Blue LEDs are very rare and expensive. LEDs can have all sorts of shapes but the most common ones are cylindrical with rounded fronts and are 3 to 5 mm in diameter.Other types of LEDs emit very bright light. One example of this type of LED is the Infrared LED or IR-LED. These emit invisible infrared light and are widely used in remote controls.
The LED has two terminals, the Anode is the positive terminal and the Cathode is the negative terminal. Figure 1 shows the schematic symbol of a LED. In photo 1 a red LED is shown. The longest one of the terminals is always the Anode.
The resistor is the most common of all electronic components. The resistor limits the current in a circuit.
Ohms law defines the relationship between Voltage U
across a resistor R and the Current I flowing through the
resistor. The Current through a circuit is directly
proportional to the Voltage and reversed proportional to the
Resistance of the circuit. This gives the following
A resistor can have values between 0 ohms and several million ohms. Most resistors look the same. Because of this it is quite easy to chose the wrong resistor value by mistake. But resistors have bands of color on them to indicate the value. To read the value first locate the tolerance band. This is a bit separated from the other bands. Turn the resistor so the tolerance band is to the right. Now look up the first and second digit in the table in figure 3. Then add the number of zeros. Form a number by putting the digits together with the number of zeros.
The tolerance band tells you how accurate the resistance is. On low tolerance resistors a third digit band is inserted before the number of zeros band making a total of 5 bands.
Example: a resistor has 4 bands: orange, orange, brown and gold.
The value is 3 and 3 and 1 zero = 330 ohm, tolerance is ±5%
FIGURE 3. Resistor color codes.
Standard resistor values
When you are buying resistors you have to consider that all resistors are manufactured according to series of standardized resistance values. This means that the resistance value you have calculated might not be available. You have to choose the nearest available value and you have to decide whether to choose a higher or lower value.
When current is fed through the LED it starts to emit light. The current must flow from Anode to Cathode and the current has to be limited to about 20mA. High brightness LEDs may need higher current, other LEDs may use lower current. Also, the Voltage across the LED has to exceed the LED Forward Voltage which is usually 2 Volts. These parameters are stated in the specifications of a particular LED.
To limit the current a resistor must be used in series with the LED. The value of the resistor used can be calculated according to figure 4. R = (Ub-Uf) / If
FIGURE 4. Calculating the value of the current limiting resistor for a LED.
Interfacing LEDs to the ADB I/O
Driving LEDs from the ADB I/O is very simple. Since the ADB I/O has internal current limiting resistors on Port B and on the Vref +5V terminal, current limiting resistors need not be used.
To connect it to Port A do this. Connect a piece of wire between Vref +5V and a terminal of Port A channel 4. Then connect the LED Anode pin (The long one) to the other Port A channel 4 terminal and the cathode pin to the ground terminal at Port B channel 1.
The channels on port B have sufficient drive capability to drive LEDs directly. Remember to configure the channels of Port B as digital outputs. The Pull-Up / Pull-Down Jumpers should be placed in the open circuit position for optimal performance. Since the ADB I/O has internal series resistors on the channels of port B, the LEDs can be connected directly.
FIGURE 6. LED interfacing to Port B
More than one LED on Port A
If more than one LED is connected to the channels of port A, the effect of the current limit on the Vref +5V terminal common to all LEDs would be that the LEDs light will become weaker as more LEDs are lit. One solution to this problem would be to use an external voltage from a battery to power the LEDs. This would allow for a constant brightness. This will however require external current limiting resistors as well. Figure 5 describes such a setup.
Wiring it together
When the circuits become more complex, like the one in figure 7, there is no more room on the ADB I/O terminals to wire it all together. Some alternatives would be to use either Wire Terminal Strips, a Solderless IC-Breadboard or solder the components together on a pre-drilled prototype circuit board. Wire Terminal Strips can be used for the circuit in figure 7 but hardly for anything more complex with Integrated Circuits and such components. A Solderless IC-Breadboard (photo 3) is perfect for experimentation but it is not suited for permanent installations. It has holes with contacts that components fit into. Using jumper wires the components are interconnected
A pre-drilled circuit board has several hundred solder-ringed holes in a 0.1" grid. The pins of a component are placed through the holes and the pins are soldered on the other side of the circuit board. Jumper wires are placed into the adjacent holes and soldered to the component pins to interconnect the components.
FIGURE 7. Controlling several LEDs from Port A
Where to buy components
There are lots of electronic component distributors to buy components from. In RadioShack stores all around the US you can get most basic parts needed for ADB I/O experimentation. RadioShack can also supply you with soldering tool sets as well as breadboards.
More specialized components can be purchased by other electronics component retailers. Allied Electronics is one of them.
RadioShack can be reached by phone at 1-800-THE-SHACK or on the Internet http://www.radioshack.com
Allied Electronics can be reached by phone at 1-800-433-5700 or on the Internet http://www.allied.avnet.com
|Note: The ADB I/O is no longer made or sold. These ADB I/O pages are hosted by Kaj Bjorkman as a favor to Sven Grenander (the founder and former Head Drone of BeeHive Technologies, Inc.)
Please let other ADB I/O users know that these archival pages are again available.