Hiking Data Logger Using RFM69CW

by JonMackey in Circuits > Arduino

5288 Views, 44 Favorites, 0 Comments

Hiking Data Logger Using RFM69CW

P2070002.jpeg
P2070005.jpeg
P2070003.jpeg

This hiking data logger is used to record a hike’s location, start and end time, temperature, altitude and barometric pressures. It will also audibly report altitude milestones during the hike.

Even if you have no interest in hiking you may find the schematics, hardware and/or software useful.

The hiking data logger is made up of three separate devices and their Arduino projects.

All of the devices communicate using a HopeRF RFM69CW transceiver.

The three devices:

  1. Gateway - resides in your pack’s top pouch.
    - Coordinates the recording of hike data.
    - 5 button UI with a multi line RGB display
    - SD card slot used for downloading saved hike data.
    - Provides altitude milestone notification via an onboard MP3 player and micro speaker.
    - USB serial and 10440 Li-ion 3.7V 600mAh AAA size battery with onboard charger
    - 3D printed enclosure - 8 x 8 x 1.5cm
  2. BMP280 remote - hangs on the back of your pack
    - Broadcasts temperature and pressure updates every 4 seconds.
    - The gateway and 3 button remote use the pressure readings to calculate the altitude.
    - 10440 Li-ion 3.7V 600mAh AAA size battery that lasts several months on a single charge.
    - 3D printed enclosure - water resistant - 8 x 5 x 1.5cm
  3. Remote control - resides in an easily accessible pocket
    - Controls and displays information about a subset of the gateway’s functions.
    - 3 button UI with a multi line RGB display.
    - USB serial and 10440 Li-ion 3.7V 600mAh AAA size battery with charger
    - 3D printed enclosure with buttons large enough to be used with winter gloves - 8 x 6 x 1.8cm

The gateway stores a summary of up to 125 hikes. After that it overwrites the oldest summary. More detailed hike data can be downloaded to an SD card with each hike stored as a separate file. The detailed data is the temperature and pressure recorded every 4 seconds.

The only software that I didn’t write, other than the basic Arduino classes, are the classes that control the RFM69 transceiver and the SD card.

- Felix Rusu's RFM69 library Copyright Felix Rusu 2016

- Bill Greiman's SdFat library Copyright Bill Greiman 2011-2018

My Mac OS utility applications used in this project:

Note that all of the repositories below contain a built application (zip file.)

- SubsetFontCreator - creates a subset of a font for either 1 bit or RGB displays as compressed bitmap data (RGB is antialiased, 1 bit isn’t).

- SerialHexLoader - used to set various parameters on the devices serially and via an ISP, as well as exporting IntelHex representations of binary files.

- FatFsToHex - used to create FAT16 disk images for storing MP3 data on NORFLASH chips.

- HikeLoggerUtility - (not released yet, still being written) used to interpret and display the detailed hike data logged by the gateway. It’s also where hike location names and elevation data is added, edited and exported for loading onto the gateway.

There are no purchased modules other than the transceivers. I designed and built all four boards.

Usage Summary:

Setting the start and end location of a hike is done via the gateway’s UI. Once the setup is done the gateway can be placed in your pack. The 3 button remote is used to start, stop, pause, resume, and mark a hike as done. The only location setting action the 3 button remote can perform is swapping start and end locations (as you would do when going back the way you came.)

The 3 button remote controls a subset of the functions available on the gateway. The remote displays the current time, temperature and altitude. When logging a hike, the remote displays the elapsed time and percentage of the hike completed (in terms of elevation gain or loss.)

What the gateway logs:

The gateway receives a packet from the BMP280 remote approximately every 4 seconds. This packet contains the current barometric pressure and temperature. When logging a hike, this packet data is written to a serial EEPROM IC. When the hike is marked as done (an action in the UI), the log is terminated and setup for the next hike log to be appended. Completed hikes are saved to SD by inserting an SD card. You are prompted with “SAVE TO SD”. If you then press enter, the logs currently in EEPROM are written as individual files to the SD card. When writing finishes successfully a “SAVED” message is presented. When you remove the SD card you’re given the option to remove the logs on the EEPROM. You have to explicitly select YES in the UI to do this. Removing the logs from the EEPROM does not affect the stored hike summaries, only the detailed hike log data.

The log data files are interpreted using the HikeLoggerUtility application on the Mac (not released yet.) The HikeLoggerUtility uses the pressure readings to calculate the altitude of each sample showing how the temperature changed over time/altitude and how fast you were ascending or descending. The HikeLoggerUtility also allows you to add metadata to the log such as what kind of day it was (cloudy/sunny/snowing/raining/windy), and what you were wearing and whether you were comfortable. I find this helpful in deciding what to wear on a hike in winter weather. You can lookup what you were wearing for an expected starting temperature within a given range.

The summary data that is always stored on the gateway can only be erased via the USB serial port by sending a summary reset command. This erases all summaries stored in the summary ring buffer. Summaries are only stored for hikes that make it past the 75% milestone. This eliminates writing summaries of logs started accidentally. Note that the 75% milestone rule only applies to summaries. All logs, accidental or not, are saved to the SD card.

Milestones reported by the gateway:

