rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 5:20 pm

I am new to Rasberry Pi and trying to turn on an LED and I have 330 ohm resistor connected . I have Rasbian Jessie Lite and using PIN BCM 18 as output and using a Python code and Wiring PI using C to run it. Tried both methods using GPIO and gpiozero. But do not see any output. I have set the GPIO pin high using GPIO.setoutput(18,GPIO.HIGH)and measured the voltage on PIN physical pin 12 and I see 0V. Its the similar condition with all the GPIO's .

Is there anything else I am missing ? I searched most of the topics but none of them gives the proper solution.

Any help appreciated !

Thanks
Last edited by rohini on Wed Aug 08, 2018 5:27 pm, edited 1 time in total.

DirkS
Posts: 9267
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 5:26 pm

rohini wrote:
Wed Aug 08, 2018 5:20 pm
Is there anything else I am missing ? I searched most of the topics but none of them gives the proper solution.
Can't check your code, but maybe you mixed up the numbering schemes (Board, BCM and WiringPi)?
https://pinout.xyz/
https://pinout.xyz/pinout/wiringpi (default in WiringPi)

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 5:29 pm

Here is my code using WiringPi and I measured the voltage at Physical PIN No 12

Code: Select all

#include <wiringPi.h>

int main (void)
{
  wiringPiSetup () ;
  pinMode (18, OUTPUT) ;
  for (;;)
  {
    digitalWrite (18, HIGH) ; delay (500) ;
    digitalWrite (18,  LOW) ; delay (500) ;
  }
  return 0 ;
}

User avatar
rpdom
Posts: 12885
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 5:37 pm

I don't see the Pin scheme (Board, BCM, WiringpI) being set in that code. I think the WiringPi library defaults to its own odd naming conventions, in which case WiringPi 18 does not exist on the current boards.

DirkS
Posts: 9267
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 5:40 pm

AFAICT you keep the default, which is wiringpi numbers. Looking at https://pinout.xyz/pinout/wiringpi I cannot find wiringpi pin 18...
But GPIO18 (pin 12) is wiringpi pin 1

BTW: you can change the number scheme to BCM by using wiringPiSetupGpio()
See http://wiringpi.com/reference/setup/

User avatar
rpdom
Posts: 12885
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 5:43 pm

DirkS wrote:
Wed Aug 08, 2018 5:40 pm
I cannot find wiringpi pin 18...
It was on the extra (not-fitted) GPIO header on the later Pi 1B models.

DirkS
Posts: 9267
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 5:44 pm

rpdom wrote:
Wed Aug 08, 2018 5:43 pm
DirkS wrote:
Wed Aug 08, 2018 5:40 pm
I cannot find wiringpi pin 18...
It was on the extra (not-fitted) GPIO header on the later Pi 1B models.
Aha. Cheers for that. I was wondering about the 'hole' in the available numbers.

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 6:21 pm

Thanks for the quick response !
I changed the code as below with wiring pin 1. But I see no difference. The voltage at pin 12 remains 0

Code: Select all

#include <wiringPi.h>

int main (void)
{
  wiringPiSetup () ;
  pinMode (1, OUTPUT) ;
  for (;;)
  {
    digitalWrite (1, HIGH) ; delay (500) ;
    digitalWrite (1,  LOW) ; delay (500) ;
  }
  return 0 ;
}
~
~

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 6:31 pm

Also I see the below output from gpio readall . It shows it as high. But I dont see any output on the PIN 12. Am I missing anything?

Code: Select all

+-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 0 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 1 | OUT  | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 0 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |  OUT | 1 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 3---+---+------+---------+-----+-----+

User avatar
rpdom
Posts: 12885
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 6:42 pm

Which pin are you using for Ground (0V) when doing your measurements?

Have you tried measuring the 3.3V between pins 1 and 6 to test your meter?

Brandon92
Posts: 504
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 6:46 pm

Wich pin 12 are you using: its from you table, but not in order:
| 32 | 0 | IN | GPIO.26 | 26 | 12 |
| 10 | 12 | MOSI | IN | 0 | 19 |
| 12 | 1 | OUT | GPIO. 1 | 1 | 18 |

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 6:48 pm

