아날로그 자외선 센서 ML8511
(Analog UV Sensor -ML8511)
개요
- 본 제품은 ML8511 자외선 센서입니다.
- 검출된 자외선의 양에 따라 아날로그 전압 출력을 출력하는 센서입니다.
- 자외선을 경고하거나 UV 인덱스 값을 알아내기 위해 사용하면 좋은 제품입니다.
- 280-390nm 파장(UVB-Burning Ray 및 UVA(tanning ray)의 빛을 가장 효과적으로 검출합니다.
- UV 강도(mW/cm2)에 선형으로 비례하여 아날로그 전압을 출력하기 때문에 아두이노와 같은 마이크로컨트롤러의 ADC에 연결하여 사용하기 편리합니다.
특징
- n/a
문서
- Datasheet
- 아두이노와 아래와 같이 연결합니다.
- 아래의 소스코드를 아두이노에 업로드 합니다.
/*
MP8511 UV Sensor Read Example
The MP8511 UV Sensor outputs an analog signal in relation to the amount of UV light it detects.
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.
There's lots of good UV radiation reading out there:
*/
//Hardware pin definitions
int UVOUT = A5; //Output from the sensor
int REF_3V3 = A4; //3.3V power on the Arduino board
void setup()
{
Serial.begin(9600);
pinMode(UVOUT, INPUT);
pinMode(REF_3V3, INPUT);
Serial.println("MP8511 example");
}
void loop()
{
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);
Serial.print("MP8511 output: ");
Serial.print(uvLevel);
Serial.print(" MP8511 voltage: ");
Serial.print(outputVoltage);
Serial.print(" UV Intensity (mW/cm^2): ");
Serial.print(uvIntensity);
Serial.println();
delay(100);
}
//Takes an average of readings on a given pin
//Returns the average
int averageAnalogRead(int pinToRead)
{
byte numberOfReadings = 8;
unsigned int runningValue = 0;
for(int x = 0 ; x < numberOfReadings ; x++)
runningValue += analogRead(pinToRead);
runningValue /= numberOfReadings;
return(runningValue);
}
//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;
}- 결과값
연관제품
- 연관제품 1