The gateway plays an MP3 clip for each milestone reached. The milestones are 25%, 50% and 75%. The milestone granularity can easily be changed in the code to any integer factor of 100. I have my gateway set to play the Mac OS “Glass” sound for all of the milestones. You could play a different MP3 for each milestone. When the MP3 finishes, the MP3 section of the board is powered down to save power.

More detail:

The Gateway Display:

The gateway display is textual, there are no icons. The display resolution, at about 10 points per millimeter, is quite high, higher than many computer monitors. For example my MacBook Pro with a Retina display is about 5 ppmm. For this reason the fonts used are antialiased. At 1.60 USD the 240x240 gateway display is a good value.

XFont class:

I looked at the various Arduino font rendering libraries available and decided to write my own named XFont. The XFont library makes no assumption about the underlying display hardware and font storage. All of the display classes derive from a common base class. The font data can be stored anywhere; Flash, Serial EEPROMs, etc.. You simply need to provide a stream class to access the data. The only storage assumption the font class makes when used in Arduino code is that the header and glyph lookup tables are stored in the MPU’s Flash memory (PROGMEM.) These structures are quite compact.

SubsetFontCreator application:

The font data consumed by XFont is created by my SubsetFontCreator Mac OS application. SubsetFontCreator uses the open source FreeType library to create a compact subset of a font’s available font glyphs, as bitmap data. For example, if you’re writing code for a clock you would only need the 14 glyphs needed to display the time (0 to 9, a colon, and the letters A, M, and P.) The glyph data generated is compressed for both 1 and 8 bit data. See the Readme.md on GitHub for more information about how the data is compressed.

SubsetFontCreator can generate a binary file, a C++ header, or both. The generated header file contains boilerplate code to make incorporating the font into an Arduino sketch easier. The data can be 1 or 8 bit. 1 bit data requires much less space than 8 bit. 8 bit data is for high resolution displays used to generate antialiased text when you have enough memory to store the data. As an example of how storage agnostic the font classes are, the same classes used in the Arduino code are used to create WYSIWYG font samples in SubsetFontCreator Mac OS application. Only a few display and storage subclasses were needed to support the Mac. Being able to debug the font classes on the Mac makes it easier to maintain.

For more information about XFont and SubsetFontCreator see the SubsetFontCreator repository on GitHub.

The boards are shared on PCBWay:
Hiking Data Logger Gateway board
3 Button Remote board
BMP280 Remote board
USB Serial + Li-ion Charger board

Schematics

All boards designed using Eagle.

The gateway, notable components:
See the board shared on PCBWay for a full parts list.

- ATmega644PA MCU (source)
- 240x240 ST7789 RGB display (source)
- RFM69CW transceiver (source)
- USB CH340G serial
- USB powered TP4056 Li-ion charger with FS8205A/DW01A protection ICs
- LM3671 DC-DC 3v3 converter (source)
- YX5200-24SS MP3 player (same IC used in the common DF Player module) (source)
- 8002A mono amplifier connected to a micro speaker
- W25Q64FVSS 8MB SPI NORFLASH MP3 storage memory (could have used smaller size, 1MB, etc.)
- AT24C256N 32KB I2C EEPROM hike data memory (or larger, AT24C1024, etc.)
- DS3231 Real Time Clock

The 3 button remote, notable components:
See the board shared on PCBWay for a full parts list.

Main board

- ATmega644PA MCU
- 80x160 ST7735 RGB display (source)
- RFM69CW transceiver
- LM3671 DC-DC 3v3 converter

USB Serial & Charger board
See the board shared on PCBWay for a full parts list.

- USB CH340G serial
- USB powered TP4056 Li-ion charger with FS8205A/DW01A protection ICs

The BMP280 remote, notable components:
See the board shared on PCBWay for a full parts list.

- ATtiny84A MCU
- BMP280 digital pressure and temperature sensor (source)
- RFM69CW transceiver
- LM3671 DC-DC 3v3 converter

Assembling the Boards

PC240022.jpeg

I’ve written several instructables that have step by step instructions for assembling a board with surface mount devices (SMD.) For this instructable I will only describe the assembly of the 3 button remote board in detail and how to solder the display cables for the gateway board. Once you’ve assembled one SMD board you should be able to apply that to most other boards.

Assembling the 3 Button Remote Board

PC240017.jpeg

Instructions for assembling the board (or almost any small board) follows. If you know how to assemble an SMD board, jump to step 9.

Using a small piece of wood as a mounting block, I wedge the board between two pieces of scrap prototype board. The prototype boards are held to the mounting block with double stick tape (no tape on the PCB itself).

Apply Solder Paste and Place SMD Parts

PC240019.jpeg

Apply solder paste to the SMD pads, leaving any through hole pads bare. I generally work from top left to bottom right to minimize the chances of smearing the solder paste that I’ve already applied. If you do smear the paste, use a lint free wipe such as those for removing makeup. Avoid using a Kleenex/tissue. Controlling the amount of paste applied to each pad is something you get the hang of through trial and error. You just want a tiny dab on each pad. The size of the dab is relative to the size and shape of the pad (roughly 50-80% coverage). When in doubt, use less. For pins that are close together, like anything in TSSOP package, such as the LVC125A on the gateway, you apply a very thin strip across all of the pads rather than attempt to apply a separate dab to each each of these very narrow pads. When the solder is melted, the solder mask will cause the solder to migrate to the pad, kind of like how water won’t stick to an oily surface. The solder will bead or move to an area with an exposed pad.

