UV sensor ML8511 with TinkerPie
How strong is the sunshine? Sunscreen reminders.
| Type | Analog sensors |
|---|---|
| Connect to | P10-P13 |
| Gives | UV level 0-15 |
| Simulator | Yes: a control appears under the simulated board |
How it works
The ML8511 is sensitive to ultraviolet light (UV-A and UV-B), the invisible part of sunlight that causes sunburn. Its output voltage rises with UV strength, and TinkerPie turns it into an approximate UV level.
How to wire it
Plug the module's A0 / OUT into P10 (or P11-P13 when Wi-Fi is off), VCC to 3.3 V, GND to GND.
Code
In blocks: Accessories category in TinkerPie Studio. As code:
// JavaScript
sensors.uvIndex(Pin.P10)
// Arduino C++
sensors::uvIndex(Pin::P10) Good to know
- Give it real sunlight; indoor lamps give almost no UV.
- The UV level is an estimate, good for learning and comparisons.
- Glass blocks much UV-B, so test outdoors.
Similar modules
- Potentiometer (knob)
- Soil moisture sensor
- Light sensor module (LDR)
- Sound sensor module
- Gas / smoke sensor MQ-2
- Air quality sensor MQ-135
- Rain drop sensor
- Water level sensor
More projects to try
Questions
Can I try the UV sensor ML8511 without buying one?
Yes. In TinkerPie Studio the simulator shows a control for it under the board, so you can test your program before you build it.
Is the reading the official UV index?
It is a good estimate for learning. Weather services use calibrated instruments for the official UV index.