Break out common pieces from TeleGPS and AltusMetrum
[fw/altos] / doc / micropeak.txt
1 = MicroPeak Owner's Manual
2 :doctype: book
3 :numbered:
4
5 [dedication]
6 == Acknowledgements
7
8         Thanks to John Lyngdal for suggesting that we build something
9         like this.
10
11         Have fun using these products, and we hope to meet all of you
12         out on the rocket flight line somewhere.
13
14         [verse]
15         Bdale Garbee, KB0G
16         NAR #87103, TRA #12201
17
18         [verse]
19         Keith Packard, KD7SQG
20         NAR #88757, TRA #12200
21
22 == Using MicroPeak
23
24         MicroPeak is designed to be easy to use. Requiring no external
25         components, flying takes just a few steps
26
27         * Install the battery. Fit a CR1025 battery into the plastic
28           carrier. The positive (\+) terminal should be towards the more
29           open side of the carrier. Slip the carrier into the battery
30           holder with the positive (+) terminal facing away from the
31           circuit board.
32
33                 .MicroPeak and Battery
34                 image::micropeak-back.jpg[width="4.5in"]
35
36         * Install MicroPeak in your rocket. This can be as simple as
37           preparing a soft cushion of wadding inside a vented model payload
38           bay. Wherever you mount it, make sure you protect the
39           barometric sensor from corrosive ejection gasses as those
40           will damage the sensor, and shield it from light as that can
41           cause incorrect sensor readings.
42
43         * Turn MicroPeak on. Slide the switch so that the actuator
44           covers the '1' printed on the board. MicroPeak will report
45           the maximum height of the last flight in decimeters using a
46           sequence of flashes on the LED. A sequence of short flashes
47           indicates one digit. A single long flash indicates zero. The
48           height is reported in decimeters, so the last digit will be
49           tenths of a meter. For example, if MicroPeak reports 5 4 4
50           3, then the maximum height of the last flight was 544.3m, or
51           1786 feet.
52
53         * Finish preparing the rocket for flight. After the
54           previous flight data have been reported, MicroPeak waits for
55           one minute before starting to check for launch. This gives
56           you time to finish assembling the rocket. As those
57           activities might cause pressure changes inside the airframe,
58           MicroPeak might accidentally detect boost. If you need to do
59           anything to the airframe after the one minute window passes,
60           make sure to be careful not to disturb the altimeter. The
61           LED will remain dark during the one minute delay, but after
62           that, it will start blinking once every 3 seconds.
63
64         * Fly the rocket. Once the rocket passes about 30m in height
65           (100 feet), the micro-controller will record the ground
66           pressure and track the pressure seen during the flight. In
67           this mode, the LED flickers rapidly. When the rocket lands,
68           and the pressure stabilizes, the micro-controller will record
69           the minimum pressure pressure experienced during the flight,
70           compute the height represented by the difference in air
71           pressure and blink that value out on the LED. After that,
72           MicroPeak powers down to conserve battery power.
73
74         * Recover the data. Turn MicroPeak off and then back on. MicroPeak
75           will blink out the maximum height for the last flight. Turn
76           MicroPeak back off to conserve battery power.
77
78 == The MicroPeak USB adapter
79
80         .MicroPeak USB Adapter
81         image::MicroPeakUSB-2.0.jpg[width="4.5in",align="center"]
82
83         MicroPeak stores barometric pressure information for the first
84         48 seconds of the flight in on-board non-volatile memory. The
85         contents of this memory can be downloaded to a computer using
86         the MicroPeak USB adapter.
87
88         === Installing the MicroPeak software
89
90                 The MicroPeak application runs on Linux, Mac OS X and
91                 Windows. You can download the latest version from
92                 http://altusmetrum.org/MicroPeak
93
94                 On Mac OS X and Windows, the FTDI USB device driver
95                 needs to be installed. A compatible version of this
96                 driver is included with the MicroPeak application, but
97                 you may want to download a newer version from
98                 http://www.ftdichip.com/FTDrivers.htm
99
100         === Downloading Micro Peak data
101
102                 * Plug the MicroPeak USB adapter in to your computer.
103
104                 * Start the MicroPeak application.
105
106                   image::micropeak-nofont.svg[width="0.5in",align="center"]
107
108                 * Click on the Download button at the top of the
109                   window.
110
111                   .MicroPeak Application
112                   image::micropeak-app.png[width="4.5in",align="center"]
113
114                 * Select from the listed devices. There will probably
115                   be only one.
116
117                   .MicroPeak Device Dialog
118                   image::micropeak-device-dialog.png[width="2.3in",align="center"]
119
120                 * The application will now wait until it receives
121                   valid data from the MicroPeak USB adapter.
122
123                   .MicroPeak Download Dialog
124                   image::micropeak-download.png[width="2in",align="center"]
125
126                 * The MicroPeak USB adapter has a small
127                   phototransistor under the hole in the center of the
128                   box.  Locate this, turn on the MicroPeak and place
129                   the orange LED on the MicroPeak directly inside the
130                   hole, resting the MicroPeak itself on the box. You
131                   should see the blue LED on the MicroPeak USB adapter
132                   blinking in time with the orange LED on the
133                   MicroPeak board itself.
134
135                   .MicroPeak Downloading
136                   image::MicroPeakUSB-2.0-inuse.jpg[width="4.5in",align="center"]
137
138                 * After the maximum flight height is reported,
139                   MicroPeak will pause for a few seconds, blink the
140                   LED four times rapidly and then send the data in one
141                   long blur on the LED. The MicroPeak application
142                   should receive the data. When it does, it will
143                   present the data in a graph and offer to save the
144                   data to a file. If not, you can power cycle the
145                   MicroPeak board and try again.
146
147                   .MicroPeak Save Dialog
148                   image::micropeak-save-dialog.png[width="2.3in",align="center"]
149
150                 * Once the data are saved, a graph will be displayed
151                   with height, speed and acceleration values computed
152                   from the recorded barometric pressure data. See
153                   <<_analyzing_micropeak_data> for more details on that.
154
155         === Analyzing MicroPeak Data
156
157                 The MicroPeak application can present flight data in
158                 the form of a graph, a collection of computed
159                 statistics or in tabular form.
160
161                 MicroPeak collects raw barometric pressure data which
162                 is then used to compute the remaining data. Altitude
163                 is computed through a standard atmospheric
164                 model. Absolute error in this data will be affected by
165                 local atmospheric conditions. Fortunately, these
166                 errors tend to mostly cancel out, so the error in the
167                 height computation is much smaller than the error in
168                 altitude would be.
169
170                 Speed and acceleration are computed by first smoothing
171                 the height data with a Gaussian window averaging
172                 filter. For speed data, this average uses seven
173                 samples. For acceleration data, eleven samples are
174                 used. These were chosen to provide reasonably smooth
175                 speed and acceleration data, which would otherwise be
176                 swamped with noise.
177
178                 The File menu has operations to open existing flight
179                 logs, Download new data from MicroPeak, Save a copy of
180                 the flight log to a new file, Export the tabular data
181                 (as seen in the Raw Data tab) to a file, change the
182                 application Preferences, Close the current window or
183                 close all windows and Exit the application.
184
185                 ==== MicroPeak Graphs
186
187                         .MicroPeak Graph
188                         image::micropeak-graph.png[width="4.5in",align="center"]
189
190                         Under the Graph tab, the height, speed and acceleration values
191                         are displayed together. You can zoom in on the graph by
192                         clicking and dragging to sweep out an area of
193                         interest. Right-click on the plot to bring up a menu that will
194                         let you save, copy or print the graph.
195
196                 ==== MicroPeak Flight Statistics
197
198                         .MicroPeak Flight Statistics
199                         image::micropeak-statistics.png[width="4.5in",align="center"]
200
201                         The Statistics tab presents overall data from
202                         the flight. Note that the Maximum height value
203                         is taken from the minumum pressure captured in
204                         flight, and may be different from the apparant
205                         apogee value as the on-board data are sampled
206                         twice as fast as the recorded values, or
207                         because the true apogee occurred after the
208                         on-board memory was full. Each value is
209                         presented in several units as appropriate.
210
211                 ==== Raw Flight Data
212
213                         .MicroPeak Raw Flight Data
214                         image::micropeak-raw-data.png[width="4.5in",align="center"]
215
216                         A table consisting of the both the raw barometric pressure
217                         data and values computed from that for each recorded time.
218
219                 ==== Configuring the Graph
220
221                         .MicroPeak Graph Configuration
222                         image::micropeak-graph-configure.png[width="4.5in",align="center"]
223
224                         This selects which graph elements to show, and lets you
225                         switch between metric and imperial units
226
227         === Setting MicroPeak Preferences
228
229                         .MicroPeak Preferences
230                         image::micropeak-preferences.png[width="1.8in",align="center"]
231
232                         The MicroPeak application has a few user settings which are
233                         configured through the Preferences dialog, which can be
234                         accessed from the File menu.
235
236                         Log Directory::
237
238                         The Log Directory is where flight data will be
239                         saved to and loaded from by default. Of
240                         course, you can always navigate to other
241                         directories in the file chooser windows, this
242                         setting is just the starting point.
243
244                         Imperial Units::
245
246                         If you prefer to see your graph data in feet
247                         and miles per hour instead of meters and
248                         meters per second, you can select Imperial
249                         Units.
250
251                         Serial Debug::
252
253                         To see what data is actually arriving over the
254                         serial port, start the MicroPeak application
255                         from a command prompt and select the Serial
256                         Debug option. This can be useful in debugging
257                         serial communication problems, but most people
258                         need never choose this.
259
260                         Font Size::
261
262                         You can adjust the size of the text in the
263                         Statistics tab by changing the Font size
264                         preference. There are three settings, with
265                         luck one will both fit on your screen and
266                         provide readable values.
267
268                         Look & Feel::
269
270                         The Look & feel menu shows a list of available
271                         application appearance choices. By default,
272                         the MicroPeak application tries to blend in
273                         with other applications, but you may choose
274                         some other appearance if you like.
275
276                         Note that MicroPeak shares a subset of the
277                         AltosUI preferences, so if you use both of
278                         these applications, change in one application
279                         will affect the other.
280
281 [appendix]
282 == Handling Precautions
283
284         All Altus Metrum products are sophisticated electronic
285         devices.  When handled gently and properly installed in an
286         air-frame, they will deliver impressive results.  However, as
287         with all electronic devices, there are some precautions you
288         must take.
289
290         [WARNING]
291
292         The CR1025 Lithium batteries have an extraordinary power
293         density.  This is great because we can fly with much less
294         battery mass... but if they are punctured or their contacts
295         are allowed to short, they can and will release their energy
296         very rapidly!  Thus we recommend that you take some care when
297         handling MicroPeak to keep conductive material from coming in
298         contact with the exposed metal elements.
299
300         The barometric sensor used in MicroPeak is sensitive to
301         sunlight. Please consider this when designing an
302         installation. Many model rockets with payload bays use clear
303         plastic for the payload bay. Replacing these with an opaque
304         cardboard tube, painting them, or wrapping them with a layer
305         of masking tape are all reasonable approaches to keep the
306         sensor out of direct sunlight.
307
308         The barometric sensor sampling ports must be able to
309         "breathe", both by not being covered by foam or tape or other
310         materials that might directly block the hole on the top of the
311         sensor, and also by having a suitable static vent to outside
312         air.
313
314         As with all other rocketry electronics, Altus Metrum
315         altimeters must be protected from exposure to corrosive motor
316         exhaust and ejection charge gasses.
317
318 [appendix]
319 == Technical Information
320
321         === Barometric Sensor
322
323                 MicroPeak uses the Measurement Specialties MS5607
324                 sensor. This has a range of 120kPa to 1kPa with an
325                 absolute accuracy of 150Pa and a resolution of 2.4Pa.
326
327                 The pressure range corresponds roughly to an altitude
328                 range of -1500m (-4900 feet) to 31000m (102000 feet),
329                 while the resolution is approximately 20cm (8 inches)
330                 near sea level and 60cm (24in) at 10000m (33000 feet).
331
332                 Ground pressure is computed from an average of 16
333                 samples, taken while the altimeter is at rest. The
334                 flight pressure used to report maximum height is
335                 computed from a Kalman filter designed to smooth out
336                 any minor noise in the sensor values. The flight
337                 pressure recorded to non-volatile storage is
338                 unfiltered, coming directly from the pressure sensor.
339
340         === Micro-controller
341
342                 MicroPeak uses an Atmel ATtiny85
343                 micro-controller. This tiny CPU contains 8kB of flash
344                 for the application, 512B of RAM for temporary data
345                 storage and 512B of EEPROM for non-volatile storage of
346                 previous flight data.
347
348                 The ATtiny85 has a low-power mode which turns off all
349                 of the clocks and powers down most of the internal
350                 components. In this mode, the chip consumes only .1μA
351                 of power. MicroPeak uses this mode once the flight has
352                 ended to preserve battery power.
353
354         === Lithium Battery
355
356                 The CR1025 battery used by MicroPeak holds 30mAh of
357                 power, which is sufficient to run for over 40
358                 hours. Because MicroPeak powers down on landing, run
359                 time includes only time sitting on the launch pad or
360                 during flight.
361
362                 The large positive terminal (+) is usually marked,
363                 while the smaller negative terminal is not. Make sure
364                 you install the battery with the positive terminal
365                 facing away from the circuit board where it will be in
366                 contact with the metal battery holder. A small pad on
367                 the circuit board makes contact with the negative
368                 battery terminal.
369
370                 Shipping restrictions may prevent us from including a
371                 CR1025 battery with MicroPeak. If so, many stores
372                 carry CR1025 batteries as they are commonly used in
373                 small electronic devices such as flash lights.
374
375         === Atmospheric Model
376
377                 MicroPeak contains a fixed atmospheric model which is
378                 used to convert barometric pressure into altitude. The
379                 model was converted into a 469-element piece-wise
380                 linear approximation which is then used to compute the
381                 altitude of the ground and apogee. The difference
382                 between these represents the maximum height of the
383                 flight.
384
385                 The model assumes a particular set of atmospheric
386                 conditions, which, while a reasonable average, cannot
387                 represent the changing nature of the real
388                 atmosphere. Fortunately, for flights reasonably close
389                 to the ground, the effect of this global inaccuracy
390                 are largely canceled out when the computed ground
391                 altitude is subtracted from the computed apogee
392                 altitude, so the resulting height is more accurate
393                 than either the ground or apogee altitudes.
394
395                 Because the raw pressure data is recorded to
396                 non-volatile storage, you can use that, along with a
397                 more sophisticated atmospheric model, to compute your
398                 own altitude values.
399
400         === Mechanical Considerations
401
402                 MicroPeak is designed to be rugged enough for typical
403                 rocketry applications. It contains two moving parts,
404                 the battery holder and the power switch, which were
405                 selected for their ruggedness.
406
407                 The MicroPeak battery holder is designed to withstand
408                 impact up to 150g without breaking contact (or, worse
409                 yet, causing the battery to fall out). That means it
410                 should stand up to almost any launch you care to try,
411                 and should withstand fairly rough landings.
412
413                 The power switch is designed to withstand up to 50g
414                 forces in any direction. Because it is a sliding
415                 switch, orienting the switch perpendicular to the
416                 direction of rocket travel will serve to further
417                 protect the switch from launch forces.
418
419         === MicroPeak Programming Interface
420
421                 MicroPeak exposes a standard 6-pin AVR programming
422                 interface, but not using the usual 2x3 array of pins
423                 on 0.1" centers. Instead, there is a single row of
424                 tiny 0.60mm × 0.85mm pads on 1.20mm centers exposed
425                 near the edge of the circuit board. We couldn't find
426                 any connector that was small enough to include on the
427                 circuit board.
428
429                 In lieu of an actual connector, the easiest way to
430                 connect to the bare pads is through a set of Pogo
431                 pins. These spring-loaded contacts are designed to
432                 connect in precisely this way. We've designed a
433                 programming jig, the MicroPeak Pogo Pin board which
434                 provides a standard AVR interface on one end and a
435                 recessed slot for MicroPeak to align the board with
436                 the Pogo Pins.
437
438                 The MicroPeak Pogo Pin board is not a complete AVR
439                 programmer, it is an interface board that provides a
440                 3.3V regulated power supply to run the MicroPeak via
441                 USB and a standard 6-pin AVR programming interface
442                 with the usual 2x3 grid of pins on 0.1" centers. This
443                 can be connected to any AVR programming dongle.
444
445                 The AVR programming interface cannot run faster than ¼
446                 of the AVR CPU clock frequency. Because MicroPeak runs
447                 at 250kHz to save power, you must configure your AVR
448                 programming system to clock the AVR programming
449                 interface at no faster than 62.5kHz, or a clock period
450                 of 32µS.
451
452 [appendix]
453 == On-board data storage
454
455         The ATtiny85 has 512 bytes of non-volatile storage, separate
456         from the code storage memory. The MicroPeak firmware uses this
457         to store information about the last completed
458         flight. Barometric measurements from the ground before launch
459         and at apogee are stored, and used at power-on to compute the
460         height of the last flight.
461
462         In addition to the data used to present the height of the last
463         flight, MicroPeak also stores barometric information sampled
464         at regular intervals during the flight. This is the
465         information captured with the MicroPeak USB adapter. It can
466         also be read from MicroPeak through any AVR programming tool.
467
468
469         .MicroPeak EEPROM Data Storage
470         [options="border",cols="2,1,7"]
471         |====
472         |Address        |Size (bytes)   |Description
473         |0x000          |4              |Average ground pressure (Pa)
474         |0x004          |4              |Minimum flight pressure (Pa)
475         |0x008          |2              |Number of in-flight samples
476         |0x00a … 0x1fe        |2              |Instantaneous flight pressure (Pa) low 16 bits
477         |====
478
479         All EEPROM data are stored least-significant byte first. The
480         instantaneous flight pressure data are stored without the
481         upper 16 bits of data. The upper bits can be reconstructed
482         from the previous sample, assuming that pressure doesn't
483         change by more more than 32kPa in a single sample
484         interval. Note that this pressure data is *not* filtered in
485         any way, while both the recorded ground and apogee pressure
486         values are, so you shouldn't expect the minimum instantaneous
487         pressure value to match the recorded minimum pressure value
488         exactly.
489
490         MicroPeak samples pressure every 96ms, but stores only every
491         other sample in the EEPROM. This provides for 251 pressure
492         samples at 192ms intervals, or 48.192s of storage. The clock
493         used for these samples is a factory calibrated RC circuit
494         built into the ATtiny85 and is accurate only to within ±10% at
495         25°C. So, you can count on the pressure data being accurate,
496         but speed or acceleration data computed from this will be
497         limited by the accuracy of this clock.