Special case: When assembling either the gateway or 3 button remote, apply solder paste to the display pads on the boards, but don’t place the display yet

Special case: The BMP280 sensor on the BMP280 remote board is tiny and I’ve found it’s best to apply the solder paste (very sparingly) to each pad and NOT place the sensor directly onto the paste. After melting the solder, follow the BMP280 sensor instructions in the next step.

Optional special case: I haven’t been placing or applying the solder paste for the RFM69CW module in this step. I prefer to solder the RFM69CW after applying the hot air gun to all of the other parts.

No-clean Paste Flux: (source)

I use a low melting point solder paste (137°C Melting Point): (source)

Place the SMD parts. Give each part a light tap to ensure that it’s sitting flat on the board. When placing a part I use two hands to aid in precise placement.

As noted above, don't place the BMP280 sensor directly onto the solder paste.

Apply the Hot Air Gun

PC240020.jpeg
PC240021.jpeg

Hold the gun perpendicular to the board at about 4cm above the board. The solder around the first parts takes a while to start melting. Don’t be tempted to speed things up by moving the gun close to the board. This generally results in blowing the parts around. Once the solder melts, move on to the next overlapping section of the board. Work your way all around the board. I use a pair of tweezers to tweak the parts into place as I move around the board.

I use a YAOGONG 858D SMD Hot Air Gun. (On Amazon for less than $40.) The package includes 3 nozzles. I use the largest (8mm) nozzle. This model/style is made or sold by several vendors. The important number is 858D. I’ve seen ratings all over the place. This gun has worked flawlessly for me. For 137°C low temperature solder I set the hot air gun to 235°C

Special Board Assembly technique for displays

After melting the solder, this is where you would mount the the display. Apply a very thin layer of no-clean flux to the display cable solder pads. Position the display cable using double stick tape on the display metal frame to hold the display cable in position over the solder pads on the board. Using a pencil tipped soldering iron, gently swipe each pad on the exposed side of the display cable, repeating till the display cable sits flat on the board. Use a narrow piece of PCB to hold the cable down as you solder it. I’ve found this technique works better than attempting to use the hot air gun.

After melting the solder, this is where you would mount the BMP280 sensor on the BMP280 sensor board. At this point the pads for the BMP280 should only have slight bumps of melted solder on them. Apply a very thin film of no-clean solder paste on underside of the sensor. Place the sensor on the board. Apply the heat gun and tap the sensor till the solder melts. If this is done correctly you should see the tiniest of solder beads bleed out from under the sensor at each pad.

After allowing the board to cool a bit, this is where I prefer to mount the RFM69CW. Apply solder paste to the RFM69CW pads, place the RFM69CW module, and reapply the hot air gun. Note that when the board is warm the solder paste will spread out quickly, so if you perform this special case, note that you need to be careful applying the solder paste to a warm board.

Cleaning/removing the SMD Flux

The solder paste I use is advertised as being “no clean”. You do need to clean the board, it looks much better and it will remove any small beads of solder on the board. Using latex, nitrile, or rubber gloves in a well ventilated space, pour a small amount of Flux Remover into a small ceramic or stainless steel dish. Reseal the flux remover bottle. Using a stiff brush, dab the brush in the flux remover and scrub an area of the board. Repeat till you’ve entirely scrubbed the board surface. I use a gun cleaning brush for this purpose. The bristles are stiffer than most tooth brushes.

Special case: It may not matter, but I hold the board with my thumb on the BMP280 air hole to prevent getting the flux remover inside the sensor.

Flux remover I use: MG Chemicals 4140 or 4140A. Note that the board may appear to be slightly sticky after using this product. I’ve found that after the product completely evaporates (may take an hour or more) the sticky film turns to a whitish dust that is easy wiped off the board.

Place and Solder All of the Trough Hole Parts

After the flux remover has evaporated off the board, place and solder all of the trough hole parts, shortest to tallest, one at a time.

For quite a while now I haven’t been installing the ICSP header on any of the boards I make. I instead use test probe pogo pins either attached to a test fixture or inserted into a 2x3 Dupont shell. For an example of a DIY test fixture see: PCB Test Fixture

Cleanup the Through Hole Pins

Using a flush cutter plier, trim the through hole pins on the underside of the board. Doing this makes removing the flux residue easier.

For a nice appearance, reheat the solder on the through hole pins after clipping. This removes the shear marks left by the flush cutter.

Using the same cleaning method as in Step 6, clean the back of the board.

At this point all 4 boards should be assembled as per the schematics and parts lists.

Print the 3D Parts

PB250008.jpeg

Gateway case: RFM69 Gateway

3 Button Remote case: RFM69 3 Button Remote

BMP280 case: RFM69 BMP280 Remote

The BMP280 link contains a new base design that allows for charging.

Download Software

Download the software from GitHub:

ArduinoHikingLogger

The ArduinoHikingLogger repository contains the sources for HikingLoggerGateway and HikingLoggerRemote sketches. When compiling either of these sketches, make sure you edit the Arduino Preferences Sketchbook location to point to the ArduinoHikingLogger folder.

The MCU on the gateway and 3 button remote is an ATmega644PA. In order to compile software for this MCU you need to have the MightyCore board manager installed. You install this by adding "https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json" to the Additional Boards Manager URLs in the Arduino Preferences.

