In real-life race cars, monitoring the gearbox temperature is important for squeezing out the most performance from the car as is possible. As temperatures rise, oil viscosity becomes thinner, which is great for a time trial, but can be a problem in a longer race.

Included in your race car kit is the accurate and excellent HTU21D-F Temperature & Humidity Breakout Board, based on the TE Connectivity sensor. With it, you can measure the temperature and humidity of your race car, wirelessly! You can stream this data from the Bluefruit application on your mobile device, even while driving the car!!

First, you'll connect the sensor to your Feather, and read the data over the serial port.

The HTU21D-F is an I2C sensor. That means it uses the two I2C data/clock wires available on most microcontrollers, and can share those pins with other sensors as long as they don't have an address collision.

Power Pins:

  • Vin - this is the power pin. To power the board, plug it into the 3V pin on your Feather
  • GND - common ground for power and logic, plug this into the GND pin on your Feather

I2C Logic pins:

  • SCL - I2C clock pin, connect to your Feather's I2C clock line, labeled SCL
  • SDA - I2C data pin, connect to your Feather's I2C data line, labeled SDA
The HTU21D-F has a default I2C address of 0x40 and cannot be changed!

Download Adafruit_HTU21DF

To begin reading sensor data, you will need to download Adafruit_HTU21DF_Library from our github repository. You can do that by visiting the github repo and manually downloading or, easier, download it from within the Arduino IDE. To do so, click on Sketch > Include library > Manage libraries... and then within the pop-up window, search for "adafruit htu21df" then, select the library and click Install.

Load Demo

Open up File->Examples->Adafruit_HTU21DF->HTU21DFtest and upload to your Feather wired up to the sensor.

Thats it! Now open up the serial monitor window to begin the test.

You can try breathing on the sensor to increase the humidity. The sensor reacts very fast!

For more details on the sensor, check out the Learning Guide!

Bluetooth Data Streaming

The Bluefruit library makes it fairly simple to stream data as if it's going to the Serial monitor, but is instead traveling through the air to your phone or tablet!

By using the Adafruit BluefruitLE SPI command ble.print(htu.readTemperature()) instead of Serial.print(htu.readTemperature()) we can watch the device running the Bluefruit app instead of the computer's serial monitor to see the same data stream. Magic!

Re-upload the MiniRaceCar.ino sketch to your Feather, then, connect it to the Bluefruit app and click on the Uart button at the bottom.

Here's what it looks like when running:


Another great way to asses the changes in temperature and humidity of your race car over time is by visualizing it on a graph. 

The Bluefruit app has a built in data plotter, here's what the data looks like when you breathe directly on the sensor:

Sensor Placement

If you like, you can use the included Male/Female 6" jumper wires to extend the sensor and place it elsewhere on the car. Perhaps you want a better idea of the track temperature: place the sensor on the underside of the vehicle!

This guide was first published on Jun 01, 2017. It was last updated on May 31, 2017.

This page (Temperature and Humidity Data) was last updated on May 31, 2017.

Text editor powered by tinymce.