UV Sensor VEML6075

Updated on 3 September 2021
dev board Adafruit Feather Bluefruit
chip nRF52
chip VEML6075
This tutorial is more than 1 year old. If the steps below do not work, then please check the latest versions and the documentations of the individual tools used.

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Pre-requisites

Try these simpler or similar examples:

Buy the components

Code

Download code sensor-uv.ino
#include "Adafruit_VEML6075.h"

Adafruit_VEML6075 uv = Adafruit_VEML6075();

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);

  Serial.begin(115200);
  Serial.println("VEML6075 Full Test");

  if (!uv.begin()) {
    Serial.println("Failed to communicate with VEML6075 sensor, check wiring?");
  }

  Serial.println("Found VEML6075 sensor");
}

void loop() {
  Serial.println("");

  Serial.print("Raw UVA reading:  ");
  Serial.println(uv.readUVA());

  Serial.print("Raw UVB reading:  ");
  Serial.println(uv.readUVB());

  Serial.print("UV Index reading: ");
  Serial.println(uv.readUVI());

  // turn the LED on (HIGH is the voltage level)
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);

  // turn the LED off by making the voltage LOW
  digitalWrite(LED_BUILTIN, LOW);
  delay(2000);
}

Makefile

.PHONY: lint compile upload clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

compile:
	arduino-cli compile --fqbn adafruit:nrf52:feather52832 ./

upload:
	adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application ./.*.hex dfu-package.zip
	adafruit-nrfutil dfu serial --package dfu-package.zip -p /dev/tty.SLAB_USBtoUART -b 115200

clean:
	rm -f .*.bin
	rm -f .*.elf
	rm -f .*.hex
	rm -f *.zip

flash: lint compile upload clean

Schematic

Wire up the hardware accordingly

UV Sensor VEML6075 schematic

Serial console

Serial output from the firmware.

UV Sensor VEML6075 serial console

Description

Read the UV sensor values with Adafruit nRF52 Feather and Adafruit VEML6075 breakout board.