ATmega644PA Settings

Replace /dev/cu.usbserial-14420 with the actual port connected to the board.

Arduino-Tiny

The Arduino-Tiny repository contains the sources for several of my ATtiny related sketches. The sketch you're interested in is BMP280Remote. When compiling this sketch, make sure you edit the Arduino Preferences Sketchbook location to point to the Arduino-Tiny folder.

The MCU on the BMP280 remote is an ATtiny84A. In order to compile software for this MCU you need to have the damellis/attiny board manager installed. You install this by adding "https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json" to the Additional Boards Manager URLs in the Arduino Preferences.

ATtiny84A Settings

Replace /dev/cu.usbserial-14420 with the actual port connected to the board.

Load Software on BMP280 Remote

First set the ATtiny84A's fuses:

The fuse settings in the command line (see below) sets the ATtiny84A to use the internal resonator at 8MHz. These fuse settings also preserve the EEPROM from being erased whenever downloading a new sketch. Many default fuse settings don’t do this.

I do this using an ISP, specifically the one I designed (see AVR Programmer) You can use any AVR ISP such as Arduino as ISP built on a breadboard so long as it's 3v3. See the Arduino as ISP example from the Arduino IDE Examples menu for a DIY ISP.

Very important: You must use a 3v3 ISP or you will damage components on the board.

The following are Mac OS instructions.

Open a BBEdit worksheet (you could also do this from a Terminal window.) Note that a bootloader for the ATtiny84A should not be loaded via the Arduino IDE. All software is loaded via an ISP through the ICSP connector on the BMP280 board.

Set the SPDT switch on the BMP280 board to “OFF/PROG". This reroutes the board’s power source to the ICSP cable and disables the RFM69CW module. If the RFM69CW module isn’t disabled it will interfere with the ISP.

Connect a 6 pin ISP cable from the ICSP header on the board to the connector on a 3v3 ISP.

From within the BBEdit worksheet OR the Terminal app, run:

/Applications/Arduino\ 1.8.10.app/Contents/Java/hardware/tools/avr/bin/avrdude -C /Applications/Arduino\ 1.8.10.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -p t84 -P /dev/cu.usbserial-A603R1VD -c avrisp -b 19200 -U lfuse:w:0xe2:m -U hfuse:w:0xd7:m -U efuse:w:0xff:m

The path to your Arduino application should be used in place of "/Applications/Arduino\ 1.8.10.app".

/dev/cu.usbserial-A603R1VD above should be replaced with whatever USB serial port is connected to your ISP.

Set the Network and Node ID:

All 3 boards should have the same network ID. Chose a value from 1 to 254.

All 3 boards need a unique node ID. The gateway should be ID 1, the 3 button remote 2, and the BMP280 remote can be anything greater than 2.

The code reads network and node IDs from EEPROM in the sketch's setup() routine. The instructions below define how to set these IDs in the EEPROM using the SerialHexLoader application. Another way of setting these IDs would be to replace the code in setup() that reads the IDs with hard coded values.

Using the SerialHexLoader application attached to a 3v3 ISP connected to the boards ICSP connector, select “Set NodeID…” from the Command menu. This will display a dialog with two fields. Enter the node and network IDs. When you press OK this will send a few AVR STK500 commands to the ISP to write the two IDs to the MCU’s EEPROM starting at address 2. You will see success or failure in the utility log view.

This same procedure is used to set the node and network IDs for the gateway and 3 button remote. As noted above, the gateway should be ID 1, the 3 button remote should be ID 2, and the BMP280 node ID can be anything greater than 2. The network ID common to all 3 boards should be unique for the set of devices.

Upload the BMP280Remote sketch:
Using the same setup as step 10, use the Arduino IDE to upload the BMP280Remote sketch via the ISP. After uploading, set the SPDT switch on the BMP280 board to “ON”.

Assemble the BMP280 Remote

P2060002.jpeg
BMP280 open case.JPG

The 2nd picture above, shows an alternate case design that incorporates a plug for charging. The plug simply taps into the positive and negative wires within the case. See the thingiverse link to view this and a small case to hold the inexpensive lipo charger.

Parts:

(6) M2x4mm hex socket button head screws (ISO7380) (source)

(1) 11x7x2mm Nitrile rubber (aka NBR) O-Ring (source)

~22cm 1.5 diameter rubber gasket material. (aka Rubber Jewelry Cord) (source)

(1) 28mm snap ring (source)

(1) set (+ and -) of AA/AAA battery spring plate 10x9mm plate size (source)

(1) 433MHz 40x7mm PCB antenna with IPEX connector (source)

7cm 26awg Red wire

4cm 26awg Black wire

2mm diameter acrylic rod (used as a light guide for the LED on board) (source)

(1) 10440 AAA size 600mAh 3.7V Li-ion battery (charged)

Preparation and installation of the LED light guide:

Ream out the hole located at the approximate lower center of the base to the diameter of the acrylic rod. The 2mm rod I was able to find is actually 2.2mm. Using a sanding block with 500 grit sandpaper, smooth and square one end of the acrylic rod. With the board temporarily mounted in the base, insert the rod into its hole till it makes contact with the LED on the board. Using a flush cutter, snip the rod flush with the base. Remove the board and the cut rod. Sand the cut end of the rod smooth and square. Mix and apply a small amount of plastic epoxy to the rod hole. Insert the rod till it’s flush with the base surface. Cleanup any residual epoxy. Set aside and wait for it to cure.

