Home Chipkit VEML6075 ultraviolet light sensor and Chipkit

VEML6075 ultraviolet light sensor and Chipkit

by shedboy71

Another ultraviolet sensor hits our test desk in this example, we will be looking at the VEML6075 this time. Lets look at the sensor first of all

The VEML6075 senses UVA and UVB light and incorporates photodiode, amplifiers, and analog / digital circuits into a single chip using a CMOS process. When the UV sensor is applied, it is able to detect UVA and UVB intensity to provide a measure of the signal strength as well as allowing for UVI measurement.

The VEML6075 provides excellent temperature compensation capability for keeping the output stable under changing temperature. VEML6075’s functionality is easily operated via the simple command format of I2C (SMBus compatible) interface protocol. VEML6075’s operating voltage ranges from 1.7 V to 3.6 V.

 

Shopping List

 

Amount Part Type
1 VEML6075
1 Best Price Square TDGL003, CHIPKIT, MAX32, DEV BOARD CHIPKIT MAX32 By DIGILENT

 

Schematics/Layout

Another simple I2C sensor that uses 3.3v and GND, here is layout for you

max32 and VEML6075 layout

max32 and VEML6075 layout

Code

Again we use a library but I had to modify it to work for the chipKit, you can download that from the link here – VEML6075-master

[codesyntax lang=”cpp”]

/*
 * test-veml6075.ino
 *
 * Simpel sketch to test if a given board words.
 *
 * Author: Sean Caulfield <sean@yak.net>
 * License: GPLv2.0
 *
 */

#include <Arduino.h>
#include <Wire.h>
#include <VEML6075.h>

VEML6075 veml6075 = VEML6075();
bool found = false;

void setup() {
  delay(1000);
  Serial.begin(57600);
  Wire.begin();
  if (!veml6075.begin()) {
    Serial.println(F("VEML6075 not found!"));
  } else {
    found = true;
  }
}

void loop() {

  if (found) {
    float value;

    // Poll sensor
    veml6075.poll();

    Serial.print(F("t = "));
    Serial.println(millis());

    value = veml6075.getUVA();
    Serial.print(F("UVA = "));
    Serial.println(value, 2);

    value = veml6075.getUVB();
    Serial.print(F("UVB = "));
    Serial.println(value, 2);

    value = veml6075.getUVIndex();
    Serial.print(F("UV Index = "));
    Serial.println(value, 1);

    uint16_t devid = veml6075.getDevID();
    Serial.print(F("Device ID = "));
    Serial.println(devid, HEX);

    Serial.println(F("----------------"));
  }

    delay(1000);
}

[/codesyntax]

 

Output

Open the serial monitor – this is what I saw in mine. I was testing this indoors at teh time

t = 1054
UVA = 31.35
UVB = 38.70
UV Index = 0.0
Device ID = 26
—————-
t = 2069
UVA = 31.35
UVB = 38.70
UV Index = 0.0
Device ID = 26
—————-

Links

https://www.vishay.com/docs/84304/veml6075.pdf

I2C Interface 3.3V Board Based on VEML6075 UVA UVB Light Sensor Module

Share

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More