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