Install the cover gasket:

Using a small flat blade blunt screwdriver, work the 1.5mm gasket material into the channel on the inside of the base. Cut the gasket to size.

Preparation and installation of the battery spring plates:

On the spring/battery side of each battery plate, solder the red and black wires. Fold the tabs over the back of each plate. Insert the battery plates as shown in the photos. Place the board to determine the length needed. Cut the wires to length with some slack. Solder the wires to the component side of the board. (red +, black -)

Slide the battery plates into the battery compartment slots as shown in the photo.

Install the antenna:

Remove the protective layer on the antenna’s double stick backing. Place the antenna in the base as shown in the photo. Attach the IPEX connector to the board.

Make sure the switch on the board is set to ON.

Place the O-Ring as shown in the photo. Install the board using two M2x4mm screws.

Install the battery and back cover using four M2x4mm screws.

Burn Bootloaders on Gateway and 3 Button Remote

It’s easier to burn the bootloaders before installing the boards in their cases. The gateway and 3 button remote both use the ATmega644PA MCU. Setup the Arduino IDE following the instructions in step 10.

Connect your 3v3 ISP/Programmer and select the corresponding serial port in the Tools menu.

Select your ISP/Programmer in the Tools menu.

Very important: You must use a 3v3 ISP or you will damage components on the board.

For each board:

With your ISP connected to the ICSP header on the board, select Burn Bootloader in the Tools menu.

If everything is connected and configured correctly you should get a success message in the sketch log pane.

This would also be a good time to set the Network and Node IDs for these boards. Follow the instructions in Step 11.

Create the Bitmap Fonts

SubsetFontCreator.png

Because I don’t own the fonts used in this project you need to use my SubsetFontCreator app to create the font bitmap C++ headers.

Launch the SubsetFontCreator.

Select “Choose…” from the Font path control popup at the top of the SubsetFontCreator main window.

Navigate to the /Library/Fonts folder and select MyriadPro-Regular.otf

The Data popup should be set to 1-Bit. (The MCU used has 64Kb of Flash. RGB Antialiased data plus the compiled code will not fit. If you'd like to use RGB Antialiased, change the MCU to the 128Kb version of this family of MCUs.)

Set the Size to 36.

The subset string should be “ !%)-:@!--?A[]]mm°°”, not including the quotes. Make sure you include the leading space. Also, because of a bug in the Instructables HTML interpreter, replace the '@' with '<'. It doesn't like a less than character within quotes.

Alternatively you can use the helper dialog and paste in !%&'()-./0123456789:<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]m° also with a leading space.

This defines the set of glyphs to be exported as bitmap data.

Select Export… from the File menu. The format should be set to C++ Header.

Save the file MyriadPro-Regular_36_1b.h to the HikingLoggerGateway sketch folder.

You’ll know you’ve generated the correct number of character codes if the fontHeader’s numCharCodes field is 55.

For the remaining two fonts, set the Data popup to RGB Antialiased.

The AM and PM strings are drawn as 18 pt text. Create this bitmap header by changing the Size to 18 and the subset string to " AAMMPP”, not including the quotes. Make sure you include the 2 leading spaces.

Export the file MyriadPro-Regular_18.h to the HikingLoggerGateway sketch folder.

The 3 button remote font sizes are smaller than the gateway’s because the display has fewer pixels per mm.

Set the font size to 24 and the subset string to “ !%)-:@!--?A[]]mm°°” (same as the gateway) Because of a bug in the Instructables HTML interpreter, replace the '@' with '<'. It doesn't like a less than character within quotes.

Export the file MyriadPro-Regular_24.h to the HikingLoggerRemote sketch folder.

Set the font size to 14 and the subset string to " AAMMPP" (same as the gateway)

Export the file MyriadPro-Regular_14.h to the HikingLoggerRemote sketch folder.

Because 3 lines of text are needed in the remote display, change the fontHeader line height from 29 to 26 in MyriadPro-Regular_24.h

-->

Assemble the 3 Button Remote

Parts:

(11) M2x4mm hex socket button head screws (ISO7380)

(2) M2x12mm hex socket button head screws (ISO7380)

(1) set (+ and -) of AA/AAA battery spring plate 10x9mm plate size, ~14x9 including solder tab, 9mm width

(1) 433MHz 40x7mm PCB antenna with IPEX connector

8cm 26awg Red/Black bonded wire (source)

5cm 26awg Red wire

5cm 26awg Black wire

(3) 4cm 26awg wires of different colors (I used white, pink and purple)

(1) 40mm diameter 1mm thick acrylic disk. (source)

(1) 1mm diameter x 5cm stainless steel rod (or 16 awg solid copper wire) (source)

2mm diameter acrylic rod (used as a light guide for LEDs)

(1) 10440 AAA size 3.7V Li-ion battery

(1) 40mm Display template/mask/installation guide (3ButtonRemoteFace.PDF)

3M General Purpose 45 Spray Adhesive or some other spray adhesive suitable for paper. (source)

Mount the display:

Leave the protective film on the display face until final installation.

