Analogue Light Dependent Resistor (LDR)

Analogue Light Dependent Resistor LDRThe Raspberry Pi works on digital signals - one or off.  Analogue can be any value and normally the Raspberry Pi requires an Analogue to Digital converter.

I have one connected to a 2m length of cable and one connected to a 20cm length of cable.

Requires a 1uf Capacitor

Resource - http://learn.adafruit.com/basic-resistor-sensor-reading-on-raspberry-pi

Takes a parameter of RCpin.  This is the pin where the resistor is connected to.  I have 2 connected to the system, one inside, one out.  The inside sensor is basically dark all day.

###################################################################

def RCtime(RCpin):
    reading = 0
    GPIO.setup(RCpin, GPIO.OUT)
    GPIO.output(RCpin, GPIO.LOW)
    time.sleep(0.1)

    GPIO.setup(RCpin, GPIO.IN)
    # This takes about 1 millisecond per loop cycle
    while (GPIO.input(RCpin) == GPIO.LOW):
        reading += 1
        if reading > 200:
            break
    return reading

def pdslight(GPIOPIN):
    if debug:
        print("Reading light " + str(GPIOPIN))
    x=0
    loops=5
    for y in range(0,loops):
        x = x + RCtime(GPIOPIN)
    x = x/loops
    if debug:
        print("Reading light " + str(GPIOPIN) + " " + str(x) )
    return x
##################################################################
LDR Photoresistor Photoresistor Light Detection Sensor Module Arduino PIC PI 5V
LDR Photoresistor Photoresistor Light Detection Sensor Module Arduino PIC PI 5V $1.95
End Date: Monday Apr-29-2019 7:59:48 PDT
Buy It Now for only: $1.95
20pcs photoresistor LDR CDS 5mmlight dependent resistor sensor gl5516 arduino AT
20pcs photoresistor LDR CDS 5mmlight dependent resistor sensor gl5516 arduino AT $2.25
End Date: Wednesday May-1-2019 8:44:01 PDT
Buy It Now for only: $2.25
15pcs photoresistor LDR CDS 5mmlight dependent resistor sensor gl5516 arduino AT
15pcs photoresistor LDR CDS 5mmlight dependent resistor sensor gl5516 arduino AT $1.95
End Date: Thursday May-16-2019 16:26:23 PDT
Buy It Now for only: $1.95
20PCS Photoresistor LDR CDS 5mm Light Dependent Resistor Sensor GL5516 M265
20PCS Photoresistor LDR CDS 5mm Light Dependent Resistor Sensor GL5516 M265 $3.50
End Date: Thursday May-9-2019 20:24:02 PDT
Buy It Now for only: $3.50
20pcs Photoresistor 5MM GL5537 LDR Photo Resistors Light Dependent Resistor M266
20pcs Photoresistor 5MM GL5537 LDR Photo Resistors Light Dependent Resistor M266 $3.50
End Date: Monday May-13-2019 20:15:26 PDT
Buy It Now for only: $3.50
20PCS Photoresistor LDR CDS 5mm Light Dependent Resistor Sensor GL5516 Arduino
20PCS Photoresistor LDR CDS 5mm Light Dependent Resistor Sensor GL5516 Arduino $0.99
End Date: Monday May-20-2019 12:14:38 PDT
Buy It Now for only: $0.99
10pcs Photoresistor 5MM GL5537 LDR Photo Resistors Light Dependent Resistor
10pcs Photoresistor 5MM GL5537 LDR Photo Resistors Light Dependent Resistor $1.95
End Date: Tuesday Apr-30-2019 13:01:59 PDT
Buy It Now for only: $1.95
LDR Photoresistor Photoresistor Light Detection Sensor Module Arduino PIC PI 5V
LDR Photoresistor Photoresistor Light Detection Sensor Module Arduino PIC PI 5V $0.99
End Date: Saturday May-11-2019 20:59:59 PDT
Buy It Now for only: $0.99
3 5 10Pcs 12mm light sensitive dependent resistor CDS LDR photoresistor GL12528
3 5 10Pcs 12mm light sensitive dependent resistor CDS LDR photoresistor GL12528 $5.46
End Date: Thursday May-23-2019 13:33:29 PDT
Buy It Now for only: $5.46
5 PCs Photoresistor GL5537 LDR Photo Resistors Light Dependent Resistor US Selle
5 PCs Photoresistor GL5537 LDR Photo Resistors Light Dependent Resistor US Selle $2.25
End Date: Tuesday May-21-2019 19:24:19 PDT
Buy It Now for only: $2.25

« Previous12345...910

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>