The circuit I currently have can be seen in the diagram here: https://1drv.ms/u/s!AhMZRFFD7BsbgtkFxjBWf530_5oWkQ
A photo of my voltage divider can be seen here (all resistors are 10K, so 2 are used to make 20K in one half of the divider. The diode is a 3.3V zener diode. Black wire is 5V sensor output, purple is 3.3V and goes to Pi for reading, grey goes to Pi ground): https://1drv.ms/u/s!AhMZRFFD7BsbgtkI-0mgk-KPkEnpHA
This is the Python code I'm using to read the GPIO pin:
It just prints out zeros, even when it is sunny (the sensor has an LED indicator on it so I know when it is sunny and a 1 should be printed)
Code: Select all
import RPi.GPIO as gpio import time gpio.setmode(gpio.BCM) gpio.setup(17, gpio.IN, pull_up_down = gpio.PUD_DOWN) while True: print(gpio.input(17)) time.sleep(1)
I'd really appreciate some help as I've been trying for over a week to get this to work and have run out of ideas now. Thanks!