Remote Tape

Place a strip of 6mm wide electrical tape along the upper edge of the board as shown in the photo.

Place a strip of double stick tape as shown in the photo.

Remote Display

Place/adhere the display to the board using the outline printed on the board as a guide.

Preparing and installing the acrylic face:

Print the attached 3ButtonRemoteFace.PDF

Carefully cut out one of the printed faces following its outline.

Face MaskFace Mask Cut

Spray a thin layer of spray adhesive to the cut out printed face following the spray adhesive instructions.

Remove the protective plastic film from one side of the acrylic disk.

Carefully place/adhere the printed face to the exposed side of the acrylic disk.

Mount the disk in a vise with the indentation on the edge of the printed face exposed.

Using a chainsaw file or some other fine round file, file the acrylic to match the printed indentation.

Repeat for the 2nd smaller indentation. Note that these indentations are used to align the disk, so accuracy counts.

Pre-fit the disk in the base.

While holding the disk in the base, use a utility knife to scribe the 30mm base circle with just enough pressure to cut the protective plastic film and not damage the acrylic.

Face Prep

Remove the disk from the base and carefully remove the outer ring of plastic film created in the last step, leaving the center 30mm circle of protective plastic film in place.

Mix a small amount of plastic epoxy and trowel it on the outside ring of the acrylic disk.

Press and align the acrylic disk in the base.

Gently remove any epoxy that may have squeezed out from either side of the disk being carful not to smear any epoxy on the exposed rectangular paper window.

Apply pressure to the acrylic disk by temporarily installing the board using three M3x4mm screws and set the base aside till the epoxy cures.

Once cured carefully remove the remaining protective film. This should also remove any remaining epoxy from the acrylic face.

Face EpoxyFace Done

For each of the 4 cover holes over the USB serial charger board status LEDs, follow the instructions as described in step 12 for preparation and installation of the LED light guides.

Light Guides

Solder the separate Red and Black wires to the battery plates as described in step 12.

Remote Wires

Solder the other end of the battery cables to the USB serial charger board as shown in the photos.

Solder the bonded Red/Black power cable to the main board as shown in the photos.

Solder the other end of the Red/Black power cable to the USB serial charger board as shown in the photos.

Solder the remaining 3 wires as shown in the photo between the USB serial charger board and the main board. (DTR, TXD, RXD)

Install the antenna:

Remote Antenna

Remove the protective layer on the antenna’s double stick backing.

Place the antenna in the base as shown in the photo.

Attach the IPEX connector to the main board.

Make sure the switch on the USB serial charger board is set to ON. When this switch is in the other position DTR will not reset the board as needed when uploading a sketch.

Serial Switch

Remove the protective film on the display.

Install both the USB serial charger board and the main board using 6 M2x4mm screws.

Assemble and install the buttons:

Clean up the button prints by removing the support material on the button arms.

Cut the 1mm stainless steel rod into three 15mm pieces. To cut the rod use a cutter with very hard faces. Do not use a cutter designed for copper or you’ll ruin the cutter. Only make an indentation on the rod. Using two pliers, snap the rod at the indentations.

Button Parts

Attach each button to the button plate using the 15mm rod pieces.

Button Assy

Press the button plate into the base as shown in the photos.

Buttons Inst

Slide the battery plates into the battery compartment slots as shown in the photo.

Install the battery.

Install the back cover using the remaining M2 screws. You may want to wait on this step till you successfully load the software. Getting the cover on without pinching the battery wires is kind of tricky but doable. I used tweezers to position the wires so they don’t get pinched when closing the cover. I never got around to changing the design to allow more space for these wires.

Assemble the Gateway

Parts:

(7) M2x4mm hex socket button head screws (ISO7380)

(1) set (+ and -) of AA/AAA battery spring plate 10x9mm plate size, ~14x9 including solder tab, 9mm width

(1) 433MHz 40x7mm PCB antenna with IPEX connector

5cm 26awg Red wire

5cm 26awg Black wire

(1) 14x20mm speaker (source)

(1) 30x30mm 1mm thick acrylic square. (source)

2mm diameter acrylic rod (used as a light guide for LEDs)

(1) 10440 AAA size 3.7V Li-ion battery

(1) 2-pin Micro JST PH 2.0 connector & pins (source)

Assembly:

Gateway Assy

Note: The picture above shows board version 1.0. The latest version v1.2 uses an RTC chip. Assembly is the same for both.

Leave the protective film on the display face until final installation.

Place double stick tape on the board within the outline of the display.

Place/adhere the display to the board using the outline printed on the board as a guide.

Cleanup the base print by removing all support material. There will be support material in all cutouts on the top wall (SD, USB and switch). There’s also support material in the speaker bracket slot on the side to the battery compartment.

Ream out the two 3mm LED holes on the base front.

Following the instructions in step 12, ream and install the four 2mm rod LED light guides on the base front.

Preparing and installing the 30x30mm acrylic face:

Pre-fit the acrylic face in the base.

While holding the acrylic face in the base, use a utility knife to scribe the outside square with just enough pressure to cut the protective plastic film and not damage the acrylic.

Remove the face from the base and carefully remove the outer strip of plastic film created in the last step, leaving the center 24x24mm square of protective plastic film in place.

Mix a small amount of plastic epoxy and trowel it on the outside edge of the acrylic face.

