-
-
Notifications
You must be signed in to change notification settings - Fork 43
How to Update the Firmware
- Introduction
- Prerequisites
- Loading the Nano Firmware
- Updating the Text Files on the SD Card
- About the Safecast API
Firmware is software that’s embedded in a device or piece of hardware. Before using your device, you will need to load Nano firmware (with latest upgrades and fixes). You'll also need to configure the device by using the text files stored the SD card.
NOTE: The Nano power switch MUST be turned OFF before connecting (the Fio board powers from the FTDI cable)!
NOTE: If you have a BLEBee or other wireless module, it MUST be removed before reprogramming, since it shares TX/RX signals!
bGeigie Nano firmware loading (installation/re-flashing) requires:
- An FTDI breakout board 3.3V (a small accessory tool), such as:
- FTDI Friend + extras - v1.0 and short-length miniUSB cable (standard type A-to-miniB)
- GearMo USB to 3.3v TTL Header like FTDI TTL-232R-3V3 with Windows 10 Support
- FTDI and AVR drivers and the current version of the Nano firmware, which is the .hex file in the bGeigieNanoKit repository. The Mac uploader app automatically retrieves all software, and the MS-Win XLoader includes AVR.
There are three alternative ways, please choose one that works for you.
-
Install the latest FTDI serial driver
-
Install Arduino sources
-
Install CrossPack for AVR Development (contains AVRDUDE command and AVR cross-compiler)
-
Edit your environment $HOME/.bashrc to add the following lines:
export ARDUINODIR=$HOME/arduino-1.0.4/ export BOARD=fio
-
Start a new Terminal window
-
Download the latest software
-
Build and upload the software:
cp -r libraries $HOME/arduino-1.0.4/ make make upload
NOTE: To learn how to compile source code in general, see Lady Ada's AVR Tutorial.
-
Install the latest FTDI serial driver
-
Install CrossPack for AVR Development (which contains AVRDUDE command and AVR cross-compiler)
-
Upload the Nano firmware (type the commands in a Terminal window): NOTE: If you have more than one FTDI board, or some other USB gadgets, please disconnect anything but the FTDI/Nano.
a. Download the latest firmware in HEX format (to be written on the Fio board):
wget https://github.com/Safecast/bGeigieNanoKit/raw/master/bGeigieNano.hex
b. Upload the firmware:
/usr/local/bin/avrdude -DV -p atmega328p -P /dev/tty.usb* -c arduino -b 57600 -U flash:w:bGeigieNano.hex:i
Download the Uploader app from the bGeigie repository on GitHub. The file for the app takes the form "bGeigeiNano_V1.#.#_uploader.app.zip". This app will retrieve all of the software necessary for the build, including the FTDI driver.
-
With the Nano powered OFF, connect the FTDI breakout board 3.3V to your Nano Fio pins (as described in the tutorials)
-
Connect a short USB cable to the mini-USB on the breakout board, and to the USB on your Mac.
-
On your Mac, browse to the "bGeigeiNano_V1.#.#_uploader.app.zip" file and unzip it. Click on the executable file's view RAW button to download the app's executable self-opening zip file.
Alternatively, if you're browsing in the Nano firmware master repo, you first need to click once on the current *_V1.#.#.uploader.app.zip file to open the executable file page to see the "view RAW" (download) button.
-
Click on the downloaded *.uploader.app.zip executable self-opening file to unzip the app.
-
Find and click on the unzipped file "bGeigieNano_V1.#.#_uploader.app" (e.g. the current version is "bGeigeiNano_V1.3.5_uploader.app"). The firmware will be flashed or loaded. The Nano should soon power up with the new firmware version number displayed in the top line of the splash screen "bGeigie Nano 1.#.#". If not, try again.
-
Go to general re-initialization for GPS Reset (at top).
Most probably your distribution includes the FTDI kernel drivers, check your kernel log:
- In a terminal, change/login as root and issue
dmesg -c
command - Connect the FTDI cable
- Repeat step 1. If you see any messages about FTDI you are probably fine.
- If there are no new messages or you see errors, consult your distribution help/manual or have a look at the ftdi driver installation guides, including for Linux.
To flash the firmware, consult Use a Prebuilt Image for Mac OS X.
- To install the firmware on MS Windows, you will need to have the FTDI driver. The driver allows for communication between the Nano Fio and the computer over the breakout board and a USB cable.
- Plug the FDTI breakout board onto the 6-pin header, and then plug the recharging USB cable into your computer. The Nano will power up by itself (even though the Nano power switch is off). Note that you must use the 3.3V FTDI cable and insert it properly at the angled header pins on the FIO board. Make sure to follow the pinout labels for which end is for the black wire, and which is green.
- Then run X-loader, select COM port, and browse to HEX file (the current version of the Nano firmware which is the bGeigieNano.hex file in the bGeigieNanoKit repository.
Notes:
-
Leave the Nano power switch OFF when connecting the USB to the PC.
-
Make sure you have disconnected any additional modules (such as BLEBee) before programming.
-
If you have the kind of FTDI cable that places the LED at the USB end, you will see a light flashing when there's power, and also during uploads.
-
Restart after the drivers load automatically on Windows 7 Pro after first connecting the FTDI cable and the Nano. You may not need the drivers from the mini-CD that came with cable.
-
The hex file contains the firmware. The Xloader uses a copy of that file on your drive. Click the RAW button to see the text in the file only. With Notebook or a plain ASCII text editor, copy all of the text into a new text file on your drive, and give it the file extension “.hex”. It's best to save the hex file in the same XLoader folder.
-
The Arduino Fio uses ATmega328 microcontroller: Arduino list.
-
If you need more help, try reviewing Arduino's guides and help documentation.
Reset the GPS Unit
Note that for v.1.3.2 and higher, you will need to reset the GPS unit to factory settings after you've applied the new firmware.
- Remove the SD card and power on the Nano.
- Wait one minute, then switch off the Nano. The display will show a warning "No SD Card/GPS reset."
- Insert the SD card, and then switch the Nano on and take it outside.
It will typically take the Nano a few minutes to obtain its first GPS lock. Afterward, GPS locks should be immediate.
The SD card comes with two preloaded files, config.txt and safecast.txt.
If the files are corrupted or deleted from the micro-SD card, the Nano will not work properly. A new micro-SD card has to have FAT format, as well as the two text files in the root. We recommend maintaining a backup of those files. The default settings for the files are available online at https://github.com/Safecast/bGeigieNanoKit/tree/master/SD%20card.
You do not need to make any changes to config.txt. In the next step, you will edit the safecast.txt file to configure your Wi-Fi connection. You will also need to enter your Safecast account information and API key.
- Insert the SD card into your computer.
- Open the safecast.txt file in a text editor that uses ASCII encoding (UTF-8 encoding will cause errors). We recommend using Textmate for Mac and EditPad Lite for Windows. Both of these editors are free.
- Edit the safecast.txt to include your:
- Safecast username
- Wifi ID and password
- Safecast API key
- Save the file.
After completing these steps, your safecast.txt file should look like this:
The second to last line, opcn2_ids, contains information about the particulate sensor. The last line contains IDs for the humidity and temperature sensors.
The micro-SD card comes with Apple disc system files and folders. The file names for these begin with a dot. [Non-Apple devices users can delete these Apple system files.]
Your device is designed to submit data to the Safecast database through the Safecast API. To enable data submission, you’ll need to obtain an API key. The key is a credential that gives you access to the API, much like a username and password give you access to an email account. Register on the Safecast site to get an API key.
You can learn about how the Safecast API works by visiting the API documentation. *Expert users may edit the calibrated nuclide efficiency fields like CPMF (counts per minute factor Cs137) with CPMN (counts per minute nuclide Cs137), but not for submitting data -- not without first consulting the Safecast API dataset.