Page 1 of 1

Help, GPIO is NOT WORKING!!!!

Posted: Fri Dec 28, 2012 2:37 pm
by kirby2ig
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.

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

Posted: Fri Dec 28, 2012 3:46 pm
by joan
The gpios are 3.3V.

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

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

Posted: Fri Dec 28, 2012 5:56 pm
by kirby2ig
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)

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

Posted: Fri Dec 28, 2012 6:01 pm
by joan
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

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

Posted: Fri Dec 28, 2012 6:11 pm
by croston
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.

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

Posted: Fri Dec 28, 2012 6:17 pm
by MattHawkinsUK
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.

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

Posted: Fri Dec 28, 2012 8:17 pm
by kirby2ig
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

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

Posted: Fri Dec 28, 2012 8:34 pm
by canibalimao
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.

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

Posted: Fri Dec 28, 2012 10:40 pm
by kirby2ig
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? :?:

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

Posted: Sat Dec 29, 2012 12:00 am
by croston
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.

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

Posted: Sat Dec 29, 2012 7:46 am
by rpdom
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.

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

Posted: Sat Dec 29, 2012 8:38 am
by texy
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