Difference between revisions of "Photo Cell Sensor"
Katherine.d (talk | contribs) (→Hardware) |
Katherine.d (talk | contribs) (→Specifications) |
||
Line 37: | Line 37: | ||
| align=center style="width:200px" |Supply current | | align=center style="width:200px" |Supply current | ||
| align=center style="width:200px" |0.5~3mA | | align=center style="width:200px" |0.5~3mA | ||
+ | |} | ||
+ | |||
+ | === Photoresistor characteristics === | ||
+ | |||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! align=left style="width:200px" |Items | ||
+ | ! align=left style="width:100px" |Conditions | ||
+ | ! align=left style="width:100px" |Min | ||
+ | ! align=left style="width:100px" |Type | ||
+ | ! align=left style="width:100px" |Max | ||
+ | ! align=left style="width:100px" |Unit | ||
+ | |- | ||
+ | | align=left style="width:200px" |Light Resistance | ||
+ | | align=left |10lux | ||
+ | | align=left |8 | ||
+ | | align=left |- | ||
+ | | align=left |20 | ||
+ | | align=left |kΩ | ||
+ | |- | ||
+ | | align=left style="width:200px" |Dark Resistance | ||
+ | | align=left |0lux | ||
+ | | align=left |- | ||
+ | | align=left |1 | ||
+ | | align=left |- | ||
+ | | align=left |kΩ | ||
+ | |- | ||
+ | | align=left style="width:200px" |100γ10 | ||
+ | | align=left |- | ||
+ | | align=left |- | ||
+ | | align=left |0.6 | ||
+ | | align=left |- | ||
+ | | align=left |- | ||
+ | |- | ||
+ | | align=left rowspan=2 style="width:200px" |Response Time | ||
+ | | align=left |Rising | ||
+ | | align=left |- | ||
+ | | align=left |20 | ||
+ | | align=left |- | ||
+ | | align=left |s | ||
+ | |- | ||
+ | | align=left |Falling | ||
+ | | align=left |- | ||
+ | | align=left |30 | ||
+ | | align=left |- | ||
+ | | align=left |s | ||
+ | |- | ||
+ | | align=left style="width:200px" |Peak Wavelength | ||
+ | | align=left |- | ||
+ | | align=left |- | ||
+ | | align=left |540 | ||
+ | | align=left |- | ||
+ | | align=left |nm | ||
+ | |- | ||
+ | | align=left style="width:200px" |Ambient Temperature | ||
+ | | align=left |- | ||
+ | | align=left |-30 | ||
+ | | align=left |- | ||
+ | | align=left |+70 | ||
+ | | align=left |°C | ||
|} | |} | ||
Revision as of 02:27, 7 December 2012
Contents
Introduction
This photo cell sensor module uses the GL5528 photoresistor to detect the light intensity of environment. An Op-amp LM358 is configured as a “voltage follower” to decease influence of resistance variation when light intensity changes.
Features
- 2.54mm general interface
- Wide supply voltage range: 3V–30V
- 2.0cm x 2.0cm module
- Application fields widely
Schematic
Specifications
Key specification
Items | Min |
---|---|
PCB Size | 2.0cm*2.0cm |
Interface | 2.54mm pitch pin header |
IO structure | SIG,VCC,GND,NC |
VCC | 3~30V Type:5V |
Supply current | 0.5~3mA |
Photoresistor characteristics
Items | Conditions | Min | Type | Max | Unit |
---|---|---|---|---|---|
Light Resistance | 10lux | 8 | - | 20 | kΩ |
Dark Resistance | 0lux | - | 1 | - | kΩ |
100γ10 | - | - | 0.6 | - | - |
Response Time | Rising | - | 20 | - | s |
Falling | - | 30 | - | s | |
Peak Wavelength | - | - | 540 | - | nm |
Ambient Temperature | - | -30 | - | +70 | °C |
Usage
Hardware
Connect the module to the MCU the 2.54mm pitch pin header, then you can get a voltage value based on the light intensity of the environment.
Using these data, you can make your own application according to your requirement.
Programming
The program below uses the photo cell sensor to control the LED. As the picture shows above, the photo cell sensor is connected to analog port 0 and the LED is connected to port 12.
The resistance of the photoresistor which stands for light value can be calculated based on the voltage obtained through the analog port. Then you can use this data to control the LED or other thing you like.
<syntaxhighlight lang="c">
- include <math.h>
const int ledPin=12; //Connect the LED Grove module to Pin12, Digital 12 const int thresholdvalue=10; //The treshold for which the LED should turn on. Setting it lower will make it go on at more light, higher for more darkness
void setup() {
Serial.begin(9600); //Start the Serial connection pinMode(ledPin,OUTPUT); //Set the LED on Digital 12 as an OUTPUT
} void loop() {
int sensorValue = analogRead(0); float Rsensor; Rsensor=(float)(1023-sensorValue)*10/sensorValue; if(Rsensor>thresholdvalue) { digitalWrite(ledPin,HIGH); } else { digitalWrite(ledPin,LOW); } Serial.println(Rsensor,DEC);
}
</syntaxhighlight>