Difference between revisions of "Photosensitive sensor"

From ElectroDragon
Jump to navigation Jump to search
(Redirected page to Light sensor)
 
Line 1: Line 1:
== Schematic ==
+
#redirect [[Light sensor]]
<gallery>
 
File:Photoresistor Light-Sensitive Module.png| CdS 5528 photocell schematic breakout
 
File:GY2561_sch.JPG | TSL2561 schematic
 
</gallery>
 
=== Arduino Demo Code BH1750 ===
 
* See pin difinition on left image
 
[[File:Specification GY30.jpg|thumbnail]]
 
<syntaxhighlight lang="Arduino">
 
#include <Wire.h> //IIC
 
#include <math.h>
 
 
 
int BH1750address = 0x23;
 
byte buff[2];
 
 
 
void setup()
 
{
 
  Wire.begin();
 
  Serial.begin(9600);
 
}
 
 
 
void loop()
 
 
 
{
 
int i;
 
uint16_t val=0;
 
BH1750_Init(BH1750address);
 
delay(200);
 
 
 
if(2==BH1750_Read(BH1750address))
 
  {
 
  val=((buff[0]<<8)|buff[1])/1.2;
 
  Serial.print(val,DEC);   
 
  Serial.println("[lx]");
 
  }
 
delay(150);
 
}
 
 
 
 
 
int BH1750_Read(int address) //
 
{
 
  int i=0;
 
  Wire.beginTransmission(address);
 
  Wire.requestFrom(address, 2);
 
  while(Wire.available()) //
 
  {
 
    buff[i] = Wire.receive();  // receive one byte
 
    i++;
 
  }
 
  Wire.endTransmission(); 
 
  return i;
 
}
 
 
 
void BH1750_Init(int address)
 
{
 
  Wire.beginTransmission(address);
 
  Wire.send(0x10);//1lx reolution 120ms
 
  Wire.endTransmission();
 
}
 
</syntaxhighlight>
 
 
 
== Guide ==
 
* Ambient light sensor
 
{| class="wikitable sortable"
 
|-
 
! Header text !! Resolution !! ADC !! output
 
|-
 
| BH1750 ||  1 - 65535 lx || 16 bit || digital
 
|-
 
| TSL2561 || 0.1 - 40,000+ || 16 bit || digital
 
|-
 
| TEMT6000 || - || - ||
 
|-
 
| CdS cell 5528 || - || -
 
|}
 
== Documents  ==
 
BH1750
 
* [http://www.youtube.com/watch?v=Iv0oTxw-L3c BH1750 demo video]
 
* [[File:Bh1750fvi-e.pdf]] - BH1750 Datasheet
 
* [[:File:BH1750_demo_code.zip|BH1750 demo code]]
 
TSL2561
 
* [[:File:TSL2561.pdf| TSL2561 datasheet]]
 
* [[:File:Arduino_tsl2561.zip|TSL2561 arduino demo code]]
 
* [https://github.com/sparkfun/SparkFun_TSL2561_Arduino_Library/tree/V_1.1.0 TSL2561 github library]
 
5528
 
* [[:File:SEN-09088-datasheet.pdf|5528 Photoresistive Sensor]]
 
 
 
 
 
[[category:Sound, light, etc]]
 

Latest revision as of 12:07, 4 December 2016

Redirect to: