Arduino Altimeter/Tracker Advice

The Rocketry Forum

Help Support The Rocketry Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

kswing

Well-Known Member
TRF Supporter
Joined
Mar 16, 2016
Messages
276
Reaction score
358
Lately I have been playing around with building my own Arduino-based rocketry electronics. I realize there are many commercial products already available, but, I like to tinker with electronics and software so I'm working on designing something for myself so that I can play around and customize it to suit my needs. I will be happy to share anything I learn through this process so others may develop their own stuff.

Today I launched my first home-grown altimeter that is based on a SparkFun Pro Micro (which runs the [FONT=&quot] ATmega32U4 chip)[/FONT], a BMP180 baro sensor, and an SD card breakout to log the data I receive. It uses a small LiPo battery for power. The setup worked quite well and logged the entire flight in my Binder Design Excel. I launched it on an I285 and it made it to about 2K feet. Since I'm new to the electronics stuff, I'm still using a Missle Works RRC2+ to control the dual deploy events.

Now that I've proven I can successfully record altitude, I'm looking at having it track the rocket using GPS. What I'm wondering is what's the best GPS chipset out there for an Arduino and what sort of RF link should I use to receive the location information while out at the launch site. I have a few other Arduino boards, so, I'm planning to use one of them as the receiver and then feed the location information into an Android based tablet or phone. The local launch waivers top out at around 15K, so, I'm not too worried about really high altitude. So far I've been looking at RF link stuff in either the 900 Mhz or 433 Mhz band because they seem to provide reasonable range and are license-free in the U.S. Any advice in this area is greatly appreciated.
 
I'd strongly recommend the xBee Series 2 and uBlox GPS chip. I've worked with both of them in a flight computer before and was not disappointed. Unfortunately the GPS will eat your serial line, so I'd recommend switching your micro-controller to a Teensy 3.2. It has 3 Serial lines and way more I/O. The xBee has given good signal from 10,000ft with only a wire whip, I'd bet it would be good to 20,000 or higher without it breaking a sweat.
 
I'd strongly recommend the xBee Series 2 and uBlox GPS chip. I've worked with both of them in a flight computer before and was not disappointed. Unfortunately the GPS will eat your serial line, so I'd recommend switching your micro-controller to a Teensy 3.2. It has 3 Serial lines and way more I/O. The xBee has given good signal from 10,000ft with only a wire whip, I'd bet it would be good to 20,000 or higher without it breaking a sweat.

Thanks for the advice.....for the xBee, are you talking about the xBee 900 Mhz or just the 2Ghz ZigBee type of xBee?
 
Another option for a board is the navspark https://navspark.mybigcommerce.com/...ompatible-development-board-with-gps-glonass/ be sure to grab the free mini with any order https://navspark.mybigcommerce.com/navspark-mini-uart-to-usb-adapter/

GPS receiver built in (Antenna needed), Arduino compatible, will run off a 1s lipo and cheap price for experimenting.

For a standalone gps, any of the boards for Quadcopters running APM or pixhawk will be easy to integrate, the neo-6m boards with active antennas seem to be faster getting a lock than the 7m or 8 series boards now available.
If you are tight for space gms-g9 is a nice option with reasonably sized solder pads.
Generally the larger the antenna the better for a good gps fix

For radio links I like the rfd900u from RFDesigns, only 19mm wide with diversity antenna, claimed range of 10km and can be linked to their more powerful transceivers or to the 3dr clone radios from hobyking/ebay/etc

https://store.rfdesign.com.au/rfd-900u-radio-modem/

with any radio link, the lower you can set the air data rate the longer your range can be.

With the cheap 3dr style radios I have logged gps at 8000 feet and successfully found my rockets nearly a mile away, So far I have been more limited by my rockets and waivers than I have been by the radio range.
 
I'm glad someone else is doing this too. I'm also a tinkerer and have been looking at building and Arduino flight computer. Are you familiar with the Adafruit Feathers? The feather is 0.9" x 2" (similar to the Teensy) and includes all the required components to regulate and charge a small LiPo. I've been playing with these because I think you'll be able to place it in a 1 1/2" tube. They also have easy to use "wings" (equivalent to a shields) including the ultimate GPS wing. This is simple to use and has a well defined user library.

If you go looking at the Adafruit website, I'd suggest an "Adalogger" feather with ultimate GPS wing and a proto-wing for the barometer. There are also 900 MHz wings for packet transmission.

Keep us informed of your progress.
 
Thank you everyone for the advice.

For the RF link, I've decided to try out the LoRa Adafruit Feather MO (RFM 95/900MHz) and a matching LoRa breakout that I'll use with an Arduino UNO. For the GPS, I'm planning to use an Adafruit Ultimate GPS FeatherWing. So far I've tested the RF link just using simple wire antennas and I've gotten at least 2000ft range while driving around the neighborhood with the receiver around in my car and the transmitter on my porch. The road ended, so, I'm not sure how much range it really has yet. I'm sure the range will get much better using higher gain antennas with the transmitter in a rocket and the receiver in a wide open field. Sometime in the next week I'll try it out again with the transmitter upstairs in my house to see how far I can get with the wire antennas. I'll also start playing around with the GPS FeatherWing to see about getting coordinates.

Also, I'm thinking I'll get a Bluetooth breakout for the ground station so that I can have it send the coordinates over to my cell phone for display on a map.
 
For the RF link, I've decided to try out the LoRa Adafruit Feather MO (RFM 95/900MHz)

The LoRa Adafruit Feather looks interesting. Keep us posted on how it works for you.

I have been using the Digi XBee Pro S2C. This is a 2.4 ghz model, but it has a two mile line of sight range. Farther if you use a directional antenna for the base station. I used a Teensy 3.2 and a Prop Shield for pressure sensor and orientation sensing. With Sparkfun's Teensy to XBee adapter board everything fit in my 1.9" rocket. (Prop shield was mounted on the back side of the red pcb)
telemetry.jpg

Granted I only got up to about 2800 feet, but I had very little data loss. My project is only to its first phase. I currently have altitude, orientation, and GPS reporting. The video shows a 3D virtual image of the rocket during its flight. The sensors are sampled 100 times a second, and the results are transmitted to the ground station computer. The ground station computer runs the program that displays the orientation of the rocket, and records the data to a comma delimited file. I plan to add mosfets for deployment after some further testing.

11-5-16-Flight.jpg

[video=youtube;ju3rODwjwbI]https://www.youtube.com/watch?v=ju3rODwjwbI[/video]

More info and the code can be found on my hackaday project site:
https://hackaday.io/project/15425-rocket-real-time-transponder-and-gui

Walter
TRA # 4026
 

Attachments

  • 11-5-16-Flight.jpg
    11-5-16-Flight.jpg
    105.5 KB · Views: 186
Radiohound - your project looks interesting. So far I've had good luck with the LoRa radios and the Feather GPS Shield. I've got it sending NMEA GPS location strings over to my ground station and I can plot them on my Windows machine using Visual GPS View. I'm also sending the NMEA via Bluetooth, but, I've been having issues getting Rocket Locator (for Android) to recognize the GPS. I'm thinking I may have to write an Android application for myself, or, try to find the code for Rocket Locator so I can better troubleshoot.
 
Radiohound - your project looks interesting. So far I've had good luck with the LoRa radios and the Feather GPS Shield. I've got it sending NMEA GPS location strings over to my ground station and I can plot them on my Windows machine using Visual GPS View. I'm also sending the NMEA via Bluetooth, but, I've been having issues getting Rocket Locator (for Android) to recognize the GPS. I'm thinking I may have to write an Android application for myself, or, try to find the code for Rocket Locator so I can better troubleshoot.

You might want to ask the author: https://rocketlocator.com. It's a useful tool but due to the dynamics of a rocket flight, don't expect it to receive and decode every single packet. One usually gets positions late in the descent phase of a DD rocket and
certainly when the main chute comes out. This is enough to get one into the ground footprint of the tracker and with a stationary rocket one can't go wrong. Will find it every time. Kurt
 
Today I replaced my Adafruit Bluetooth LE shield with a basic HC-06 TX/RX Bluetooth module and now Rocket Locator works as it should and shows both my location and that of the transmitter. Next I have to build an electronics sled for the transmitter and a case for the receiver so that I can field test things at next month's launch.
 
Congrats on your success. It took me about a year to get my Arduino based 2-stage flight computer flight worthy. My setup logs data at 450-500 samples per second to an SD card as a CSV file. It integrates angle off vertical, integrates altitude, and runs 4 pyro channels (separation, staging, apogee, main deploy). Data is pulled from a BMP180, 2 accelerometers, and a gyroscope. The onboard logic inhibits 2nd stage ignition if it gets 30 degrees off vertical or fails to reach 400 ft. A beeper indicates continuity status pre-flight and reports altitude/velocity post-flight. I had 10 amazing flights before a crash killed the unit (e-match failure).

Personally, I'm not sold on ARM processors (Teensy) over AVR (Arduino Uno). I toyed around with the Adafruit M0 Adalogger and found that the I2C and analog read speeds were terrible. The slower speed limited my data to 100 samples per second, where I easily achieved 400+ with the ATmega328. I know other people have experienced the same problem but I have yet to see a solution that didn't involve machine code.

I'll give you a word of caution when running pyro events. Supersonic flights can fool you if you don't have the correct logic. Also, I found that sensing apogee is not as straight forward as one might think. Finally, an accelerometer is extremly useful when determining liftoff, burnout, and when to fire stage separation charges.

I'm in the process of converting my fleet to my Arduino based flight controllers. I haven't played around with telemetry or GPS yet, so I'm very interested in how your experience goes. I too have been looking at the Adafruit Lora boards.

Anyway, I have attached a few pictures of my setup and results.

CPU Labeled.gifFiring Board Labeled.gifAltitude.jpgBooster Motor.jpgRotation.jpgSustainer Motor.jpgVelocity.jpg
 
The onboard logic inhibits 2nd stage ignition if it gets 30 degrees off vertical or fails to reach 400 ft.

Care to share your code? I'm working on a similar project with an Arduino pro mini and an MPU6050 specifically for this purpose. Lately there has been quite a demand here on the forum for such an inhibition device. I'm working on a mid power 2 stager test platform as well as an HPR L to K stager after the system is proven.
 
No problem - PM me. I got the first test flight on the unit back in April, which was successful but had a bunch of bugs. I demo'd it as NSL and then entered it into the NARAM R&D competition where it took 1st place in Division C. I've been slowly working all of the bugs out and the code runs quite well now.

Integration of the off-vertical angle is the key to the whole thing, and I came up with a unique algorithm (maybe not unique). I found quaternion math to be incomprehensible to implement, so I took an Euler approach, which works fine b/c gimball-lock isn't a concern. If the rocket gets into a gimbal-lock condition, then we've already inhibited the 2nd stage long prior to that point. Even the Euler floating-point math was quite slow on the Arduino, so I implemented a fixed-point method. This combined with a couple clever sine / cosine simplifications greatly sped up the calculations. Post-flight analysis showed less than 1% deviation from true off-vertical angle.

I also recommend not only having a tilt-inhibit of the 2nd stage, but also an altitude threshold. Mine is set to 400ft - if it hasn't crossed that altitude by the time the 2nd stage is supposed to be lit, then it will bypass 2nd stage ignition and start looking for apogee.

My accelerometer based speed integration is very simple and I haven't fuzed it with the gyro readings yet. As such, I'm typically 15% over on my accelerometer based peak altitude, but I'm always within 2-3 seconds of true apogee. Barometric pressure sensors are better at detecting that when you are below ~25K ft.

I've improved the data rate from ~370 sps to > 400 sps. You will achieve 400-500 sps with my code since you are using less sensors and thus have less operations. If you drop the part of the code that writes to the SD card, then you'll exceed 800 sps or more. If you also drop the accelerometer readings, then your data rate will exceed 1K sps.

Sorry I'm blathering on in this post. It took me a year to develop the unit and fit it in a 2-inch rocket. I learned a LOT of lessons in that time and had 4 failed prototypes.
 
I sent a PM to you but my sent folder stays empty. Let me know.
 
I've got the tracker ready to be tested this coming weekend (if it's not too cold). For now I've adjusted the LoRa radio settings to get more distance, but, that also means it provides a lower baud rate. As part of the lower baud rate its only sending location updates every 3 seconds. Depending on how well it tracks I may update the code so that I can get faster refreshes and still keep the longer range. To do this I'd have the transmitter only send essential location information and then on the ground receiver side I'd use that to build my own NMEA strings. I'm powering the transmitter with a 1S LiPo and I've installed a small switch in the bulkhead so I can turn it on without having to remove the nose cone e-bay. It fits in a 38mm MMT. Here's what it looks like ready to mount in the nose cone of my Binder Design Excel:

IMG_20161205_202948911.jpgIMG_20161205_202957398.jpg
 
