Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
ccPegasus
Published

Photoresistor Brightness Sensor

Use a photoresistor to measure brightness!

BeginnerFull instructions provided4,159
Photoresistor Brightness Sensor

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×3
Photo resistor
Photo resistor
×1
Resistor 100k ohm
Resistor 100k ohm
×1
9V battery (generic)
9V battery (generic)
(Optional)
×1
9V Battery Clip
9V Battery Clip
(Optional)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino Web Editor
Arduino Web Editor

Story

Read more

Schematics

photoresistor-circuit_l0L3AxxPwf.png

Code

CODE

Arduino
int sensorPin = A0; // select the input pin for LDR

int sensorValue = 0; // variable to store the value coming from the sensor

void setup() {
  Serial.begin(9600); //sets serial port for communication
}
void loop() {
  sensorValue = analogRead(sensorPin); // read the value from the sensor
  Serial.println(sensorValue); //prints the values coming from the sensor on the screen
  
  delay(100);
}

Credits

ccPegasus

ccPegasus

0 projects • 0 followers

Comments