Yellow LED backwards?
Breggens
Posts: 2
I just bought the basic stamp homework board from radioshack a week ago. I have been rather busy lately and so am only on chapter two, in which you practice making circuits with LEDs. A problem has come up on one of the projects at the end of the chapter, in which you make a bar-graph out of LEDs.
I am already quite confused with the counter intuitive way that electrical flow is described, in which current flows toward the cathode. To make matters worse my LEDs seem to be giving contradictary information. I have a circuit set up using 8 pins on the circuit board. The long end of the LED goes in one pin, connects to the breadboard row below it, which is then connected to the pin parallel to that row through a resistor (essentially a circuit going from a pin to pin). This is Project 2 chapter 2 of What's a Microcontroller? The two red LEDs utilize the top four pins while the yellow ones occupy the bottom 4; they are all set up with the long end of the LED going into the higher number pin and the lower end of the LED entering the row of the pin directly below it. I'm using the top four pins of the circuit board, pins P15 to P8. This is the code that makes all four lights go on at once:
'Program that controllers 4 LEDs as a bar-graph.
'Makes them go on and off in tandem with other effects.
'{$STAMP BS2}
'{$PBASIC 2.5}
HIGH 15 'top red
LOW 14
HIGH 13 'bottom red
LOW 12
HIGH 10 'top yellow
LOW 11
HIGH 8 'bottom yellow
LOW 9
This code implies that the two different color LEDs have different flow direction. Is it possible that I have backwards yellow LEDs, or backwards red ones? I am just starting out and am already quite confused.
I am already quite confused with the counter intuitive way that electrical flow is described, in which current flows toward the cathode. To make matters worse my LEDs seem to be giving contradictary information. I have a circuit set up using 8 pins on the circuit board. The long end of the LED goes in one pin, connects to the breadboard row below it, which is then connected to the pin parallel to that row through a resistor (essentially a circuit going from a pin to pin). This is Project 2 chapter 2 of What's a Microcontroller? The two red LEDs utilize the top four pins while the yellow ones occupy the bottom 4; they are all set up with the long end of the LED going into the higher number pin and the lower end of the LED entering the row of the pin directly below it. I'm using the top four pins of the circuit board, pins P15 to P8. This is the code that makes all four lights go on at once:
'Program that controllers 4 LEDs as a bar-graph.
'Makes them go on and off in tandem with other effects.
'{$STAMP BS2}
'{$PBASIC 2.5}
HIGH 15 'top red
LOW 14
HIGH 13 'bottom red
LOW 12
HIGH 10 'top yellow
LOW 11
HIGH 8 'bottom yellow
LOW 9
This code implies that the two different color LEDs have different flow direction. Is it possible that I have backwards yellow LEDs, or backwards red ones? I am just starting out and am already quite confused.
Comments
When you wire a circuit, you are going to have 2 reference points - your voltage source, and ground. On the HW board, VSS is ground, while VDD is voltage (in this case 5 volts). If you create an led circuit apart from the Basic Stamp chip, as shown in the manual, with just an led and a resistor connected between VDD & VSS, the reference points are fixed.
When you wire your led and resistor between 2 stamp pins, you still need to connect the circuit between VDD & VSS. Only now you are routing VDD & VSS through the Basic Stamp chip, and you can tell the Basic Stamp chip which pin connects to VDD, and which connects to VSS.
So for current to flow, the Basic Stamp pin on the flat spot side of the led needs to be LOW, and the other pin needs to be HIGH. If you turn the led around, same thing - flat spot side LOW, other pin HIGH. If you don't tell the pins to change, current won't flow because it only flows when the flat spot is on the ground side of the circuit.
When current is able to flow through the led, the led is forward-biased. When current is unable to flow through the led, the led is reverse-biased.
However, I had an experience where I bought a bag of 100 LEDS at a "bargain" price. In terms of the long lead/short lead and the flat spot, they were all backwards!
Regardless of the physical markings, you can very quickly sort through a bunch of LEDS to determine polarity with a 9 volt battery and a 1 K resistor. Connect each LED, through the resistor to the battery, noting the polarity. If it lights, mark one of the leads so you'll know the correct polarity when you go to use them. I typically make the cathode/negative side shorter with a pair of cutters.
Cheers