-1

I have started my first basic project today and I have a few questions I couldn't find answers to yet or I just don't know how to search for any. Sorry if those questions seem a bit stupid, but I will just try to be pretty straightforward.

  1. Whenever I start my Pi with a breadboard and LEDs connected they will be "On" for as long as I will start any program which starts controlling their input. I haven't seen this on any tutorial video I have watched, is that normal? How can I keep them "Off" from the beginning?

  2. I connected several LEDs on GPIO pins 3, 5, 7, 29, 31. The LEDs on number 3 and 5 were much brighter than the other ones, is there any reason to this? Also I just read that only certain GPIO pins can/should be used for outputs, while I thought any of them would do. Can't I use any GPIO pin for eg. controlling an LED?

  • 2
    I would propose to add some pictures. I had same questions and finally found that used wrong pins and not checked if my resistors are correct. – Iaroslav Karandashev Oct 22 '17 at 21:28
0

All pins are initially inputs (unless configured otherwise in config.txt), most with pull-down.

Some few have pull-up, including those pins you have selected. Any LEDs connected would glow very faintly, if at all.

See https://pinout.xyz/ and http://www.panu.it/raspberry/ for details of pins.

Pin 3,5 have 1.8kΩ pull-up, intended for I²C. These are unsuitable for controlling LED as they are effectively HIGH, unless pulled LOW.

NOTE While many beginners tutorials show LED connected between GPIO and Gnd, it is better practice to connect +3.3V -> resistor -> GPIO

0

Answer for 1:

Registers for the raspi GPIO pins will hold the last value as long as it is not reseted by a program. This is default by Raspberry. This was creating problem for some of my project as its not failsafe. Incase the program running stops in between a process, i will continue to hold the status as well.

The easy way to overcome this issue is by adding a function to catch errors while executing each step and reset the pins to default state. But it will not be useful incase of a power failure to raspi itself.

This case you will need to have a "external watch dog" which is nothing but an AND gate IC or Optocopupler IC powered by the same supply for the raspi.

Another way is to use a timer IC to monitor a pulse signal from one GPIO pins to make sure your program is still running.

Reference

-1

In Raspberri pi all GPIO pins provide 3.5V & maximum 50mA at output. When you connect LED to it, it is nessasry to use series resister for controlling current. It is sufficient to use 330ohms 1/4 w resister. The properties of emitted light of LED is depending on material use for manufacturing. So because of that you see differece in color also intesity.

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.