O Watch
Published © GPL3+

Measuring Humidity and Temperature with the O Watch

Learn how to measure the humidity and temperature on your O Watch.

EasyShowcase (no instructions)15 minutes369
Measuring Humidity and Temperature with the O Watch

Things used in this project

Hardware components

O Watch Sensor Kit
O Watch Sensor Kit
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

Humidity Sensor Demo for O Watch Sensor Kit

Arduino
/*
 * This is a demo of the SI7021 Humidity Sensor
 * This demo is made for the O Watch kit - http://theowatch.com
 * 
 * This demo is based on the SI7021 library example
 * and uses by Marcus Sorensen <marcus@electron14.com>
 * https://github.com/mlsorensen/SI7021/blob/master/SI7021.h
 * licensed under the GNU GPL v2
 * 
 */

#include <TinyScreen.h>
#include <SI7021.h> //include the sensor library

SI7021 sensor; //declare the sensor
TinyScreen display = TinyScreen(TinyScreenPlus);

void setup(void) {
  Wire.begin();
  sensor.begin();
  display.begin();
  display.setFlip(1);
  display.on();
  display.setFont(liberationSans_10ptFontInfo);
}

void loop() 
{
  //get the temperature using the library function 
  //temperature is an integer in hundredths
  int tempHundredths = sensor.getCelsiusHundredths();
  float temperature = tempHundredths / 100.0;

  //get humidity from the libdary function
  // humidity is an integer representing percent
  int humidityvalue = sensor.getHumidityPercent();

  display.setCursor(5,5);
  display.print("Sensor Demo");
    
  //print humidity valye
  display.setCursor(5,25);
  display.print("Humidity: ");
  display.print(humidityvalue);
  display.print("%  ");
  
  //print temperature value
  display.setCursor(5,40);
  display.print("Temp: ");
  display.print((temperature*9/5+32-13)); //printing value converted to Fahrenheit
  display.print(" F  ");
  delay(2000);
}

SI7021 Library

Credits

O Watch

O Watch

9 projects • 13 followers
Make your own smartwatch. Learn 3D design and Arduino coding.
Contact

Comments