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.
- 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
- 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
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.
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!
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:
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!