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