Sensor Si7021 with Arduino

dev board Arduino UNO
chip Si7021

Before starting

Dependancies

Ensure the following requirements are available:

Description

Display humidity and temperature values with sensor Si7021 and Arduino.

Code

Download code
#include "Adafruit_Si7021.h"

Adafruit_Si7021 sensor = Adafruit_Si7021();

void setup() {
  Serial.begin(9600);

  if (!sensor.begin()) {
    Serial.println("Did not find Si7021 sensor!");
    while (true) {}
  }

  delay(1000);
}

void loop() {
  Serial.print("\nHumidity:    ");
  Serial.print(sensor.readHumidity());
  Serial.println(" RH%");

  Serial.print("Temperature: ");
  Serial.print(sensor.readTemperature());
  Serial.println(" C");

  delay(1000);
}

Makefile

BOARD?=arduino:avr:uno
PORT?=/dev/cu.usbmodem14*

.PHONY: default lint all flash clean

default: lint all flash clean

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

all:
	arduino-cli compile --fqbn $(BOARD) ./

flash:
	arduino-cli upload -p $(PORT) --fqbn $(BOARD) ./

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

Serial console

Serial output from the firmware.

Sensor Si7021 with Arduino serial console

Schematic

Wire up the hardware accordingly

Sensor Si7021 with Arduino schematic

References