The sketch for this project can be downloaded from my GitHub page here.
The ML8511 is a UV detector made by Lapis Semiconductor, it operates at 3.3 volts and has a maximum response at 365nm, covering UVA and UVB. Some versions of the breakout board, like the Sparkfun need to be operated at 3.3 volts, while others have a 5v to 3.3volt regulator. There are four connections Vcc (either 5v or 3.3v, check!), Gnd, Output and EN. For the ML8511 to operate it must be at 3.3 volts.
The ML8511 is a very accurate device and the output voltage is proportional to the UV light shining on it. The sketch I used, from Sparkfun, shows the UV intensity in milli watts per square centimeter.
Connect Vcc to either 5 volts or 3.3 volts (Check board first!!), if your board can operate from 5 volts it will often have a pin marked 3.3 volts. This is an OUTPUT, do not connect 3.3 volts to this pin or you will probably burn the regulator. OUT is the signal output, connect this to Arduino pin A0. The last pin EN should be connected to the Arduino 3.3 volt pin, regardless of whether you power it from 5 volts or 3.3, finally connect the Arduino 3.3volt pin to Arduino pin A1. This 3.3 volts is very accurate and the output from the UV device will be compared with this to get an accurate reading.
Download the sketch from GitHub page here and upload to your Arduino, switch to the Serial Monitor (9600) to see the output.
This shows the output with a UV torch shining on the sensor.
This shows the output with no UV light on the sensor