Trashcan Monitor - nRF9160 DK Follow-Along Guide
This follow-along guide shows how to build your own Trashcan Monitor using widely available off-the-shelf development boards from our partners. We call this Follow-Along Hardware, and we think it's one of the quickest and easiest ways to get started building an IoT proof-of-concept with Golioth.
You will learn how to assemble the hardware, flash a pre-built firmware image onto the device, and connect to the Golioth cloud in minutes. The follow-along hardware runs the same open-source firmware as the custom Golioth hardware described in the project page, and we provide instructions on how to build it yourself if you want to make changes for your specific application.
Build the hardware
The follow-along hardware is based on the Nordic nRF9160 DK cellular IoT development board for LTE-M & NB-IoT. We use a Qwiic Shield for Arduino from Sparkfun to add four Qwiic host sockets to the nRF9160 DK board.
Two off-the-shelf sensor boards are connected via the Qwiic sockets, while one sensor is connected through a breakout board using wires:
- Sparkfun Qwiic Shield for Arduino
- Adafruit VL53L0X Breakout Board
- Sparkfun Environmental Combo Breakout Board
- DFRobot Gravity LIS2DH Breakout Board
Device Photos
Hardware Block Diagram
Parts List
To assemble the follow-along hardware, you will need to purchase the following parts:
Quantity | Manufacturer Part Number | DigiKey Part Number | Description |
---|---|---|---|
1 | NRF9160-DK | NRF9160-DK-ND | Nordic nRF9160 DK Cellular IoT development kit |
1 | GL1-100 | 1887-GL1-100-ND | Hologram Hyper eUICC IoT SIM Card |
1 | Sparkfun Qwiic Shield for Arduino | DEV-14352 | Qwiic Shield for Arduino |
1 | Adafruit VL53L0X Breakout Board | 3317 | VL53L0X Time of Flight Distance Sensor |
1 | Sparkfun Environmental Combo Breakout Board | SEN-22858 | SparkFun Environmental Combo Breakout - ENS160 and BME280 |
1 | DFRobot Gravity LIS2DH Breakout Board | SEN0224 | Gravity: I2C Triple Axis Accelerometer - LIS2DH |
Assembly Instructions
Step 1 - Install SIM card
With the board powered off, insert the SIM card into the socket and make sure the "SIM select" switch (SW7
) is set to "SIM".
For more information about how to use this switch to select between the SIM card socket and the Embedded SIM (eSIM), see the Nordic SIM and eSIM documentation.
Step 2 - Set VDD IO voltage
Set switch SW9
(located next to the power switch) to 3V
to set the VDD IO voltage to +3V.
For more information about how to use this switch to set the VDD supply rail, see the Nordic VDD supply rail documentation.
Step 3 - Install Arduino UNO click shield
Install the Sparkfun Qwiic Shield for Arduino into the nRF9160 DK Arduino UNO header socket.
Step 4 - Install Qwiic sensor boards
- Connect the VL53L0X Breakout Board via Qwiic
- Connect the Environmental Combo Breakout Board via Qwiic
- Use jumper wire to connect the DFRobot Gravity Breakout Board
- Connect SCL, SDA to P0.19, P0.18
- Connect the VIN and GND on the sensor breakout board to the 3.3v and GND pins you added to the Qwiic Shield.
Use a multimeter to check for shorts between the 3.3v/5v/GND and surrounding pins after soldering. A short will damage your nRF9160dk.
Flash the firmware
The firmware source code and pre-built firmware images for this reference design are available on GitHub under a permissive Apache-2.0 license.
The Trashcan Monitor firmware is based on the Golioth Reference Design Template. Changes from the upstream template are periodically pulled into new releases of this firmware. Check out the firmware CHANGELOG for a detailed list of changes included in each release.
Flash the pre-built firmware image
We recommend getting started by flashing the latest pre-built release firmware image. These release images have been tested by the Golioth team and are the quickest way to verify that the hardware is working correctly.
Step 1 - Download the pre-built firmware image
Download the latest trashcan_vX.X.X_nrf9160dk_full.hex
firmware image file from:
Step 2 - Install nRF Connect for Desktop
We recommend using the nRF Connect for Desktop application to flash the pre-built firmware image to the board.
You can download the latest version for Windows, Mac, and Linux from the Nordic website (make sure to choose your operating system from the dropdown):
Step 3 - Flash firmware with the Programmer app
After installing nRF Connect for Desktop, open the Programmer app:
Click on "Select Device" to show the list of available boards:
Select the board used in your follow-along hardware:
Drag & Drop the trashcan_vX.X.X_nrf9160dk_full.hex
file onto the "File memory layout" pane:
Click "Erase & Write" to program the firmware image into the device:
Step 4 - Verify firmware with the Serial Terminal app
If the firmware was programmed successfully, you can verify the firmware version printed on the serial terminal.
Open the nRF Connect for Desktop Serial Terminal app:
Click on "Select Device" to show the list of available boards:
Select the board used in your follow-along hardware:
Click "Connect to port":
You should see the firmware version printed in the log output (if you connected after the log message was printed, press the RESET
button on the board):
Connect to Golioth
In this section you will learn how to connect the follow-along hardware to the Golioth Cloud.
Register & Log In
The Golioth Console provides a web-based dashboard for registering & managing your devices.
To get started, log in to the Golioth Console. If you have not already signed up for a Golioth account, choose "Sign Up" to register for a new account first.
Register the Device
The Quick Start Wizard will guide you through the process of creating your first Project and registering your first device.
Launch the Wizard by clicking on the "Quick Start" button in the top right of the console window.
If you previously registered for Golioth, you may have already created a project and registered a device the first time you used the Quick Start Wizard. Feel free to skip this section and register a new device in your existing project instead of creating a new project via the Quick Start Wizard.
Step 1 - Create a Project
All devices must belong to a Project. Before you can register the device you must create a Project in the Golioth Console.
Step 2 - Register a Device
Choose a name for the device or use the randomly generated one.
Step 3 - Setup your Device
The Quick Start Wizard will automatically generate pre-shared key credentials for the device that was just registered.
After you click "Close" in the Quick Start Wizard, you can always find these credentials again on the device's "Credentials" tab.
Provision the Device
Now that the device is registered in the Golioth Console, the device hardware needs to be provisioned with the pre-shared key that was generated in the previous step.
In the nRF Connect for Desktop Serial Terminal (or your preferred serial terminal application), set the following values using the device shell:
uart:~$ settings set golioth/psk-id <my-psk-id@my-project>
uart:~$ settings set golioth/psk <my-psk>
uart:~$ kernel reboot cold
For example, setting the golioth/psk-id
should look like this:
After clicking the "Send" button, you should see the command output showing that the PSK-ID was saved to the device's non-volatile storage:
Verify the Device Connection
Once the device has rebooted, the firmware should automatically connect to the Golioth Cloud.
Once the device has connected, you should see the device "Connection Status" change to "online".
If you click on the device's "LightDB Stream" tab, you should see data streaming in from the device.
Congratulations, you have successfully connected your follow-along hardware to the Golioth Cloud!
Next Steps
Explore the Golioth Console
Now that your device is connected to the Golioth Cloud, you can explore the other features of the Golioth Console.
Some ideas:
- Check out the "Logs" tab to see real-time log messages streaming from the device.
- Navigate to the "Remote Procedure Call" tab and call the
get_network_info
method to query and return detailed information about the device's network connection.
Try the Command Line Tools
In addition to using the web-based Console, it is also possible to provision and manage devices using the Golioth Command Line Tools.
Try logging into your account via the command line tools and list the devices in your project with the command:
goliothctl device list
Compile a custom firmware image
The source code for the pre-built firmware image can be customized for your specific application. For detailed instructions on how to build the reference design firmware used in this guide, see the README in the firmware GitHub repo.
If you're brand new to building firmware with Zephyr, we provide free online developer training.