GY-21P module example connected to an Arduino Due

The GY-21P is a module that combines a BMP280 sensor and an SI7021 sensor. The on-board BMP280+SI7021 sensor measures atmospheric pressure from 30kPa to 110kPa as well as relative humidity and temperature.

A quick look at both sensors

BMP280
Pressure range: 300-1100 hPa (9000 meters above sea level at -500m)
Relative accuracy (at 950 – 1050 hPa at 25 ° C): ± 0.12 hPa, equiv. to ± 1 m
Absolute accuracy (at (950 – 1050 hPa, 0 – +40 ° C): ± 0.12 hPa, equiv. To ± 1 m
Mains voltage: 1.8V – 3.6V
Power consumption: 2.7µA at 1Hz readout rate
Temperature range: -40 to + 85 ° C

SI7021
HVAC/R
Thermostats/humidistats
Respiratory therapy
White goods
Indoor weather stations
Micro-environments/data centers
Automotive climate control and defogging
Asset and goods tracking
Mobile phones and tablets
Size: 1.3*1cm/0.51*0.39″

Features:

Operation Voltage: 3.3V
I2C & SPI Communications Interface
Temp Range: -40C to 85C
Humidity Range: 0 – 100% RH, =-3% from 20-80%
Pressure Range: 30,000Pa to 110,000Pa, relative accuracy of 12Pa, absolute accuracy of 100Pa
Altitude Range: 0 to 30,000 ft (9.2 km), relative accuracy of 3.3 ft (1 m) at sea level, 6.6 (2 m) at 30,000 ft.

Parts List

name Link
Arduino Due Black Due R3 Board DUE-CH340 ATSAM3X8E ARM Main Control Board with 50cm USB Cable CH340G for arduino
GY-21p module Atmospheric Humidity Temperature Sensor Breakout Barometric Pressure BMP280 SI7021 for Arduino GY-21P
connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

Connection

Arduino Due GY21-p module
3v3 Vin
Gnd Gnd
20 – SDA SDA
21 – SCL SCL

Code

You need to use a variety of Adafruit libraries, i basically took the default examples and made the following out of them

https://github.com/adafruit/Adafruit_Sensor

https://github.com/adafruit/Adafruit_BMP280_Library

https://github.com/adafruit/Adafruit_Si7021

 

 

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include "Adafruit_Si7021.h"
 
Adafruit_BMP280 bme; // I2C
Adafruit_Si7021 sensor = Adafruit_Si7021();
 
void setup() 
{
Serial.begin(9600);
Serial.println("BMP280 and SI7021 (GY-21p) test");
 
if (!bme.begin()) 
{ 
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
while (1);
}
 
if (!sensor.begin()) 
{
Serial.println("Did not find Si7021 sensor!");
while (true);
}
}
 
void loop() 
{
Serial.println("BMP280 results");
Serial.print("Temperature = ");
Serial.print(bme.readTemperature());
Serial.println(" *C");
Serial.print("Pressure = ");
Serial.print(bme.readPressure());
Serial.println(" Pa");
Serial.print("Approx altitude = ");
Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
Serial.println(" m");
Serial.println();
 
Serial.println("SI7021 results");
Serial.print("Humidity: "); 
Serial.println(sensor.readHumidity(), 2);
Serial.print("Temperature: "); 
Serial.println(sensor.readTemperature(), 2);
Serial.println();
delay(2000);
}

 

Output

OPen the serial monitor

BMP280 results
Temperature = 27.26 *C
Pressure = 99042.63 Pa
Approx altitude = 191.78 m

SI7021 results
Humidity: 31.04
Temperature: 27.30

BMP280 results
Temperature = 28.43 *C
Pressure = 99044.82 Pa
Approx altitude = 191.60 m

SI7021 results
Humidity: 32.59
Temperature: 28.56

BMP280 results
Temperature = 28.17 *C
Pressure = 99037.41 Pa
Approx altitude = 192.22 m

SI7021 results
Humidity: 32.88
Temperature: 28.46

You can see the temperature output is close between the sensors

 

Links

Atmospheric Humidity Temperature Sensor Breakout Barometric Pressure BMP280 SI7021 for Arduino

Share

Arduino Due and BMP280 barometric pressure sensor example

BMP280 is an absolute barometric pressure sensor especially designed for mobile applications. The sensor module is housed in an extremely compact package. Its small dimensions and its low power consumption allow for the implementation in battery powered devices such as mobile phones, GPS modules or watches.

As its predecessor BMP180, BMP280 is based on Bosch’s proven Piezo-resistive pressure sensor technology featuring high accuracy and linearity as well as long term stability and high EMC robustness. Numerous device operation options offer highest flexibility to optimize the device regarding power consumption, resolution and filter performance. A tested set of default settings for example use case is provided to the developer in order to make design-in as easy as possible.

Applications

– Enhancement of GPS navigation (e.g. time-tofirst-fix improvement, dead-reckoning, slope detection)

– Indoor navigation (floor detection, elevator detection)

– Outdoor navigation, leisure and sports applications

– Weather forecast

– Health care applications (e.g. spirometry)

– Vertical velocity indication (e.g. rise/sink speed)

Parameter Technical data
Operation range (full accuracy) Pressure: 300…1100 hPa
Temperature: -40…85°C
Absolute accuracy
(Temp. @ 0…+65°C)
~ ±1 hPa
Relative accuracy
p = 700…900hPa
(Temp. @ +25…+40°C)
± 0.12 hPa (typical)
equivalent to ±1 m
Average current consumption (1 Hz data refresh rate) 2.74 μA, typical
(ultra-low power mode)
Average current consumption in sleep mode 0.1 μA
Average measurement time 5.5 msec
(ultra-low power preset)
Supply voltage VDDIO 1.2 … 3.6 V
Supply voltage VDD 1.71 … 3.6 V
Resolution of data Pressure: 0.01 hPa ( < 10 cm)
Temperature: 0.01° C
Temperature coefficient offset
(+25°…+40°C @900hPa)
± 0.12 hPa (typical)
equivalent to ±1 m
Interface I²C and SPI

Parts List

name Link
Arduino DUE Black Due R3 Board DUE-CH340 ATSAM3X8E ARM Main Control Board with 50cm USB Cable CH340G for arduino
GY-21p module Atmospheric Humidity Temperature Sensor Breakout Barometric Pressure BMP280 SI7021 for Arduino GY-21P
connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

Layout

This is a layout diagram using an adafruit part, my module had clearly marked SDA and SCL connections and no SPI connection

 

arduino due and bmp280

arduino due and bmp280

Code

No libraries needed – this is a controleverything example. There are many libraries if you would rather use one of those

// Distributed with a free-will license.
// Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
// BMP280
// This code is designed to work with the BMP280_I2CS I2C Mini Module available from ControlEverything.com.
// https://www.controleverything.com/content/Barometer?sku=BMP280_I2CSs#tabs-0-product_tabset-2
 
#include<Wire.h>
 
// BMP280 I2C address is 0x76(108)
#define Addr 0x76
 
void setup()
{
  // Initialise I2C communication as MASTER
  Wire.begin();
  // Initialise Serial communication, set baud rate = 9600
  Serial.begin(9600);
}
 
void loop()
{
  unsigned int b1[24];
  unsigned int data[8];
  for (int i = 0; i < 24; i++)
  {
    // Start I2C Transmission
    Wire.beginTransmission(Addr);
    // Select data register
    Wire.write((136 + i));
    // Stop I2C Transmission
    Wire.endTransmission();
 
    // Request 1 byte of data
    Wire.requestFrom(Addr, 1);
 
    // Read 1 byte of data
    if (Wire.available() == 1)
    {
      b1[i] = Wire.read();
    }
  }
  // Convert the data
  // temp coefficients
  unsigned int dig_T1 = (b1[0] & 0xFF) + ((b1[1] & 0xFF) * 256);
  int dig_T2 = b1[2] + (b1[3] * 256);
  int dig_T3 = b1[4] + (b1[5] * 256);
 
  // pressure coefficients
  unsigned int dig_P1 = (b1[6] & 0xFF) + ((b1[7] & 0xFF) * 256);
  int dig_P2 = b1[8] + (b1[9] * 256);
  int dig_P3 = b1[10] + (b1[11] * 256);
  int dig_P4 = b1[12] + (b1[13] * 256);
  int dig_P5 = b1[14] + (b1[15] * 256);
  int dig_P6 = b1[16] + (b1[17] * 256);
  int dig_P7 = b1[18] + (b1[19] * 256);
  int dig_P8 = b1[20] + (b1[21] * 256);
  int dig_P9 = b1[22] + (b1[23] * 256);
 
  // Start I2C Transmission
  Wire.beginTransmission(Addr);
  // Select control measurement register
  Wire.write(0xF4);
  // Normal mode, temp and pressure over sampling rate = 1
  Wire.write(0x27);
  // Stop I2C Transmission
  Wire.endTransmission();
 
  // Start I2C Transmission
  Wire.beginTransmission(Addr);
  // Select config register
  Wire.write(0xF5);
  // Stand_by time = 1000ms
  Wire.write(0xA0);
  // Stop I2C Transmission
  Wire.endTransmission();
 
  for (int i = 0; i < 8; i++)
  {
    // Start I2C Transmission
    Wire.beginTransmission(Addr);
    // Select data register
    Wire.write((247 + i));
    // Stop I2C Transmission
    Wire.endTransmission();
 
    // Request 1 byte of data
    Wire.requestFrom(Addr, 1);
 
    // Read 1 byte of data
    if (Wire.available() == 1)
    {
      data[i] = Wire.read();
    }
  }
 
  // Convert pressure and temperature data to 19-bits
  long adc_p = (((long)(data[0] & 0xFF) * 65536) + ((long)(data[1] & 0xFF) * 256) + (long)(data[2] & 0xF0)) / 16;
  long adc_t = (((long)(data[3] & 0xFF) * 65536) + ((long)(data[4] & 0xFF) * 256) + (long)(data[5] & 0xF0)) / 16;
 
  // Temperature offset calculations
  double var1 = (((double)adc_t) / 16384.0 - ((double)dig_T1) / 1024.0) * ((double)dig_T2);
  double var2 = ((((double)adc_t) / 131072.0 - ((double)dig_T1) / 8192.0) *
                 (((double)adc_t) / 131072.0 - ((double)dig_T1) / 8192.0)) * ((double)dig_T3);
  double t_fine = (long)(var1 + var2);
  double cTemp = (var1 + var2) / 5120.0;
  double fTemp = cTemp * 1.8 + 32;
 
  // Pressure offset calculations
  var1 = ((double)t_fine / 2.0) - 64000.0;
  var2 = var1 * var1 * ((double)dig_P6) / 32768.0;
  var2 = var2 + var1 * ((double)dig_P5) * 2.0;
  var2 = (var2 / 4.0) + (((double)dig_P4) * 65536.0);
  var1 = (((double) dig_P3) * var1 * var1 / 524288.0 + ((double) dig_P2) * var1) / 524288.0;
  var1 = (1.0 + var1 / 32768.0) * ((double)dig_P1);
  double p = 1048576.0 - (double)adc_p;
  p = (p - (var2 / 4096.0)) * 6250.0 / var1;
  var1 = ((double) dig_P9) * p * p / 2147483648.0;
  var2 = p * ((double) dig_P8) / 32768.0;
  double pressure = (p + (var1 + var2 + ((double)dig_P7)) / 16.0) / 100;
 
  // Output data to serial monitor
  Serial.print("Pressure : ");
  Serial.print(pressure);
  Serial.println(" hPa");
  Serial.print("Temperature in Celsius : ");
  Serial.print(cTemp);
  Serial.println(" C");
  Serial.print("Temperature in Fahrenheit : ");
  Serial.print(fTemp);
  Serial.println(" F");
  delay(1000);
}

 

Output

Open the serial monitor and you should see something like this – I sometimes get strange altitude readings – negative values, not sure why

Temperature in Celsius : 21.31 C
Temperature in Fahrenheit : 70.36 F
Pressure : 1331.70 hPa
Temperature in Celsius : 21.30 C
Temperature in Fahrenheit : 70.34 F
Pressure : 1331.70 hPa
Temperature in Celsius : 21.30 C
Temperature in Fahrenheit : 70.34 F
Pressure : 1331.26 hPa
Temperature in Celsius : 21.31 C
Temperature in Fahrenheit : 70.36 F
Pressure : 1331.04 hPa

 

Link

https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMP280-DS001-18.pdf

1 piece I2C/SPI BMP280 3.3 Digital Barometric Pressure Altitude Sensor Module High Precision Atmospheric Module for Arduino

Share

Arduino Due and BME680 environmental sensor example

In this article we will connect a BME680 sensor to an Arduino Due

BME680 is an integrated environmental sensor developed specifically for mobile applications and wearables where size and low power consumption are key requirements. Expanding Bosch Sensortec’s existing family of environmental sensors, the BME680 integrates for the first time high-linearity and high-accuracy gas, pressure, humidity and temperature sensors. The gas sensor within the BME680 can detect a broad range of gases to measure air quality for personal well being.

This is the sensor that I purchased

Gases that can be detected by the BME680 include Volatile Organic Compounds (VOC) from paints (such as formaldehyde), lacquers, paint strippers, cleaning supplies, furnishings, office equipment, glues, adhesives and alcohol.

Parameter Technical data
Package dimensions 8-Pin LGA with metal
3.0 x 3.0 x 0.93 mm³
Operation range (full accuracy) Pressure: 300…1100 hPa
Humidity 0…100%
Temperature: -40…85°C
Supply voltage VDDIO
Supply voltage VDD
1.2 … 3.6 V
1.71 … 3.6 V
Interface I²C and SPI
Average current consumption
(1Hz data refresh rate)
2.1 µA at 1 Hz humidity and temperature
3.1 µA at 1 Hz pressure and temperature
3.7 µA at 1 Hz humidity, pressure and temperature 0.09‒12 mA for p/h/T/gas depending on operation mode
Average current consumption in sleep mode 0.15 μA
Gas sensor
Response time (τ 33-63%)
Sensor-to-sensor deviation
Power consumption
Output data processing
< 1 s (for new sensors)
+/- 15% +/- 15
< 0.1 mA in ultra-low power mode
direct output of IAQ: Index for Air Quality
Humidity sensor
Response time (τ0-63%)
Accuracy tolerance
Hysteresis
8 s
± 3 % relative humidity
≤ 1.5 % relative humidity
Pressure sensor
RMS Noise
Sensitivity Error
Temperature coefficient offset
0.12 Pa (equiv. to 1.7 cm)
± 0.25 % (equiv. to 1 m at 400 m height change)
±1.3 Pa/K (equiv. to ±10.9 cm at 1°C temperature change)

 

Parts List

Name Link
Arduino Due Black Due R3 Board DUE-CH340 ATSAM3X8E ARM Main Control Board with 50cm USB Cable CH340G for arduino
BME680 BME680 Sensor Module Temperature and Humidity Air Pressure Air Quality IAQ MCU680 Module
Connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

Schematic

We use the I2C connection for the sensor

 

arduino due and bme680

arduino due and bme680

Code

You will need to import the adafruit unified sensor and bme680 libraries for this example – you can add these using the library manager

My particular sensor which you can see in the picture earlier in the article used address 0x76, the default is 0x77 so you may have to change this line from if (!bme.begin(0x76)) to if (!bme.begin())

 

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include "Adafruit_BME680.h"
 
 
#define SEALEVELPRESSURE_HPA (1013.25)
 
Adafruit_BME680 bme; // I2C
 
void setup() {
  Serial.begin(9600);
  while (!Serial);
  Serial.println(F("BME680 test"));
 
  if (!bme.begin(0x76)) 
  {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    while (1);
  }
 
  // Set up oversampling and filter initialization
  bme.setTemperatureOversampling(BME680_OS_8X);
  bme.setHumidityOversampling(BME680_OS_2X);
  bme.setPressureOversampling(BME680_OS_4X);
  bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
  bme.setGasHeater(320, 150); // 320*C for 150 ms
}
 
void loop() 
{
  if (! bme.performReading()) 
  {
    Serial.println("Failed to perform reading :(");
    return;
  }
  Serial.print("Temperature = ");
  Serial.print(bme.temperature);
  Serial.println(" *C");
 
  Serial.print("Pressure = ");
  Serial.print(bme.pressure / 100.0);
  Serial.println(" hPa");
 
  Serial.print("Humidity = ");
  Serial.print(bme.humidity);
  Serial.println(" %");
 
  Serial.print("Gas = ");
  Serial.print(bme.gas_resistance / 1000.0);
  Serial.println(" KOhms");
 
  Serial.print("Approx. Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println(" m");
 
  Serial.println();
  delay(2000);
}

 

Output

Open the serial monitor and you will see something like this

 

Share

Arduino Due and TMP102 digital temperature sensor example

In this article we look at the TMP102 digital sensor and we will connect it up to an Arduino Due

The TMP102 device is a digital temperature sensor ideal for NTC/PTC thermistor replacement where high accuracy is required. The device offers an accuracy of ±0.5°C without requiring calibration or external component signal conditioning. Device temperature sensors are highly linear and do not require complex calculations or lookup tables to derive the temperature. The on-chip 12-bit ADC offers resolutions down to 0.0625°C.

The TMP102 device features SMBus™, two-wire and I2C interface compatibility, and allows up to four devices on one bus. The device also features an SMBus alert function. The device is specified to operate over supply voltages from 1.4 to 3.6 V with the maximum quiescent current of 10 µA over the full operating range.

The TMP102 device is ideal for extended temperature measurement in a variety of communication, computer, consumer, environmental, industrial, and instrumentation applications. The device is specified for operation over a temperature range of –40°C to 125°C.

 

Layout

Another easy device to connect to our Arduino Due as you can see below

 

arduino due and TMP102

arduino due and TMP102

 

Parts List

 

Name Link
Arduino Due Black Due R3 Board DUE-CH340 ATSAM3X8E ARM Main Control Board with 50cm USB Cable CH340G for arduino
TMP102 breakout TMP102 Digital Temperature Sensor Breakout Board Module 12-bit 1.4V To 3.6VDC Sensor Module Temperature Module
connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

Code

This is from the Arduino site with a few tweaks

#include "Wire.h"
#define TMP102_I2C_ADDRESS 72 /* This is the I2C address for our chip. This value is correct if you tie the ADD0 pin to ground. See the datasheet for some other values. */
 
 
void setup() 
{
  Wire.begin(); // start the I2C library
  Serial.begin(115200); //Start serial communication at 115200 baud
}
 
 
void loop() 
{
  getTemp102();
  delay(5000); //wait 5 seconds before printing our next set of readings. 
}
 
void getTemp102()
{
  byte firstbyte, secondbyte; //these are the bytes we read from the TMP102 temperature registers
  int val; /* an int is capable of storing two bytes, this is where we "chuck" the two bytes together. */ 
  float convertedtemp; /* We then need to multiply our two bytes by a scaling factor, mentioned in the datasheet. */ 
  float correctedtemp; 
 
  /* Reset the register pointer (by default it is ready to read temperatures)
You can alter it to a writeable register and alter some of the configuration - 
the sensor is capable of alerting you if the temperature is above or below a specified threshold. */
 
  Wire.beginTransmission(TMP102_I2C_ADDRESS); //Say hi to the sensor. 
  Wire.write(0x00);
  Wire.endTransmission();
  Wire.requestFrom(TMP102_I2C_ADDRESS, 2);
  Wire.endTransmission();
 
 
  firstbyte      = (Wire.read()); 
  /*read the TMP102 datasheet - here we read one byte from
   each of the temperature registers on the TMP102*/
  secondbyte     = (Wire.read()); 
  /*The first byte contains the most significant bits, and 
   the second the less significant */
    val = firstbyte;
    if ((firstbyte & 0x80) > 0) 
    {
      val |= 0x0F00;
    } 
    val <<= 4; 
 /* MSB */
    val |= (secondbyte >> 4);    
/* LSB is ORed into the second 4 bits of our byte.
Bitwise maths is a bit funky, but there's a good tutorial on the playground*/
    convertedtemp = val*0.0625;
    correctedtemp = convertedtemp - 5; 
    /* See the above note on overreading */
 
 
  Serial.print("firstbyte is ");
  Serial.print("\t");
  Serial.println(firstbyte, BIN);
  Serial.print("secondbyte is ");
  Serial.print("\t");
  Serial.println(secondbyte, BIN);
  Serial.print("Concatenated byte is ");
  Serial.print("\t");
  Serial.println(val, BIN);
  Serial.print("Converted temp is ");
  Serial.print("\t");
  Serial.println(val*0.0625);
  Serial.print("Corrected temp is ");
  Serial.print("\t");
  Serial.println(correctedtemp);
  Serial.println();
}

 

Output

Open the serial monitor window and you should see something like this

firstbyte is 10100
secondbyte is 1110000
Concatenated byte is 101000111
Converted temp is 20.44
Corrected temp is 15.44

firstbyte is 10100
secondbyte is 1110000
Concatenated byte is 101000111
Converted temp is 20.44
Corrected temp is 15.44

firstbyte is 10100
secondbyte is 1100000
Concatenated byte is 101000110
Converted temp is 20.37
Corrected temp is 15.38

 

Link

http://www.ti.com/lit/gpn/tmp102

Share

Arduino Due and Si1145 sensor example

In this exampl;e we look at the Si1145 sensor, we connect it to an Arduino Due and use the Arduino IDE for development

First the sensor in a little more detail

The Si1145/46/47 is a low-power, reflectance-based, infrared proximity, ultraviolet (UV) index, and ambient light sensor with I2C digital interface and programmable event interrupt output. This touchless sensor IC includes an analog-to-digital converter, integrated high-sensitivity visible and infrared photodiodes, digital signal processor, and one, two, or three integrated infrared LED drivers with fifteen selectable drive levels. The Si1145/46/47 offers excellent performance under a wide dynamic range and a variety of light sources including direct sunlight. The Si1145/46/47 can also work under dark glass covers.

The photodiode response and associated digital conversion circuitry provide excellent immunity to artificial light flicker noise and natural light flutter noise. With two or more LEDs, the Si1146/47 is capable of supporting multiple-axis proximity motion detection. The Si1145/46/47 devices are provided in a 10-lead 2×2 mm QFN package and are capable of operation from 1.71 to 3.6 V over the –40 to +85 °C temperature range.

 

Parts List

name Link
Arduino Due Black Due R3 Board DUE-CH340 ATSAM3X8E ARM Main Control Board with 50cm USB Cable CH340G for arduino
Si1145 breakout SI1145 UV IR Visible Sensor I2C GY1145 Light Breakout Board Module
connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

 

Layout

Simple to connect being an I2C device – I used 3v3 on my sesnor

 

arduino due and si1145

arduino due and si1145

Code

This example requires the Adafruit Si1145 library, you can add this via the library manager or download from https://github.com/adafruit/Adafruit_SI1145_Library

#include <Wire.h>
#include "Adafruit_SI1145.h"
 
Adafruit_SI1145 uv = Adafruit_SI1145();
 
void setup() {
  Serial.begin(9600);
 
  Serial.println("Adafruit SI1145 test");
 
  if (! uv.begin()) {
    Serial.println("Didn't find Si1145");
    while (1);
  }
 
  Serial.println("OK!");
}
 
void loop() {
  Serial.println("===================");
  Serial.print("Vis: "); Serial.println(uv.readVisible());
  Serial.print("IR: "); Serial.println(uv.readIR());
 
  // Uncomment if you have an IR LED attached to LED pin!
  //Serial.print("Prox: "); Serial.println(uv.readProx());
 
  float UVindex = uv.readUV();
  // the index is multiplied by 100 so to get the
  // integer index, divide by 100!
  UVindex /= 100.0;  
  Serial.print("UV: ");  Serial.println(UVindex);
 
  delay(1000);
}

 

Output

Open the serial monitor window – these readings were taken indoors

Adafruit SI1145 test
OK!
===================
Vis: 256
IR: 281
UV: 0.02
===================
Vis: 263
IR: 280
UV: 0.03
===================
Vis: 261
IR: 279
UV: 0.02
===================

Link

https://www.silabs.com/documents/public/data-sheets/Si1145-46-47.pdf

Share