Press and align the acrylic face in the base.

Gently remove any epoxy that may have squeezed out from either side of the face.

Apply pressure to the acrylic face by temporarily installing the board using four M3x4mm screws and set the base aside till the epoxy cures.

Once cured carefully remove the remaining protective film from both sides. This should also remove any remaining epoxy from the acrylic face.

Install the 14x20mm speaker

Speaker

The speaker wires can either be directly soldered to the board or you can use a micro JST PH 2.0 connector. If the connector is used, crimp the pins to the speaker wires. Insert the pins into the connector matching the polarity shown in the photo.

Remove the protective layer on the speaker’s double stick backing. Place the speaker in the base as shown in the photo.

Using one M2x4mm screw, install the speaker bracket as shown in the photo. Note that the other end of the bracket fits in a slot on the side of the battery compartment.

Solder the separate Red and Black wires to the battery plates as described in step 12.

Solder the Red and Black wires to the battery connection on the board as shown in the photo.

Slide the battery plates into the battery compartment slots as shown in the photo.

Install the battery.

Remove the remaining protective film on the acrylic face and display.

Install the board using four M2x4mm screws.

Upload the Sketches

Both the 3 button remote and the gateway have USB serial ports that can be used to load sketches. Using the settings defined in step 10, open and upload the HikingLoggerGateway.ino and HikingLoggerRemote.ino to their corresponding boards. If you’re able to build either board I’ll assume you know how this is done.

See the FatFsToHex readme file for instructions on how to load MP3 files onto the gateway.

Gateway Mode Descriptions

The Gateway has several modes: Log, Starting Location Selection, Ending Location Selection, Review Hikes, Set Time, Test MP3, Save To SD Card, BMP280 Synchronization, and Reset Log Memory.

Not all modes are available at all times. Save To SD Card is only available when you insert an SD card and can’t be exited until the card is removed. BMP280 Synchronization is only available when the synchronization status has changed (success, failed, retry.) Reset Log Memory is only available immediately after ejecting the SD card. Star/End Location Selection, setting the time, and testing the MP3 aren't available while a hike log is in progress.

The up and down buttons are used to cycle through the available modes.

Log Mode:

Log Mode

Controls starting, stopping, resuming, ending a log and swapping the start and end locations.

For all states of log mode, the time, temperature and elevation are displayed on the bottom two lines. The temperature can be displayed in Celsius or Fahrenheit. The elevation can be displayed in meters or feet.

When a log isn’t in progress log mode displays the starting location in green, and the ending location in red.

When a log is in progress log mode displays the elapsed time and the percentage complete in terms of elevation gain or loss.

The left and right buttons are used to cycle through the available actions.

To select an action you press the center button, enter.

Starting Location Selection Mode:

Used to select the starting location.

The left and right buttons are used to cycle through the available locations.

To select (change) a location, you press the center button, enter. If you change modes without pressing enter, no change is made.

Ending Location Selection Mode:

Used to select the ending location.

The left and right buttons are used to cycle through the available locations.

To select (change) a location, you press the center button, enter. If you change modes without pressing enter, no change is made.

Review Hikes Mode:

Used to view up to the last 125 hike summaries.

Review Scn1Review Scn2

The center button toggles the summary data displayed. The first screen displays the starting and ending locations, elevations and temperatures. The second screen displays the starting and ending time, the day of week and the hike duration. Line one of both screens lists the hike date.

The left and right buttons are used to cycle through the saved hike summaries.

SD Card Mode:

This mode is only entered when an SD card is inserted and can’t be exited till it’s removed.
There are three actions you can make in this mode:

- Save the hike log to SD as a binary file.

- Save the hike locations to SD as a CSV file.

- Update the hike locations from SD via a CSV file.

Saving the hike log: When you insert an SD card the prompt SAVE TO SD is displayed. Pressing enter initiates a save. When the save completes SAVED is displayed. You are then expected to remove the SD card. If any buttons are pressed before ejecting the SD card, the reminder EJECT SD CARD is displayed.

Once the SD Card is ejected and the data was successfully written to SD, Reset Log Memory mode is entered otherwise Log mode is entered.

Saving the hike locations: When you insert an SD card the prompt SAVE TO SD is displayed. Pressing the right button will change the action to SAVE LOCS. Pressing enter initiates the save. Pressing enter initiates a save. When the save completes SAVED is displayed. You are then expected to remove the SD card. The SD will now contain the file HikeLocations.csv. Note that the elevation is in feet. There is no way to change the unit to meters in the CSV file.

Updating and adding hike locations: Always start with a fresh copy of the HikeLocations.csv saved following the instructions in the previous action description. This CSV file has two editable fields, Name and Elevation.

Important: For existing entries the ID field should not be edited. The ID field is used by the review hikes mode and in log mode. Reviewed hike summaries reference the location information by this ID so changing this ID will misalign the summary information.

To add a new location, set the ID to 999 and fill out the other two fields.

To delete an existing entry, set the Elevation to 0.

When your edits and additions are complete, update the locations on the gateway by inserting the SD card containing the modified HikeLocations.csv. When you insert an SD card the prompt SAVE TO SD is displayed. Pressing the left button will change the action to UPDATE LOCS. Pressing enter initiates a save. When the save completes UPDATED is displayed. You are then expected to remove the SD card.

