Confused about gpio; LED tutorial...

Hi all, i was trying to follow this LED tutorial and experienced an unexpected result. I had everything hooked up the way the video instructs, with some exception(s): at this time i do not have a breadboard or jumper wires, so i was trying to wing it with some test leads and some header pins that i removed from an old PackardBell desktop motherboard. I soldered a pin onto one end of two wires and stripped the other ends for alligator clip connection. i hooked up my LED as shown in the video, except using test leads with alligator clips for connection(s). Also, i did not have a 220Ohm resistor as the tut prescribes, however i had a 180 Ohm that i clipped off of a scrap pcb a while back. I held the LED to a 9v battery and it was REALLY BRIGHT for about one second, and then it ceased to function. So i got another LED, (luckily i had more than one lol) and clipped the resistor to the positive leg of the LED with a test lead, then applied my 9v battery (which read ~7.5v on my multimeter) and the resistor seemed to work well, the LED was a “normal” brightness and it continued to function until i removed the battery, so i assumed it worked well enough to use.

Here’s where the unexpected things start happening. I hook up my little setup to the BBB and plug it in, expecting that the LED would be unlit. However when the BBB started to boot, the LED came on and for a moment mimicked either the USR3 or USR4 LED on the board. After boot was complete the LED remained lit but very dim. I continued in my attempt to follow the tutorial, entering all commands as instructed and verbatim.

The commands i entered are as follows:


echo 38 > /sys/class/gpio/export

echo out > /sys/class/gpio/gpio38/direction

echo 1 > /sys/class/gpio/gpio38/value

echo 0 > /sys/class/gpio/gpio38/value

echo 38 > /sys/class/gpio/unexport

now, when I changed the value for the pin, nothing happened at all, the LED stayed the same, very dimly lit. I changed the value from 1 to 0 to 1 several times and observed no change at the LED. I figured obviously either something is wrong or i DID something wrong, so i put everything back the way i found it and shut her down. I am confused because this is not what i expected, i was happy to get an LED to glow, but i can do that with a 9v battery and a scrap resistor, so using a $45 computer to do it isnt all that great, if I can't program the output.

Anyone care to take a stab at what (probably obvious) thing i might be doing wrong? I know the tut is for BBW but i checked the SRM and the pin is the same as in the tut (GPIO1_6). Commands were issued from GateOne running in Chrome browser on ubuntu 12.10 x64. Software on the BBB is the original SW that shipped with the board.

Is there something in the BBB that is different from the BB that I am not accounting for? Is the LED supposed to be completely off when i boot up the board? That's kinda what I expected because that's what the video shows happening.

Anyone know what I did wrong? Do I need to update my SW? I heard about ppl accidentally wiping their eMMC and it kinda deterred me from wanting to update anything...

The pin you are trying to use is taken by the eMMC hardware. Move the LED to P8_7 and use Linux pin 66 instead of 38. It will probably work better for you.

Question then is, what about the BeagleBone Breadboard?
http://beagleboardtoys.info/index.php?title=BeagleBone_Breadboard

Should not try to hook up the LEDs without other hardware?
If so should probably add some notes to the documents for it…

Kurt

You can hook up an LED direct to the pins on the BeagleBone. Just be careful and make sure the voltage on the other end of the LED is nothing more than 3.3V. The LED in some cases may not be very bright.

If you plan to do this for a prolonged amount of time, you need to buffer it. Refer to the schematics of the BeagleBone boards.

Gerald

Yeah I just read your 180 Ohm comment! Don’t run around and think any ol value will work if you don’t have what a circuit calls for. Even allowing for the voltage drop of the LED, that could be pushing up on 8 or 9mA forward current in the diode depending on the color. If you have a meter then it is just as easy to confirm the operation of the pins using it to measure the voltage on the pin rather than light an LED. I usually go way conservative to directly drive an LED from micro. On a 3.3V pin I would use a 220 or better 330 ohm resistor. The LED will be pretty dim but it’s enough to see it light up. For any permanent circuit to drive an LED then I definitely use transistors to drive the LED from the source power rails rather than from a processors IO pins directly.

In general the current the pin has to supply to directly drive an LED is going to be (Vin-LED Drop)/Resistance. For a typical LED that’s (3.3 - ~2.0)/R. So a 220 ohm resistor puts you around 6mA of drive current. A 180 ohm puts you at over 7mA. The LED voltage drop varies a bit by color though so those figures can change up or down.

A transistor drive will put nearly no load on the I/O pin and you don’t have to worry about the number of LEDs your using exceeding the processors total I/O current rating.

BTW. If you hook an LED to the pin without a resistor then you may as well wire that pin straight to ground. When the pin goes high, you will create an effective dead short between the pin and and ground and may very well smoke the pin, I/O bank, or the entire processor. Know exactly what you are doing before you attach something to the GPIO pins.

This was my initial suspicion.

thanks for clearing that up. i selected the 180 ohm resistor because of the few i have available, it was the closest to 220. I wasn’t really trying to make anything permanent, I just need to learn how all this works and the only way i can think to learn is to start plugging and coding until i can “make stuff do stuff” lol I do however understand the risks involved with such techniques and attempt to take proper precautions whenever possible, if only to preserve my equipment. lol Thanks for all the information, i surely appreciate it. Hopefully ill have some breadboarding equipment, and maybe some better components at my disposal soon. I hadnt really set my mind on any real projects yet, i have some ideas but there are still some things i need to learn first i think, so for now I’m just trying to learn gpio and then i dont know where ill go from there but i have plenty of options so im sure I’ll figure it out along the way. If you have any suggestions for where i can find some safe tutorials, or some beginner projects i might learn alot from, i’d be very interested and much obliged.