kaneidar
Posts: 3
Joined: Thu Jun 20, 2019 6:50 pm

How to turn on a LED

Thu Jun 20, 2019 7:13 pm

Hi,

I'm a complete newbie with both Rabperry Pi and electrical circuits, so this is most likely a rookie mistake.
I'm using a Raspberry Pi 3B with a breadboard, I connected a simple LED:
Image

The resistor I used is 330R.
I placed the longer leg of the LED with the transistor row (row 26).

I then turned on pin 17 using this the virtual file system:
cd /sys/class/gpio
echo 17 > export
cd gpio17
echo out > direction
echo 1 > value

But the LED does not turn on.

I know the LED is working, because I tested it with a CR2032 battery.

Maybe my circuit is wrong?
Maybe this is not the correct method to turn on pin 17?
Maybe I need to somehow "turn on" ground pin?

Any help will be appreciated

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11993
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: How to turn on a LED

Thu Jun 20, 2019 9:55 pm

a rookie mistake would be to insert the flatcable connector on the other (invisible in this picture) side, rotated 180 degrees.
the brown-red wire pair should be near the pin-1 (left in most pictures of a PI) side, not on the right hand side (near the USB connectors).

another rookie mistake would be to rotate the LED.

a third mistake would be to use the wrong kind of gpis numbering scheme.

GND is always GND (except when the flat cable is reversed), and a connection should exist between (any) GND of the T-adapter, and any of the metal connector shields of any RPI, as they are all connected to GND (USB, Ethernet and HDMI)

Silverlock
Posts: 87
Joined: Wed Apr 10, 2013 3:51 am

Re: How to turn on a LED

Thu Jun 20, 2019 10:18 pm

And the breadboard you're using has split ground and power buses. Your ground wire is on one side of the split ground bus, and your resistor to ground is on the other side. Add a jumper between the two ground lines shown inside the red circle and then see what happens.
Separate power buses.jpg
Separate power buses.jpg (186.35 KiB) Viewed 926 times
RPi3+external HDD/Raspbian Stretch

LTolledo
Posts: 1652
Joined: Sat Mar 17, 2018 7:29 am

Re: How to turn on a LED

Thu Jun 20, 2019 10:22 pm

Silverlock wrote:
Thu Jun 20, 2019 10:18 pm
And the breadboard you're using has split ground and power buses. Your ground wire is on one side of the split ground bus, and your resistor to ground is on the other side. Add a jumper between the two ground lines shown inside the red circle and then see what happens.
a common pitfall for beginners on using full-size 830-point breadboard...

before putting the jumper, I recommend checking and double checking the connections before powering on.
the ribbon cable "might be" connected in the other way around.
the "ground" connection might not really be the ground connection.
use of a tester/DVM/multimeter is highly recommended.

one wrong move and your RPi wont even say "goodbye"
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

kaneidar
Posts: 3
Joined: Thu Jun 20, 2019 6:50 pm

Re: How to turn on a LED

Fri Jun 21, 2019 7:49 am

Silverlock wrote:
Thu Jun 20, 2019 10:18 pm
And the breadboard you're using has split ground and power buses. Your ground wire is on one side of the split ground bus, and your resistor to ground is on the other side. Add a jumper between the two ground lines shown inside the red circle and then see what happens.
Separate power buses.jpg
Wow! you're awesome! This was the issue!

Image

Thank you, and the others, for your quick and helpful responses!

Any chance you can explain how did you know this board had a split? Is it because the red / blue lines break around row 30?

User avatar
Burngate
Posts: 5930
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: How to turn on a LED

Fri Jun 21, 2019 9:30 am

kaneidar wrote:
Fri Jun 21, 2019 7:49 am
Any chance you can explain how did you know this board had a split? Is it because the red / blue lines break around row 30?
That break in the red and blue lines is certainly a clue, but mainly it's just experience.
Most of us have already made the same mistake, some of us several times.
The same goes for the other possible mistakes - twisted ribbon cable, wrong GPIO numbering, etc.

One of the joys of coming here is spotting this sort of mistake, particularly the ones others haven't spotted.
It gives you a nice warm feeling, and makes everyone else think you're a prodigy.
We do, of course, keep quiet about all the rest of the silly mistakes we keep making, just in case someone realises we're just human.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 11993
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: How to turn on a LED

Fri Jun 21, 2019 12:16 pm

Interrupted power strips are indeed in my "common pitfalls sticky", viewtopic.php?f=91&t=83372&p=589714#p635787

pcmanbob
Posts: 6390
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How to turn on a LED

Fri Jun 21, 2019 2:27 pm

If you are new to using a bread board this web site will give you a good grounding on there use .

https://learn.sparkfun.com/tutorials/ho ... breadboard
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

kaneidar
Posts: 3
Joined: Thu Jun 20, 2019 6:50 pm

Re: How to turn on a LED

Sat Jun 22, 2019 9:28 pm

@Burngate Haha! Thank you, that makes me feel a bit less of an idiot :-)

@mahjongg Great guide! Too bad I missed it the first time. Now I read it entirely. Thank you!

@pcmanbob Thank you for this excellent tutorial! That's exactly what I needed

Return to “Beginners”