kirby2ig
Posts: 16
Joined: Fri Dec 28, 2012 2:25 pm

Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 2:37 pm

I installed the GPIO module and python-dev, but the GPIO pins can only recive inputs :cry: . Any ideas? Also, mv multi-meter says that the GPIO pins are producing outputs of 3.7v. My power supply is 5v at 1 amp and I have not overclocked my pi.

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

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 3:46 pm

The gpios are 3.3V.

Have you set the gpios you want to use as outputs to be outputs?

kirby2ig
Posts: 16
Joined: Fri Dec 28, 2012 2:25 pm

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 5:56 pm

Yes, the pin is set up for an output

Code: Select all

#!/usr/bin/env python
import RPi.GPIO as gpio, time
gpio.setmode(gpio.BCM)
gpio.cleanup()
gpio.setup(4, gpio.OUT)
while True:
	print("Sending Power To LED!!")
	gpio.output(4, True)
	time.sleep(3)
	print("Turning Off LED!!")
	gpio.output(4, False)
	time.sleep(4)

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

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 6:01 pm

I don't know what cleanup does (I don't use Python).

Is gpio4 the P1-7 pin?

See http://elinux.org/Rpi_Low-level_peripherals

User avatar
croston
Posts: 703
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 6:11 pm

If you gpio.setmode (gpio.BOARD) you can use the P1 numbers rather than the broadcom numbers. The cleanup function resets every channel used by your program to the system default (input+no pullup/down). It is pointless calling it at the beginning of your script.

User avatar
MattHawkinsUK
Posts: 538
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
Contact: Website

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 6:17 pm

Use the latest Raspian image and you don't have to bother installing RPi.GPIO.

Check the voltage of pin 1 (3.3v) and pin 2 (5v). Use Pin 6 as ground.
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)

kirby2ig
Posts: 16
Joined: Fri Dec 28, 2012 2:25 pm

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 8:17 pm

Pin 1 measures 0.01v and pin 2 measures at 0.72v. TP1 and TP2 measure 4.99-5.01v, so I know that my multi-meter is working. Any Ideas? :?
EDIT:
I tryed again using TP1 as ground and the pins gave me the correct voltages. There must be something wrong with pin 6. :o

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 8:34 pm

croston wrote:If you gpio.setmode (gpio.BOARD) you can use the P1 numbers rather than the broadcom numbers. The cleanup function resets every channel used by your program to the system default (input+no pullup/down). It is pointless calling it at the beginning of your script.
The cleanup in the beginning is a very good principle. Sometimes we use programs that don't clean the outputs, or we break a program (ctrl+c) before it reaches the clean function, so it's really usefull have that function in the beggining.

kirby2ig
Posts: 16
Joined: Fri Dec 28, 2012 2:25 pm

Re: Help, GPIO is NOT WORKING!!!!

Fri Dec 28, 2012 10:40 pm

I tested every gpio pin and found that the 3.3v line gives 1.8v instead and some gpio pins provide 5v and some provide 1.8v. I don't know what to do. Does anyone know what is wrong with my pi? :?:

User avatar
croston
Posts: 703
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Help, GPIO is NOT WORKING!!!!

Sat Dec 29, 2012 12:00 am

canibalimao wrote:
croston wrote:If you gpio.setmode (gpio.BOARD) you can use the P1 numbers rather than the broadcom numbers. The cleanup function resets every channel used by your program to the system default (input+no pullup/down). It is pointless calling it at the beginning of your script.
The cleanup in the beginning is a very good principle. Sometimes we use programs that don't clean the outputs, or we break a program (ctrl+c) before it reaches the clean function, so it's really usefull have that function in the beggining.
The cleanup() function will do nothing at the beginning of your code and is completely pointless. The module remembers which channels you have set up using setup() calls in your script and only cleans those up. Therefore calling cleanup() at the start does nothing. It does this so that any other GPIO processes using other channels are not trampled.

User avatar
rpdom
Posts: 15577
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Help, GPIO is NOT WORKING!!!!

Sat Dec 29, 2012 7:46 am

kirby2ig wrote:I tested every gpio pin and found that the 3.3v line gives 1.8v instead and some gpio pins provide 5v and some provide 1.8v. I don't know what to do. Does anyone know what is wrong with my pi? :?:
Have you checked that you're really measuring between ground (0v) and the GPIO pins?

If you accidentally measured between 5v and 3.3v you would see around 1.7v, which is suspiciously close to your 1.8v reading. Also, measuring between 5v and a GPIO pin set to low, would show 5v.

texy
Forum Moderator
Forum Moderator
Posts: 5160
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: Help, GPIO is NOT WORKING!!!!

Sat Dec 29, 2012 8:38 am

kirby2ig wrote:I tested every gpio pin and found that the 3.3v line gives 1.8v instead and some gpio pins provide 5v and some provide 1.8v. I don't know what to do. Does anyone know what is wrong with my pi? :?:
There is nothing wrong with your Pi, but the way you are measuring the voltages is incorrect. You jump to conclusions very quickly.
Perhaps one of the mods should retitle the thread.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

Return to “General discussion”