Shop OBEX P1 Docs P2 Docs Learn Events
Yellow LED backwards? — Parallax Forums

Yellow LED backwards?

BreggensBreggens Posts: 2
edited 2006-07-29 22:27 in BASIC Stamp
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.

Comments

  • willthiswork89willthiswork89 Posts: 359
    edited 2006-07-29 06:44
    when you look at the LED's you will notice one Lead is longer then the other, this is the thing that your going to wan to put in the bread board... do you notice that there is a space... (5 pinholes | 5 pinholes)? put the LONG end on the left side spread the leads and put the shorter on the right side. The right side is all ground meaning these need to goto the VSS of the microcontroller, then you want to take your Yellow-Violet-Blue Resistor and put those on the Longer Lead side(LEFT) and put those in the pin holes labeled 0-15
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-07-29 07:15
    If you look at the LEDs, you'll notice that there is a flat spot on the rim of the case. For current to properly flow through the led, the flat spot needs to be on the ground side of the connection. Think of the led as a bridge between voltage and ground; the flat spot is on the ground side of the gap.

    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.
  • stamptrolstamptrol Posts: 1,731
    edited 2006-07-29 11:12
    Everything mentioned by the earlier posters should get you going.

    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
  • BreggensBreggens Posts: 2
    edited 2006-07-29 22:27
    Thanks a lot for your help. I've reworked my current, tested it on Vdd and VSS, and i think the yellows are backwards. I will continue on.
Sign In or Register to comment.