I'm trying to detect an LED light using a phototransistor and Pi3. I don't know how and where to start with the code for the RaspPi to detect light using phototransistor. may you please help, this is for my final year project. Thanks in advance
I also want to use a photo transistor to detect the leds on my google home when it speaks. I have chosen to buy a ready made detector circuit for a few pounds off ebay (amazon also do them) This connects to GPIO pins and has a digital output if the light gets to a level which is adjustable on the detector. I already have a very similar device with a microphone on instead of the photo transistor and that works really well so I am hopefull the light sensor one will. There are 2 versions, one with a photo transistor and one with a light sensitive resistor. You might want to consider it.
My sound circuit is connected to the 2nd pin of the GPIO There are 2 bits of code.
# setup Pi's GPIO (define pin #2 as input pin) GPIO.setmode(GPIO.BCM) # use board pin numbers pin = 2 GPIO.setup(pin, GPIO.IN) #create a loop to catch a change in the digital output while GPIO.input(pin)==0: a=0 #do nothing #start do something code here e.g. print("the light is there")