Skip to content

Update SigkSens

Brian Smith edited this page Dec 22, 2018 · 9 revisions

Periodically, SigkSens is updated, and you may want to update it on your MCU(s). For example, there may be a new type of sensor added, or a bug fixed. And occasionally, Signal K is updated requiring an update to SigkSens. This document describes the various ways to update SigkSens on your MCU.

There are two steps to any update: getting the lastest firmware source code from GitHub, and then compiling the source code and flashing the resulting executable to your MCU.

Getting New Source Code

If you're familiar with using Git and/or GitHub, and you've cloned the SigkSens repository to your computer, we will assume you know how to update to the latest version. So do that.

If not, do this:

Instructions for the Arduino IDE (If you use PlatformIO, skip to here)

  1. In the Arduino IDE, go to File - Preferences and see what your "Sketchbook location" is. You'll need it in step 2.

  2. Log into the SigkSens repository on GitHub. Click the [Clone or Download] button, then Click "Download ZIP", and when prompted, select your Sketchbook folder. When the file has been downloaded, extract / unzip it to the same folder you downloaded it to. (If you have an option to "Extract to here", choose that.) A folder called SigkSens-master should be created in your Sketchbook folder, and all of the files in the project will be extracted inside it.

  3. The current version of SigkSens will be in a folder that's in your Sketchbook folder, called SigkSens. Rename SigkSens to SigkSensOld, or SigkSensPrevious, or some other name that will tell you what it is, just in case you ever want to go back to it.

  4. Rename the folder called SigkSens-master to SigkSens. Be sure to match the case and spelling exactly.

  5. Exit the Arduino IDE, then restart it, and open the //SigkSens/SigkSens/SigkSens.ino file. The file should open, and you should NOT be prompted to create a folder named SigkSens - if you are, you did something wrong in Step 2, 3, or 4. Fix whatever you did wrong so that you have a SigkSens folder under your Sketch folder. NOTE: there are two SigkSens folders, one under the other.

  6. If you use a my_config.h file, edit the config.h file that you just downloaded and un-comment the last line, so that your my_config.h file will be included. (See the Add a Sensor document for details on using a my_config.h file.)

  7. Skip to Flashing Firmware to Your MCU.

Instructions for PlatformIO

TODO: Write instructions for PIO here.

Flashing Firmware to Your MCU

Once you have the new source code, it should be a simple matter of compiling it and downloading it to your MCU, just as you would do with any other program. If the version of SigkSens that's currently on your MCU supports OTA (Over The Air) Updates, you can do the update wirelessly. Or, of course, you can plug the MCU into your computer via the serial connection and update it that way. There is one other issue: the config.h file, in which you configure a particular MCU to work with SigkSens the way you want it to, will be overwritten when you update all of your source code files. In order to prevent that, SigkSens can use a file called my_config.h. Below are details for both of these issues: Using my_config.h, and OTA Updates.

OTA Updates

If you use the Arduino IDE, OTA updates are quite simple. (If you use PlatformIO, skip to here

  1. Your MCU must have at least 2 meg of RAM.

  2. Your Arduino IDE must be version 1.6.7 or later.

  3. The version of SigkSens that's already on your MCU must be one that supports OTA. SigkSens doesn't use a formal version number, but OTA updating was added on October 9, 2018. If the version on your MCU was downloaded from GitHub after that, you should be good.

  4. Your MCU must be powered up and connected to the same network that your computer is connected to.

  5. Open SigkSens in the Arduino IDE, select Tools _ Port from the main menu, and select your MCU on a Network Port (see picture below).

ota update port selection

  1. Select Sketch _ Upload from the main menu, or click on the Upload icon. At some point, you'll be prompted for a password: the default is * bonvoyage *. (You can - and should - change this in config.h, or my_config.h if you use that file.) The program should upload to the MCU and restart.

OTA Updates with PlatformIO

TODO: Write instructions