Reset Log Memory Mode:

Only entered when an SD card is ejected after successfully saving log data to SD.

The top line displays RESET LOG.

The left and right buttons are used to toggle between NO and YES.

Pressing enter when YES is displayed will reset/erase the log data stored on the gateway.

Once saved RESET DONE is displayed.

At any point in Reset Log Memory Mode you can use the up or down buttons to exit this mode. You will not be able to re-enter this mode till the SD card is ejected again.

BMP280 Synchronization Mode:

This mode is entered when synchronization with the BMP280 remote is initiated, when synchronization is successful and when synchronization fails or is broken. When synchronization is in progress this mode can’t be exited till it completes successfully or fails. Synchronization takes anywhere from 5 to 10 seconds. When synchronization is successful BMP SYNCD is displayed. When synchronization fails or is broken (battery died on the remote, etc.), SYNC BMP ERR is displayed. When not synced BMP280 Synchronization Mode can be entered into when cycling through the available modes. Entering BMP280 Synchronization Mode will prompt you to press [ENTER] 2 SYNC. This will try again to sync with the BMP280. Once synchronization is finally successful, this mode will no longer be available.

Setting the time and date:

The time can be set by selecting Set Time. Using the up/down arrows, cycle through the available modes till you get to Set Time. After pressing Enter you will be presented with a panel that allows you to set the date and time.

You can also use the SerialHexLoader application to set the time and date by opening a connection to the USB serial port and then selecting Command->Set Time from the menu bar.

Remote Mode Descriptions

The remote has 4 modes: Info, Log, BMP280 Synchronization, Gateway Synchronization, and Sleep.

Remote

Not all modes are available at all times. BMP280 Synchronization is only available when the synchronization status has changed (success, failed, retry.) Gateway Synchronization is only available immediately after BMP280 Synchronization is successful.

The center mode button is used to cycle through the available modes.

For all modes an indication of the radio activity is drawn as a 2 pixel high bar at the bottom of the display representing the radio activity state plus the number of packets queued to be sent. The queue can hold up to 4 packets (requests sent to the gateway.) Current radio activity is one of the bars, so the total possible bars is five.

Info Mode:

Displays the current time, temperature and elevation. When a log is in progress the elapsed time and percentage complete is displayed. The temperature can be displayed in Celsius or Fahrenheit. The elevation can be displayed in meters or feet.

Log Mode:

Controls starting, stopping, resuming, ending a log and swapping the start and end locations.

When a log isn’t in progress log mode displays the starting location and starting elevation.

When a log is in progress log mode displays the ending location and starting elevation.

The available actions are displayed on the top line of the display. Depending on the available options, pressing either the left of right button enact the command by sending the command to the gateway. The response from the gateway will cause the remote to update the display to reflect the result of the command being enacted.

BMP280 Synchronization Mode:

This mode is entered when synchronization with the BMP280 remote is initiated, when synchronization is successful and when synchronization fails or is broken. When synchronization is in progress this mode can’t be exited till it completes successfully or fails. Synchronization takes anywhere from 5 to 10 seconds. When synchronization is successful Gateway synchronization begins. When synchronization fails or is broken (battery died on the remote, etc.), SYNC BMP (in red) and [LEFT] 2 SYNC (in white) is displayed. BMP280 synchronization mode can’t be exited till it’s successful. BMP280 synchronization mode will prompt you to press [LEFT] 2 SYNC. This will retry BMP280 synchronization. When BMP280 synchronization fails, the only other UI option available is to put the remote into deep sleep by pressing the left and right buttons for 2 seconds.

Gateway Synchronization Mode:

This mode is entered immediately after BMP280 synchronization is successful. When synchronization is in progress SYNCING BASE is displayed and can’t be exited till it completes successfully. Gateway synchronization takes anywhere from 1 to 5 seconds. The only indication that gateway synchronization has failed, is that the message SYNCING BASE will remain displayed passed the expected sync time. This will only happen if the gateway isn’t running or out of range. The only UI option available when synchronization fails is to put the remote into deep sleep by pressing the left and right buttons for 2 seconds. Because this is a remote it’s useless if it can’t sync with the base. For this reason I didn’t write any additional code to deal with this rare situation.

Sleep Modes:

The 3 button remote has two sleep modes, a light sleep mode that just powers down the display, and a deep sleep mode that powers down the entire board including the RTC. When waking from either sleep mode the remote uses the packet broadcast from the BMP280 remote to know when to communicate with the gateway. When the remote is sleeping the gateway keeps its receiver on a few milliseconds after the BMP280 packet arrives to listen for a possible sync request from the 3 button remote. The response sent by the gateway to the 3 button remote sets up the current time, the current start and end locations, and whether a hike is in progress. The request from the 3 button remote also lets the gateway know that the remote is awake. The gateway will keep its receiver on till the remote goes to sleep. The remote goes into a light sleep mode automatically after 2 minutes of inactivity and a deep sleep mode when the left and right buttons are held down for 2 seconds. To wake up from light sleep the center “mode” button is pressed. To wake up from deep sleep mode the center mode button needs to be held down for 2 seconds. This 2 second requirement limits the chances of accidentally waking the 3 button remote when it’s in your pocket. Note that deep sleep can't be entered from Log mode to prevent accidental starting/stopping of the log.