That's really sharp Ken! I hope I can be out there to see how that works! I might be VERY interested in following your lead for LDRS!
 
I flight tested the tracker today in my 4" Binder Design Excel on an I500 at BattlePark. Before launch I had to restart the Rocket Locator software a few times before it would show the location, but, eventually it started showing the location ok. I was busy watching the rocket during the flight, but, I could hear beeps every three seconds indicating it was tracking ok. There was one missed beep right after apogee, but, I think that may have been a minor Bluetooth issue because the next one was fine. Unfortunately I forgot to save the track in Rocket Locator, but, it appeared to track the entire flight pretty well and it guided me directly to the rocket for recovery. Apogee was at about 3200' and it drifted about 1000 feet.

Next month I may try a flight with the medium range LoRa settings and location updates every second, or, I may update the code so it sends less data over the LoRa link in the hope that I can keep the long range LoRa settings and still support updates every second. I may also look at ways to log the data on the transmitter so that I can see how well the GPS was tracking.

For those that are wondering, I'm using the Adafruit Feather MO with RFM 95 LoRa for the transmitter. GPS data is provided by an Adafruit Ultimate GPS Featherwing. I send a configuration string to the GPS FeatherWing to control the NMEA refresh rate and I update the LoRa range settings in the LoRa libraries. The transmitter/GPS is mounted in the nose cone of the rocket with a 1/2 wave antenna and I power the TX side with a 1S LiPo battery. The Adafruit Feather MO handles charging the LiPo when it is plugged in to a USB jack.

On the receiver side, I have an Arduino Uno with a LoRa RFM 95W breakout and an HC-06 module for the Bluetooth connection to my Android phone. I have the receiver mounted in a plastic enclosure and I power it with a 9V battery. I have a full wavelength whip antenna on the receive side. Once I've tested it some more I'll clean up the code and post it here so that other folks can use and critique it.

Also, I'd like to thank all of the Tripoli Central Virginia folks at BattlePark for all of their encouragement and advice.
 
Ken, That was really awesome! I'm really glad that worked out as well as it did for you! I look forward to see how it grows! Congrats!
 
Nice I have been working on a arduino mini pro based build. It is made from a mini pro, micro sd card reader, and a MS5611 and the pressure sensor. It's all ran from a 3.7v 150 mAh lipo. I have had a few successful flight and just completed my first dual deploy that worked perfectly.

My only issue is I'm unable to get more than 20 - 25 reading per second. How to you get 400 samples per second? Is the bmp180 that much faster?
 
