This is the VEML6040 i2c driven color sensor that sense RED, GREEN, BLUE, & WHITE (RGBW) light. This device incorporates a photo-diodes, amplifiers, & analog / digital circuitry into a single chip using CMOS process. When using a sensor the brightness and color temperature of back-light can be change or adjusted base on surroundings / ambient light source that makes the panel more comfortable in eyes. The VEML6040 provides an excellent temperature compensation capability for stable output under changing temperature. This device runs power range of 2.5v to 3.6v with i2c / SMBus compatible. Suitable for handheld devices, laptops and notebook, tablets, & industrial / mechanical applications. For more details about timings / interfaces and bus operations please refer to the datasheet below.
Required Components
- Arduino IDE | Atmel Studio | Energia | Processing
- Arduino PRO, FIO, NANO, UNO, MINI, MEGA, PRO MINI, LEO, BT, DUE, ETHERNET,LILYPAD, NodeMCU, Teensy Board, TeensyDuino, ESP8266 12, 12E, ESP32, LinkItOne, ESP8266 NodeMCU, ESPDuino, ATMEGA328 16/12, ATMEGA32u4 16/8/ MHz, ESP8266, MSP430 ,ATMEGA250 16 MHz, ATSAM3x8E, STM32.
- Note: For AVR (If your using AVR please see the flash size of the MCU)
- Note: The Diagram below is using NANO. (please refer to each MCU’s respective pin-outs & bus configurations)
- VEML6040 Color Sensor IC / Module
- Capacitors (See below required values)
- Resistors (See below required values)
- PCB Designer (Circuit simulation to PCB Layout)
Wiring Guide
Source Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
#include <Wire.h> #include <VEML6040.h> int x = 0; void setup() { Serial.begin(115200); Wire.begin(); VEML6040.init(); Serial.println("14CORE | VEML6040 TEST CODE"); VEML6040.VEML6040_forceMode(); VEML6040.VEML6040_trigger(); delay(1000); } void loop() { measureLight(); Serial.println(); delay(500); VEML6040.VEML6040_trigger(); } void measureLight() { uns16 uv, red, blue, green, white; uv = VEML6040.getUV(); red = VEML6040.getRed(); green = VEML6040.getGreen(); blue = VEML6040.getBlue(); white = VEML6040.getWhite(); Serial.println("VEML6040 DATA"); Serial.println(); Serial.print("VEML6070 UV:\t"); Serial.println(uv); Serial.println(); Serial.print("Red:\t"); Serial.print(red); Serial.println(); Serial.print("\tGreen:\t"); Serial.print(green); Serial.println(); Serial.print("\tBlue:\t"); Serial.print(blue); Serial.println(); Serial.print("\tWhite:\t"); Serial.println(white); } |
Downloads