You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, just make sure it has I2C, then port the code - its pretty simple stuff!
- Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
- Connect GND to common power/data ground
- Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
- Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2
The VEML6075 has a default I2C address of 0x10 and cannot be changed!
Lets begin by installing all the libraries we need. Open up the library manager in Arduino IDE
Search for and install the latest version of the Adafruit VEML6075 library
And the Adafruit BusIO library
Start by opening up the Adafruit VEML6075 -> simpletest under the Adafruit VEML6075 library:
And upload it to your board!
Open up the serial console to see the readings. I used a UV lamp to shine some UV light on it. Note that indoors with office lighting you may get very low or even negative values.
For 99% of users, the default configuration is recommended because we use the calibration values from the VEML6075 app note for a non-covered sensor (no glass or teflon filter). You'll get the most accurate results that way.
If you do want to change settings here's what you can adjust:
- Integration time - this will take readings over a shorter or longer period of time, default is 100ms If changed the UV Index calculated value will not be correct anymore
- Normal/High Dynamic mode - We're not sure what this is (it isn't described) but the default is Normal. If changed the UV Index calculated value will not be correct anymore
- Forced/Continuous mode - Whether to get continuous readings or require reading only on request. Default is reading only on request
- UV Coefficients - These are the calibration numbers that will convert the raw UVA/UVB readings into a UV Index. We use the defaults for "No teflon, open air" from the App note for the 6 floating point values. If you plan to cover the sensor with a thin teflon sheet, you can use those other values to configure the calculation