Yes. I am using PIN 6 as ground . Ii measured Pins 1 and 2 they 3.2 and 5 Volts . And I am using physical PIN 12. Thats wiring Pi 1

Brandon92
Posts: 504
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 6:52 pm

Did you try this example. It's a other pin that is used. But if that one is working, you can try the other pin.

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 7:00 pm

Thank you !

I tried this example and I see the same . the voltage at the pin is 0 and the LED does not turn ON. I used two different Raspberry Pi zero . I see the same behavior in both of them

Brandon92
Posts: 504
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 7:09 pm

Strange, you could try this. This will give you also some info if there is something wrong. I mean, it will tell you when the led is turned on or off. And if that message "led on" doesn't show up, there is something wrong.

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 7:18 pm

I can see it printing as below . But I dont see LED connected to Physical PIN turn ON

Code: Select all

linker LedPin : GPIO 0(wiringPi pin)
led on...
...led off
led on...
...led off
led on...
...led off
led on...
...led off
led on...
...led off
led on...
...led off
led on...
Is there any way I can debug or troubleshoot this?

Brandon92
Posts: 504
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 7:24 pm

rohini wrote:
Wed Aug 08, 2018 7:18 pm
Is there any way I can debug or troubleshoot this?
Ehm okay. Could you poste a picture of you setup? Did you test the led if its not defect and are all the connections good. Yes, this is maybe a stupid question, but you will not be the first with a simple mistake :?

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 7:28 pm

Yes. I understand! I have posted the picture . i am using wiring pin1 . So connected it to pin 12 .

Before connecting this circuit , I measured the output at Physical pin 12 and pin 11 , by just setting both the pins HIGH. But I did not see any voltage on both of them .
I am using rasbian Jessie lite on PI zero .

Thanks
Attachments
PHOTO-2018-07-19-16-51-28.jpg
PHOTO-2018-07-19-16-51-28.jpg (128.06 KiB) Viewed 555 times

Brandon92
Posts: 504
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 7:49 pm

Ai, it's always scary to see that you use not isolated pin headers. I hope that the connection, closed to the sd card, did not make contact with the next pin. If that's the case, that pin will probably dead. And you pi maybe also.

But, by the looks of it you use a 3300 ohm resisitor. (orange, orange, red). With this value your led won't turn on. The current is to low.

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 7:59 pm

Thank you!

Its not making any contact with the next PIN . As I said I did not connect this directly. I measured the voltage setting those PIN's HIGH . Also I am using just single board for the connection and the with the other board I am just measuring the voltage at GPIO and thats brand new. The resistor is 330 Ohms, Orange, Orange, Brown, Gold. I guess 3300 is Orange Orange Red Gold .

I am finding hard to figure out what is the problem . Do you think I should get a new image in SD card and boot again?

Brandon92
Posts: 504
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 8:06 pm

Okay, I couldn't see if it was brown or red. But this should be fine.
rohini wrote: I measured the voltage setting those PIN's HIGH .
So, you measure with you multimeter the correct voltage at that pin? If so, you could have connected the LED the wrong way?

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 8:14 pm

Sorry for the confusion. I measure 0 voltage at the PIN when the GPIO is set HIGH

Brandon92
Posts: 504
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 8:23 pm

No problem
Personally, I didn't use the wiringPi, So, if all the hardware is correctly connected and its not damaged. It should work. You could also try it with the command-line to enable the led.

User avatar
joan
Posts: 13582
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 8:28 pm

Have you actually tested the LED to see if it works?

rohini
Posts: 13
Joined: Tue Jul 24, 2018 2:28 pm

Re: RasberryPi Zero W LED does not turn ON and does not set the GPIO high

Wed Aug 08, 2018 8:45 pm

joan wrote:
Wed Aug 08, 2018 8:28 pm
Have you actually tested the LED to see if it works?
Yes I did . I connected it directly to 3.3 Volts and Pin 6 to ground . And it works.

Return to “C/C++”