Skip to content

Commit 492a57c

Browse files
committed
README: overhaul for uniformity
- add overview of functionality - add a supported hardware overview - move Golioth Features above Local set up - Separate Stream from State - Add Stream example JSON - Add LightDB State Example JSON - Clarify LightDB State functionality - update OTA instructions for Packages/Cohorts/Deployments - Move pipelines higher in the document - Reverence the pipelines section from the Stream section - Move hardware variants lower in the document - Simplify the hardware variants section - rename opening section - make all headings after the first subheadings - fix mention of LightDB Stream - properly style admonitions for GitHub - add section for additional sensors/components - remove hardware variations sections - add mention of use cases and link to projects site - add section for asking questions Signed-off-by: Mike Szczys <[email protected]>
1 parent 54230a8 commit 492a57c

File tree

1 file changed

+176
-112
lines changed

1 file changed

+176
-112
lines changed

README.md

Lines changed: 176 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -3,107 +3,43 @@
33
This repository highlights various aspects of the Golioth platform on
44
the Nordic Thingy91 and Thingy91x devices.
55

6-
This repo is based on the Golioth [Reference Design
7-
Template](https://github.com/golioth/reference-design-template).
8-
9-
## Local set up
10-
11-
> Do not clone this repo using git. Zephyr's `west` meta tool should be
12-
> used to set up your local workspace.
13-
14-
### Install the Python virtual environment (recommended)
15-
16-
``` shell
17-
cd ~
18-
mkdir thingy91-golioth
19-
python -m venv thingy91-golioth/.venv
20-
source thingy91-golioth/.venv/bin/activate
21-
pip install wheel west ecdsa
22-
```
23-
24-
### Use `west` to initialize and install
25-
26-
``` shell
27-
cd ~/thingy91-golioth
28-
west init -m [email protected]:golioth/thingy91-golioth.git .
29-
west update
30-
west zephyr-export
31-
pip install -r deps/zephyr/scripts/requirements.txt
32-
```
6+
Using a pre-compiled binary (or one you build yourself), you can
7+
provision the device via USB and connect to the Golioth cloud.
8+
Time-series readings for temperature, pressure, humidity, accelerometer,
9+
and various other sensors will periodically be sent to the cloud. You
10+
can manage the device from the Golioth web console, configuring
11+
settings, running RPCs, viewing logs, and performing Over-the-Air
12+
firmware update (OTA).
3313

34-
## Building the application
14+
This repository contains the firmware source code and [pre-built release
15+
firmware
16+
images](https://github.com/golioth/thingy91-golioth/releases).
3517

36-
Build Zephyr sample application for the Thingy91 (`thingy91_nrf9160_ns`)
37-
from the top level of your project. After a successful build you will
38-
see a new `build` directory. Note that any changes (and git commits) to
39-
the project itself will be inside the `app` folder. The `build` and
40-
`deps` directories being one level higher prevents the repo from
41-
cataloging all of the changes to the dependencies and the build (so no
42-
`.gitignore` is needed).
18+
## Supported Hardware
19+
- Nordic Thingy:91
20+
- Nordic Thingy:91X
4321

44-
Prior to building, update `VERSION` file to reflect the firmware version
45-
number you want to assign to this build. Then run the following commands
46-
to build and program the firmware onto the device.
22+
### Additional Sensors/Components
4723

48-
> You must perform a pristine build (use `-p` or remove the `build`
49-
> directory) after changing the firmware version number in the `VERSION`
50-
> file for the change to take effect.
51-
52-
### Build for Thingy91
53-
54-
``` text
55-
west build -p -b thingy91/nrf9160/ns --sysbuild app
56-
west flash
57-
```
58-
59-
### Build for Thingy91x
60-
61-
``` text
62-
west build -p -b thingy91x/nrf9151/ns --sysbuild app
63-
west flash --erase
64-
```
65-
66-
## Provision the device
67-
68-
Configure PSK-ID and PSK using the device shell based on your Golioth
69-
credentials and reboot:
70-
71-
``` text
72-
uart:~$ settings set golioth/psk-id <my-psk-id@my-project>
73-
uart:~$ settings set golioth/psk <my-psk>
74-
uart:~$ kernel reboot cold
75-
```
76-
77-
## Add Pipeline to Golioth
78-
79-
Golioth uses [Pipelines](https://docs.golioth.io/data-routing) to route
80-
stream data. This gives you flexibility to change your data routing
81-
without requiring updated device firmware.
82-
83-
Whenever sending stream data, you must enable a pipeline in your Golioth
84-
project to configure how that data is handled. Add the contents of
85-
`pipelines/cbor-to-lightdb-with-path.yml` as a new pipeline as follows
86-
(note that this is the default pipeline for new projects and may already
87-
be present):
88-
89-
1. Navigate to your project on the Golioth web console.
90-
2. Select `Pipelines` from the left sidebar and click the `Create`
91-
button.
92-
3. Give your new pipeline a name and paste the pipeline configuration
93-
into the editor.
94-
4. Click the toggle in the bottom right to enable the pipeline and
95-
then click `Create`.
96-
97-
All data streamed to Golioth in CBOR format will now be routed to
98-
LightDB Stream and may be viewed using the web console. You may change
99-
this behavior at any time without updating firmware simply by editing
100-
this pipeline entry.
24+
The Thingy91 Example Program doesn't require any additional sensors or
25+
components.
10126

10227
## Golioth Features
10328

104-
This app currently implements Over-the-Air (OTA) firmware updates,
105-
Settings Service, Logging, RPC, and both LightDB State and LightDB
106-
Stream data.
29+
This app implements:
30+
31+
- [Device Settings
32+
Service](https://docs.golioth.io/firmware/golioth-firmware-sdk/device-settings-service)
33+
- [Remote Procedure Call
34+
(RPC)](https://docs.golioth.io/firmware/golioth-firmware-sdk/remote-procedure-call)
35+
- [Stream
36+
Client](https://docs.golioth.io/firmware/golioth-firmware-sdk/stream-client)
37+
- [LightDB State
38+
Client](https://docs.golioth.io/firmware/golioth-firmware-sdk/light-db-state/)
39+
- [Over-the-Air (OTA) Firmware
40+
Upgrade](https://docs.golioth.io/firmware/golioth-firmware-sdk/firmware-upgrade/firmware-upgrade)
41+
- [Backend
42+
Logging](https://docs.golioth.io/device-management/logging/)
10743

10844
### Settings Service
10945

@@ -114,8 +50,6 @@ The following settings should be set in the Device Settings menu of the
11450
Adjusts the delay between sensor readings. Set to an integer value
11551
(seconds).
11652

117-
Default value is `60` seconds.
118-
11953
- `LED_FADE_SPEED_MS`
12054
Adjusts the total LED fade time from 0.5 to 10 seconds. Set to an
12155
integer value (milliseconds).
@@ -240,34 +174,50 @@ application.
240174

241175
Up-counting and down-counting timer readings are periodically sent to
242176
the `actual` path of the LightDB Stream service. The frequency that
243-
these reading change is based on the `LOOP_DELAY_S` setting.
177+
these readings change is based on the `LOOP_DELAY_S` setting.
244178

245179
- `desired` values may be changed from the cloud side. The device will
246180
recognize these, validate them for \[0..9999\] bounding, and then
247181
reset these endpoints to `-1`. Changes may be made while the device
248182
is not connected and will persist until the next time a connection
249183
is established.
250184
- `actual` values will be updated by the device whenever a valid value
251-
is received from the `desired` endpoints. The cloud may read the
185+
is received from the `desired` paths. The cloud may read the
252186
`state` endpoints to determine device status, but only the device
253-
should ever write to the `state` endpoints.
187+
should ever write to the `state` paths.
188+
189+
``` json
190+
{
191+
"desired": {
192+
"counter_down": -1,
193+
"counter_up": -1
194+
},
195+
"state": {
196+
"counter_down": 9268,
197+
"counter_up": 731
198+
}
199+
}
200+
```
254201

255-
## OTA Firmware Update
202+
### OTA Firmware Update
256203

257204
This application includes the ability to perform Over-the-Air (OTA)
258-
firmware updates:
259-
260-
1. Update the version number in the
261-
<span class="title-ref">VERSION</span> file and perform a pristine
262-
(important) build to incorporate the version change.
263-
2. Upload the
264-
<span class="title-ref">build/app/zephyr/zephyr.signed.bin</span>
265-
file as a Package for your Golioth project.
266-
- Use either <span class="title-ref">thingy91</span> or
267-
<span class="title-ref">thingy91x</span> as the package name,
205+
firmware updates. To do so, you need a binary compiled with a different
206+
version number than what is currently running on the device.
207+
208+
> [!NOTE]
209+
> If a newer release is available than what your device is currently
210+
> running, you may download the pre-compiled binary that ends in
211+
> `_update.bin` and use it in step 2 below.
212+
213+
1. Update the version number in the `VERSION` file and perform a
214+
pristine (important) build to incorporate the version change.
215+
2. Upload the `build/app/zephyr/zephyr.signed.bin` file as a Package
216+
for your Golioth project.
217+
- Use either `thingy91` or `thingy91x` as the package name,
268218
depending on which board the update file was built for. (These
269-
package names were configured in this repository's board
270-
<span class="title-ref">.conf</span> files.)
219+
package names were configured in this repository's board `.conf`
220+
files.)
271221
- Use the same version number from step 1.
272222
3. Create a Cohort for your device type (thingy91 or thingy91x)
273223
4. Create a Deployment for your Cohort using the package name and
@@ -278,3 +228,117 @@ firmware updates:
278228
Visit [the Golioth Docs OTA Firmware Upgrade
279229
page](https://docs.golioth.io/firmware/golioth-firmware-sdk/firmware-upgrade/firmware-upgrade)
280230
for more info.
231+
232+
This repo is based on the Golioth [Reference Design
233+
Template](https://github.com/golioth/reference-design-template).
234+
235+
## Add Pipeline to Golioth
236+
237+
Golioth uses [Pipelines](https://docs.golioth.io/data-routing) to route
238+
stream data. This gives you flexibility to change your data routing
239+
without requiring updated device firmware.
240+
241+
Whenever sending stream data, you must enable a pipeline in your Golioth
242+
project to configure how that data is handled. Add the contents of
243+
`pipelines/cbor-to-lightdb-with-path.yml` as a new pipeline as follows
244+
(note that this is the default pipeline for new projects and may already
245+
be present):
246+
247+
1. Navigate to your project on the Golioth web console.
248+
2. Select `Pipelines` from the left sidebar and click the `Create`
249+
button.
250+
3. Give your new pipeline a name and paste the pipeline configuration
251+
into the editor.
252+
4. Click the toggle in the bottom right to enable the pipeline and
253+
then click `Create`.
254+
255+
All data streamed to Golioth in CBOR format will now be routed to
256+
LightDB Stream and may be viewed using the web console. You may change
257+
this behavior at any time without updating firmware simply by editing
258+
this pipeline entry.
259+
260+
## Local set up
261+
262+
> [!IMPORTANT]
263+
> Do not clone this repo using git. Zephyr's `west` meta tool should be
264+
> used to set up your local workspace.
265+
266+
### Install the Python virtual environment (recommended)
267+
268+
``` shell
269+
cd ~
270+
mkdir thingy91-golioth
271+
python -m venv thingy91-golioth/.venv
272+
source thingy91-golioth/.venv/bin/activate
273+
pip install wheel west ecdsa
274+
```
275+
276+
### Use `west` to initialize and install
277+
278+
``` shell
279+
cd ~/thingy91-golioth
280+
west init -m [email protected]:golioth/thingy91-golioth.git .
281+
west update
282+
west zephyr-export
283+
pip install -r deps/zephyr/scripts/requirements.txt
284+
```
285+
286+
## Building the application
287+
288+
Build Zephyr sample application for the Thingy91 (`thingy91_nrf9160_ns`)
289+
from the top level of your project. After a successful build you will
290+
see a new `build` directory. Note that any changes (and git commits) to
291+
the project itself will be inside the `app` folder. The `build` and
292+
`deps` directories being one level higher prevents the repo from
293+
cataloging all of the changes to the dependencies and the build (so no
294+
`.gitignore` is needed).
295+
296+
Prior to building, update `VERSION` file to reflect the firmware version
297+
number you want to assign to this build. Then run the following commands
298+
to build and program the firmware onto the device.
299+
300+
> [!WARNING]
301+
> You must perform a pristine build (use `-p` or remove the `build`
302+
> directory) after changing the firmware version number in the `VERSION`
303+
> file for the change to take effect.
304+
305+
### Build for Thingy91
306+
307+
``` text
308+
west build -p -b thingy91/nrf9160/ns --sysbuild app
309+
west flash
310+
```
311+
312+
### Build for Thingy91x
313+
314+
``` text
315+
west build -p -b thingy91x/nrf9151/ns --sysbuild app
316+
west flash --erase
317+
```
318+
319+
## Provision the device
320+
321+
Configure PSK-ID and PSK using the device shell based on your Golioth
322+
credentials and reboot:
323+
324+
``` text
325+
uart:~$ settings set golioth/psk-id <my-psk-id@my-project>
326+
uart:~$ settings set golioth/psk <my-psk>
327+
uart:~$ kernel reboot cold
328+
```
329+
330+
## External Libraries
331+
332+
The following code libraries are installed by default. If you are not
333+
using the custom hardware to which they apply, you can safely remove
334+
these repositories from `west.yml` and remove the includes/function
335+
calls from the C code.
336+
337+
- [zephyr-network-info](https://github.com/golioth/zephyr-network-info)
338+
is a helper library for querying, formatting, and returning network
339+
connection information via Zephyr log or Golioth RPC
340+
341+
## Have Questions?
342+
343+
Please get in touch with Golioth engineers by starting a new thread on
344+
the [Golioth Forum](https://forum.golioth.io/).

0 commit comments

Comments
 (0)