I think the 400 samples/sec was the accelerometer. The BMP180 takes about 10 ms to get a reading on the lowest resolution setting (which is fine, the other modes won't get you any better readings in a rocket), the best you're going to get out of a BMP180 is about 50 samples/sec if you have a fairly minimal amount of post-processing. 20 samples/sec is a more reasonable figure.
 
Okay then It sounds like I'm on par. Do you get best accuracy with the accelerometer than the pressure sensor.
 
The best accuracy is obtained when you merge the two using a Kalman filter, or a complementary filter (which is somewhat easier to understand and code). Accelerometers being the sensitive devices they are will pick up a lot of noise, so you have to filter that out, and the altitude derived from integrating the samples doesn't account for any inclination. Barometers do a good job of getting you the altitude, but they're prone to aerodynamic noise, and you get a high-low pressure spike as you get close to Mach 1. You havve to account for that when you do your filtering, and certainly any deployment code. Do a search on the Forum for "Kalman filter", there have been several threads on this subject.
 
Just saw this post. I get about 20 samples per second out of the BMP180, but thats hard coded. There's a lot of overhead on the BMP180; the samples take about 40ms per reading at the highest resolution. I get 400 sps out of my accelerometer and gyroscope.

FYI, complementary filters usually combine G-normalized accelerometer readings with gyro outputs to increase accuracy over long time scales. Its a terrible approach with rockets because we need decent accuracy over short time-scales with completely unpredictable accelerometer readings.

I'm working on a quaternion approach that can be easily implemented on an Arduino. My Euler based code works OK, but isn't very accurate when coning/corkscrewing starts to happen. My Euler approach will detect a high-degree off-vertical orientation, but thats about it. Useful for 2-stage rockets, but not much else.

Currently, I'm exceeding 500 samples per second with an Arduino Uno (really an Adafruit Metro mini) and sampling the BMP180, L3GD20H gyro, LSM303 accelerometer and ADXL377 (read through a 16-bit ADC - works great!!) I write it all to an SD card to ensure I have enough memory space.

I use simple non-angle integrated speed and altitude to estimate my events. I'm usually within 15% on altitude and within 2 seconds of true apogee on a flight that exceeds 10K ft. I've found that if I use my Euler estimate of off-vertical angle, then I can cut the altitude error in half. Its a work in progress.
 
Nice I have been working on a arduino mini pro based build. It is made from a mini pro, micro sd card reader, and a MS5611 and the pressure sensor. It's all ran from a 3.7v 150 mAh lipo. I have had a few successful flight and just completed my first dual deploy that worked perfectly.

My only issue is I'm unable to get more than 20 - 25 reading per second. How to you get 400 samples per second? Is the bmp180 that much faster?

The speed of the MS5611 depends a lot on the selected resolution. Nearly 1000sps can be reached in the lowest resolution setting. The software also has a big impact. Blocking operations (e.g. simple polling) need to be avoided. SD cards in particular tend to be busy at times, which will not only reduce the sampling rate significantly but also introduce jitter. This issue can be handled by buffering the sensor data.

Reinhard
 
It's awesome to hear that the Adafruit lora telemetry is working. I've been thinking about trying them too. Please keep sharing what you find! The balloon flight reports from the loratracker guy sound amazing.

FWIW, for my recent L1 cert rocket, I used a quadcopter flight controller (SP Racing Evo running Betaflight) along with a little GPS and an FrSky XSR (paired with a Taranis r/c controller & patch antenna for my ground station) for onboard data logging & telemetry. I tested it on an 8 foot pole with good telemetry out to 2.5 miles. I only flew it to 2400' altitude with maybe a 600' drift on my cert flight, but it worked well there. I'm thinking about the lora radios to hopefully get even more range.
 
I've been looking into transmit-side logging options and I've found that the GPS chip I'm using has a built-in logging function and enough memory to hold many hours of data, so, I'm going to enable that for my next launch. I've also updated my LoRa configuration options so that it has slightly less range but it should have the bandwidth to support updates every second. Even though my change reduces the potential range a bit, based on tests I've seen on various LoRa sites I think I should still have plenty of range for the rockets I'm launching. Hopefully I'll have good weather for January's launch because I've got a J500 waiting that should get the rocket up to about 3,500 or 4,000 feet.
 
I tested my tracker again last month and it worked fine, but, the rocket didn't go that high so I'm still not sure of the real range. Hopefully I'll get to try it out to about 7K feet this weekend at LDRS. Also, some folks have been asking how I set up the transmitter so here is some more information.


I'm using the RadioHead library to control the LoRa radio. I've added the following value to the MODEM_CONFIG_TABLE in the RH_RF95.cpp file for radio settings:
{ 0x92, 0xb4, 0x00}, // my setting


I'm hoping this value is a good compromise between bandwidth and range. I updated the corresponding .h file to reference this setting using a new value in the ModemConfigChoice enum called Bw500Cr48Sf2048 and I updated the init method in the .cpp file to use this setting by changing the default setModemConfig call to mine as follows: setModemConfig(Bw500Cr48Sf2048);



Also, here are the pins I'm using on the transmitter side (these are from my main Arduino class)
/* for feather m0 */
#define RFM95_CS 8
#define RFM95_RST 4
#define RFM95_INT 3

And I create an instance of the radio as a global in my Arduino code as follows...

// Singleton instance of the radio driver
RH_RF95 rf95(RFM95_CS, RFM95_INT);

And the following code in my Arduino setup method is used to initialize the radio:
// manual reset of the radio
digitalWrite(RFM95_RST, LOW);
delay(10);
digitalWrite(RFM95_RST, HIGH);
delay(10);


while (!rf95.init()) {
Serial.println("LoRa radio init failed");
while (1);
}
Serial.println("LoRa radio init OK!");


if (!rf95.setFrequency(RF95_FREQ)) {
Serial.println("setFrequency failed");
while (1);
}




rf95.setTxPower(23, false); // set high power


Once all of this is set, then I just use a call to rf95.send(...) to send the data from my Arduino loop method.

I hope this helps some folks. Please post here or send me a message if you have any questions. When I have a chance I'll post more about how I control the receiver and the GPS. Also, hopefully I'll meet a bunch of folks this weekend at LDRS.
 
Back
Top