0
\$\begingroup\$

I was following LED Light bar project in Arduino Project handbook and I noticed some odd behavior in the Arduino.

I accidentally didn't ground the back half of the breadboard (because I didn't realise there was a break see in the circuit below). I figured that out but noticed it seemed to make the digital pin 2 behave as ground and not light the LED when the ground wasn't connected to the back of the bread board. I tried Googling this but can't find any explanation. can anyone explain why this happens?

UPDATE To make it a bit clearer I thought it was acting as ground because before I connect the ground between the right and left of the board (the connection I originally forgot to add, see the image) I would of expected only the front 4 LED's to light but what appears to happen is all BUT the LED connected to pin 2 lights up. When I bridge the gap in the ground rail all LEDs including the one connected to Pin 2 Lights hence why it appeared to me to be acting as ground, as the LED clearly works.

enter image description here

Update 2 Here is a video of the result: http://youtu.be/5dg0PHDOorA

\$\endgroup\$
  • \$\begingroup\$ @jonnieM You know in Fritzing you can hold SHIFT to snap a bend point to adjacent bend points / connections? That way you can avoid those horrible sloping lines and keep everything nice and neat. \$\endgroup\$ – Majenko Nov 25 '14 at 22:53
  • \$\begingroup\$ @Majenko-notGoogle thanks, thats helpful, was one thing that was annoying me with fritzing \$\endgroup\$ – jonnie Nov 25 '14 at 22:54
  • \$\begingroup\$ @Kaz as stated in the Question, I originally didn't have a ground connected to the back of the board and the entire loop from pin 2 appeared to be acting as ground, not necessarily the node, I should possibly of pointed to the white cable (connected to pin 2) instead \$\endgroup\$ – jonnie Nov 25 '14 at 23:23
  • \$\begingroup\$ post a photo of your actual breadboard connections - pin 8 in your diagram looks wrong \$\endgroup\$ – Pete Kirkham Nov 26 '14 at 10:35
6
\$\begingroup\$

When an IO pin is configured as an OUTPUT, and is set LOW, it is effectively connected to ground through a MOSFET.

You get a reasonably low resistance between the IO pin and ground.

As long as you don't exceed around 25mA through that pin, then all is well, and that technique is often used for multiplexing of LEDs etc.

\$\endgroup\$
  • \$\begingroup\$ The thing is it was set to HIGH not LOW \$\endgroup\$ – jonnie Nov 25 '14 at 22:56
  • \$\begingroup\$ I realise now that the code was setting it to LOW. Thanks. \$\endgroup\$ – jonnie Nov 29 '14 at 16:20
3
\$\begingroup\$

The arrow in your diagram points to node which is in fact supposed to act as ground; you ensured that by adding the missing bridge on the breadboard.

The part that shouldn't be at 0V is pin 2.

It seems that you believe that pin 2 is at ground because the LED isn't lighting. However, that is insufficient evidence. LEDs can fail to light for any number of reasons, including being broken.

To troubleshoot this, you should use a multimeter. Firstly, disconnect the LED and measure the no-load voltage on pin 2. ("Voltage on pin 2" means the voltage between GND and pin 2). This is the first thing: verify that pin 2 is actually doing what you think it is programmed to do.

If so, then re-connect the LED and measure the voltage again. If it really drops to zero, it looks like the LED and resistor are shorted; or possibly, the breadboard.

If the voltage is high with the load connected, but the LED isn't lighting, then there is some connection problem in the breadboard, or the LED or the resistor are bad. Try substituting parts, one by one; first a different resistor, then a different LED.

You can test your resistors with the ohmmmeter function of your multimeter. Since they produce light, you can test LEDs with a simple circuit: a voltage source, series resistor and the LED. In addition, some multimeters have features for testing diodes (they can send a current through a diode and tell you the voltage drop).

To troubleshoot circuits you have to form numerous hypotheses based on your best knowledge, and then test those hypotheses one by one.

\$\endgroup\$
  • \$\begingroup\$ I made the assumption at was acting as ground because before I connect the back ground between the right and left of the board (i.e. bridge the gap) I would of expected only the front LED's to light but what appears to happen is all BUT pin 2 lights. When I bridge the gap in ground all LEDs including the one connected to Pin 2 Lights hence why it appeared to be acting as ground. I will add this detail to the question. \$\endgroup\$ – jonnie Nov 26 '14 at 9:43
  • \$\begingroup\$ @jonnieM Before you bridge that gap, you do not have a complete circuit out of pin 2, through the resistor/LED and to ground! The LED cannot light because the circuit is open, not because pin 2 is at ground potential. \$\endgroup\$ – Kaz Nov 26 '14 at 16:28
  • \$\begingroup\$ ok that makes sense but why do the rest of the leds connected from pin 5 - 8 still light up if there is no ground? \$\endgroup\$ – jonnie Nov 26 '14 at 17:21
  • \$\begingroup\$ @JonnieM LEDS 5, 6, 7, and 8 (counting from the right, starting at 1) are connected to the other segment of the ground rail, on the other side of the missing jumper. That segment is grounded to the Arduino's GND pin. Remove that hookup and then none of the LEDs are connected. The missing jumper is between LED 4 and 6, so it only affects 1 through 4. \$\endgroup\$ – Kaz Nov 26 '14 at 20:11
  • \$\begingroup\$ but it doens't in that case, I have added a video link, hopefully it will explain better then I appear to be \$\endgroup\$ – jonnie Nov 27 '14 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.