Introduction: Biking Headwind Monitor
How to measure your wind resistance while cycling, so that you can see how hard you're really working!
The Arduino reads the real-time airspeed as measured by a compact Pitot tube + airspeed sensor connected to analog input 0, and reports it back to the iOS app using Bluetooth LE. When the Pitot tube is carefully mounted on a bicycle (on or near the headtube) such that it's pointed directly forward and will receive an unimpeded air flow as the cyclist moves forward, the measured airspeed, when compared to the groundspeed as measured by the GPS of the iPhone, can be used as a proxy for wind resistance.
Step 1: Get the Parts
For this project, you'll need:
- Arduino Uno (it will probably work with other variants, but I've only tested it with the Uno) and 9V battery
- RedBearLab's BLE shield
- Airspeed Pitot tube kit
- Bluetooth LE-capable iOS device (iPhone 4S or later)
- Curved piece of foam (a chunk of foam that's used for keeping water hot in copper pipes works well)
- Old water bottle
- Old two-piece iPhone case
Note: you also need the ability to program an Arduino (using the free development environment) and build/install iPhone apps using Xcode. I've tested this on OS X El Capitan (10.11.4) using Arduino 1.5.8 and Xcode 7.3.
Step 2: Wire Up the Pitot Tube and Airspeed Sensor to the Arduino
The airspeed sensor in this project has 3 connections - power (5V), ground, and analog output. With some wire (you need 1 foot or less of 3 color-coded wires), a 6-pin header (to attach the wires to the Arduino), and a soldering iron, you can make a simple cable to connect it to the +5V, GND, and A0 pins of an Arduino Uno (which has a BLE shield mounted on top of it). It's a good idea to use some heat-shrink tubing when soldering wires to a header to prevent adjacent pins from accidentally touching.
In this photo, the bottom of the airspeed sensor's mini circuit board has some velcro on it as I experimented with different ways of attaching it to my bicycle's frame so that I could increase the distance from the Pitot tube to the Arduino. In the end, I put it just inside the top lip of the water bottle which is where the Arduino lives too.
Step 3: Program the Arduino and Build/install the IPhone App
Download the code for the Arduino sketch and iPhone app from github. You'll need a Mac because the XCode development environment for building iPhone apps only runs on Macs.
Step 4: Attach the Stuff to Your Bike
Wrap the curved piece of foam around the top of your bike's down tube or head tube and use a couple of cable ties to secure it.
Remove the top of the water bottle and place the Arduino with 9V battery and airspeed sensor inside of it. You might want to insert another piece of foam (or two) inside the bottle first, so that things won't move around too much. Then put the water bottle into the cage and carefully insert the Pitot tube through the foam it so that it is parallel to the ground; make sure that the front of it faces forward and is not blocked by any cables or other parts of your bike. Ensure that the side holes on the Pitot tube are not covered by the foam.
Drill two (or more) holes in the bottom of the two-piece iPhone case and attach it to your handlebars using cable ties. When you have an iPhone in it, it's a good idea to use a mini-bungee cord around it (or just some tape) to make sure that it doesn't fall out while riding!
Step 5: Go for a Ride!
The screen on the left is the data capture mode. The total gain, effort speed and effort distance values are not currently populated.
The one on the right is the view of a captured ride. On this screen, three colors are used to estimate the wind resistance: high (red), medium (yellow) and low (green). The current simplistic calculation simply compares the measured airspeed to several constants (i.e. does not take the ground speed into account) - based on my observations of what seemed like "high", "medium" and "low" in-your-face headwinds while cycling on flat surfaces in San Francisco. This particular route was captured while riding (mostly) east-to-west from downtown SF, over the Golden Gate bridge and up Hawk Hill. The red part through the Marina district, which is relatively flat, accurately reflects a higher LOE due to the typical westerly winds that are present on that stretch.
The captured raw CSV data (in .biker files) can be extracted from the phone's filesystem using a tool such as iExplorer for further analysis.