Puzzle - Light Sensor 光敏传感器

来自Duinopeak_COM
跳转至: 导航搜索

产品简介

光敏传感器,也叫做光敏电阻,当环境光强增大时,电阻减小。

Light-sensor.png

规格参数

  • 工作电压:3-5V
  • 工作电流:0.5-3mA
  • 光电阻:20KΩ
  • 暗电阻:1MΩ
  • 响应时间:20-30mS
  • 波长阈值:540nm
  • 工作温度:-30~70 ℃

应用示例

Puzzle Light sensor connection.jpg

接下来这个示例将演示如何用光控制LED——当环境光变弱时,LED就被点亮了。将Puzzle - Light Sensor接至模拟口A0,Puzzle - LED接至数字口12。

/*
  Puzzle- Light Sensor demo v1.0
  signal wire to A0.
*/
#include <math.h>
const int ledPin=12;                     //Connect the LED Puzzle module to Pin12, Digital 12
const int thresholdvalue=10;             //The treshold for which the LED should turn on. 
                                         // Setting thresholdvalue lower will make it go on at more light, higher for more darkness
int sensorValue;                         
float Rsensor;                           //Resistance of sensor in K
                                         
void setup() {
   Serial.begin(9600);                   //Start the Serial connection
   pinMode(ledPin,OUTPUT);               //Set the LED on Digital 12 as an OUTPUT
}
void loop() {
   sensorValue = analogRead(0); 
   Rsensor=(float)(1023-sensorValue)*10/sensorValue;
   if(Rsensor>thresholdvalue)
    {
        digitalWrite(ledPin,HIGH);
    }
   else
   {
       digitalWrite(ledPin,LOW);
   }
  Serial.println("the analog read data is ");
  Serial.println(sensorValue);
  Serial.println("the sensor resistance is ");
  Serial.println(Rsensor,DEC);           //show the ligth intensity on the serial monitor;
  delay(1000);
}


资源


Puzzle - Light Sensor 光敏传感器原理图PDF: 文件:Puzzle Light sensor schematic.pdf

Puzzle - Light Sensor 光敏传感器芯片LM358数据手册: 文件:Puzzle Light senseor LM358 datasheet.pdf

如何购买

Duinopeak 官方淘宝商城
Light Sensor 光敏传感器购买链接

支持

如果你有什么建议或者好的点子, 你可以来我们的DuinoPeak论坛参与讨论.

外部链接

链接到外部网页将会给你提供更多应用创意,文档/数据表或软件库

视频