This is the ML8511 Ultra Violate Light Sensor, which is suitable for acquiring UV intensity indoor or outdoor. The ML8511 equipped with internal amplifier which converts photo-current to voltage depending on UV intensity, and offers you an easy interface to external circuits.
Applications
Smart Phone, Watch, Weather Station, Navigation, Gaming, UV Radiation-Quantity Monitoring, Skin Care, Aging, Sterilization and Washing.
The ML8511 detects 280~390nm light most effectively and categorized as part of the UVB Burning Rays Spectrum and UVA Tanning Rays Spectrum.
Features
- Photodiode sensitive to UVA and UVB
- Embedded Operational Amplifier
- Analog Voltage Output
- Low Supply Current (300uA typ.) and low standby current (0.1uA typ.)
- Small and thin surface mount package (4.0mm x 3.5mm x 0.73mm)
Required Components
- Arduino Microcontrollers, Teensy (Teensyduino Integrated), ESP8266 (ESP8266 Arduino IDE Integrated), DigiSpark, STM32, AVR
- ML8511 Breakout Board / ML8511 SMP Chip (See the Schematics Diagram & Refer to ML511 Datasheet)
- Jumper Wire / DuPont Wire
- Solder-less Breadboard
- LCD Display (Optional)
Wiring Diagram
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
int SensorPin = A1; //Output from the sensor int REF = A2; //3.3V power on the Arduino board void setup() { Serial.begin(9600); pinMode(SensorPin, INPUT); pinMode(REF, INPUT); Serial.print("-----------------------------"); Serial.println("14CORE | ML8511 TEST CODE"); Serial.println("-----------------------------"); } void loop() { int uvLevel = averageAnalogRead(SensorPin); int refLevel = averageAnalogRead(REF); //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.8, 0.0, 15.0); //Convert the voltage to a UV intensity level Serial.print("output: "); Serial.print(refLevel); Serial.print("ML8511 output: "); Serial.print(uvLevel); Serial.print(" / ML8511 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 //From: http://forum.arduino.cc/index.php?topic=3922.0 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; } |
Downloads
Download ML8511 Datasheet | PDF
Wiring the ML8511 Ultra Violet Light Sensor on Microcontroller
Hi, when I add this code to arduino, the following will be shown on the serial monitor:
ets Jan 8 2013,rst cause:4, boot mode:(3,6)
wdt reset
load 0x4010f000, len 3584, room 16
tail 0
chksum 0xb0
csum 0xb0
v2843a5ac
~ld