'2) Sensor/UV'에 해당되는 글 1건

  1. 2016.09.08 ML8511 UV Sensor (GYML8511) [S083]

ML8511 UV Sensor (GYML8511) [S083]

 


 

https://www.youtube.com/watch?v=R-o1q9Vmtk4


*GitHub : https://github.com/rdiot/rdiot-s083.git

 

* Specs
The ML8511 breakout is an easy to use ultraviolet light sensor. The MP8511 UV (ultraviolet) Sensor works by outputing an analog signal in relation to the amount of UV light that's detected.
This breakout can be very handy in creating devices that warn the user of sunburn or detect the UV index as it relates to weather conditions.
This sensor detects 280-390nm light most effectively.
This is categorized as part of the UVB (burning rays) spectrum and most of the UVA (tanning rays) spectrum.
It outputs a analog voltage that is linearly related to the measured UV intensity (mW/cm2).
If your microcontroller can do an analog to digital signal conversion then you can detect the level of UV!

 

* Contents
- Connect
VIN ----- X
3V3 ----- 3.3V
GND ----- GND
OUT ----- A0
EN ----- A1

 

- Key Code
int UVOUT = A0; //Output from the sensor
int REF_3V3 = A1; //3.3V power on the Arduino board

 

int uvLevel = averageAnalogRead(UVOUT);
int refLevel = averageAnalogRead(REF_3V3);

 

//Use the 3.3V power pin as a reference to get a very accurate output value from sensor
float outputVoltage = 3.3 / refLevel * uvLevel; 
float uvIntensity = mapfloat(outputVoltage, 0.99, 2.9, 0.0, 15.0);

 

lcd.print("uv=" + (String)uvIntensity + "(mW/cm^2)");


//The Arduino Map function but for floats
float mapfloat(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

'2) Sensor > UV' 카테고리의 다른 글

ML8511 UV Sensor (GYML8511) [S083]  (0) 2016.09.08
Posted by RD IoT RDIoT

댓글을 달아 주세요