When I heard about Infineonโs DPS310 digital barometric pressure sensor, I began racking my brains for problems that could benefit from its incredibly precise barometric pressure measurement. My initial ideas were around wearable altimeters, e.g. measuring altitude while hiking or hang gliding or other altitude-related sporting activities. I'd already built a wearable altimeter in the form of my hackathon-winning Pebble Altimeter Smartstrap though, so I pushed myself to explore other applications. The idea that I eventually landed upon was a telemetry system for model rockets. ๐ ๐
The Sensor Hub Nano allows absolutely anyone to experiment with the DPS310's capabilities right away! Leveraging the built-in Bluetooth, a user can connect via the Infineon Pressure Sensor Android app or Infineon Sensor Evaluation Software for PC and view realtime measurements of altitude, pressure and temperature. My initial response after observing this functionality was to build an Android app of my own which could be used to view altitude data over the duration of a flight, including setting the initial launchpad altitude as a baseline (vs. comparing minimum and maximum altitudes relative to sea level). Shortly after I embarked upon this, however, I learned about the Nano's I2C capabilities via the supplied schematic, enabling a more exciting goal of being able to extend data collection beyond the range of Bluetooth (since rockets can fly many hundreds, or even thousands of feet) by coupling the Nano with a cellular-connected Particle Electron! I'd not actually used the Electron, or Particle's Cloud API, IDE or CLI tools before, so I spent some time working through their excellent examples in order to familiarize myself! ๐
After connecting the Nano to the Electron via I2C (schematic below), I was lucky enough to discover rickkas7's Particle I2C Tutorial, which gave me a great foundation in using I2C with the Electron thanks to its extensive README and examples. With the basics out of the way, I was ready to interface with the DPS310 via I2C! I searched Particle's public libraries for the handy DPS310 Arduino library, and was unable to locate it. No big deal, right? According to their docs, "most Arduino libraries are compatible with Particle" - awesome! As mentioned earlier, I'd never used a Particle Electron before - let alone written a library for one! Thankfully the detailed docs told me everything I needed to do to create and submit one. Unfortunately, however, there turned out to be significant incompatibilities with the Particle's I2C implementation (i.e. the entire point of the library!) and as a result, I spent an immense portion of the time I had available for this project reworking the library (a somewhat tedious process due to "blind" cloud compilation where I just had to work through failures line by line, compilation after compilation!)! ๐ฉ
The code to consume the library, however, was pretty straightforward! I started with a simple PoC to figure out the Particle Cloud API, just writing random values from the Electron to their cloud console over cellular. Then once I had the above I2C library cobbled together well enough to work on the Particle, I was able to substitute those values for the placeholders I'd used earlier. This was where I ran into the next big shock: my entire project was based on measuring altitudes, and I'd used the evaluation tools to view altitude data, but ... when I started implementing the library that I'd ported, I discovered no mention of altitude, elevation or any other similar term. In fact I couldn't find any reference on the entire internet as to how the DPS310 could be used for altitude measurements, even though I'd seen it in the apps? After exhaustive searches I was ready to just log pressure and temperature data to the cloud and figure out a way to extract the altitude later. ๐ Then, scouring every last piece of info I'd received for this contest, I came across a small footnote indicating how altitude was calculated by the Infineon Sensor Evaluation Software for PC!! I won't detail it here since the document is confidential, but the results can be seen in my work! ๐
Steps to Repro ๐ ๐To recreate this project, simply connect the Electron and Sensor Hub Nano via I2C (schematic below), clone the GitHub repo (linked below) and build then flash via the Particle CLI:
cd SMRT
particle compile electron . --target 0.6.2
particle flash --target 0.6.2 --serial {firmware}.bin
Note
v0.6.2
is required since earlier firmware versions are unable to support the Arduino functions required by the library
{firmware}.bin
should be replaced with the actual filename resulting from compilation
- the library dependency is automatically included via
project.properties
- though I do plan on sharing it via GitHub when time allows (I've not had a chance to push my changes to GitHub as of the publication of this project, but they should be available in the Particle library!)
- for testing and debugging purposes, measurements are currently set to
10
seconds apart in batches of5
(cellular transmissions to the cloud are thus50
seconds apart); for a real launch, the interval would be decreased significantly and batch size increased accordingly for efficient yet rapid transmission!
This project ended up being far greater of a challenge than I'd originally imagined! I could have just stuck with Bluetooth and barometric pressure readings, but I wanted to take everything to the next level, and provide something that would truly work in the desired application of model rocketry, where ranges extend well beyond those of Bluetooth. I have not yet launched my creation, as I was concerned about losing or damaging it and being unable to fully complete the project, and I need to combine both boards onto a single battery, but per the schematic, the Nano doesn't expose power via any of the available pins, meaning I have to physically modify it, which again, I didn't want to do until the project was absolutely finalized due to risk of damage. Once I've consolidated power around the smaller LiPo, however, the entire assembly can fit in a plastic nosecone and I can validate the prototype in the extreme conditions of actual launch! ๐
Next Steps/Future Enhancements ๐ ๐ฎAs mentioned, there are a few steps required for launch readiness, and I might also 3d-print a custom nosecone to aid fitment of the components. With the telemetry infrastructure in place, I'd like to add more sensors/data - for example, GPS to allow tracking of the rocket (it is a common problem in model rocketry to lose sight of vehicles during flight, and this would allow recovery without maintaining continual visual contact!). Beyond that, the ultimate goal will be a custom PCB, minimizing footprint and using the DPS310 directly without the Nano, and enabling interchangeable sensor modules for plug-and-play usage by anyone...! ๐ญ ๐ ๐
Comments