Skip to content

Commit 32fd70a

Browse files
committed
README: move from ReStructured Text to Markdown
This commit converts README.rst to README.md. No substantive changes have been made. Signed-off-by: Mike Szczys <[email protected]>
1 parent 6e3b3bb commit 32fd70a

File tree

2 files changed

+319
-346
lines changed

2 files changed

+319
-346
lines changed

README.md

Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
# Golioth Modbus Reference Design
2+
3+
This repository contains the firmware source code and [pre-built release
4+
firmware
5+
images](https://github.com/golioth/reference-design-modbus-vibration-monitor/releases)
6+
for the Golioth Modbus Vibration Monitor reference design.
7+
8+
The full project details are available on the [Modbus Vibration Monitor
9+
Project
10+
Page](https://projects.golioth.io/reference-designs/modbus-vibration-monitor),
11+
including follow-along guides for building an IoT Modbus Vibration
12+
Monitor yourself using widely available off-the-shelf development
13+
boards.
14+
15+
We call this **Follow-Along Hardware**, and we think it's one of the
16+
quickest and easiest ways to get started building an IoT
17+
proof-of-concept with Golioth. In the follow-along guides, you will
18+
learn how to assemble the hardware, flash a pre-built firmware image
19+
onto the device, and connect to the Golioth cloud in minutes.
20+
21+
Once you have completed a follow-along guide for one of our supported
22+
hardware platforms, the instructions below will walk you through how to
23+
build and configure the firmware yourself.
24+
25+
## Supported Hardware
26+
27+
This firmware can be built for a variety of supported hardware
28+
platforms.
29+
30+
> In Zephyr, each of these different hardware variants is given a unique
31+
> "board" identifier, which is used by the build system to generate
32+
> firmware for that variant.
33+
>
34+
> When building firmware using the instructions below, make sure to use
35+
> the correct Zephyr board identifier that corresponds to your
36+
> follow-along hardware platform.
37+
38+
| Hardware | Zephyr Board | Follow-Along Guide |
39+
| ------------------------------------------------------------ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------ |
40+
| ![image](images/modbus_vibration_monitor_fah_nrf9160_dk.jpg) | `nrf9160dk_nrf9160_ns` | [nRF9160 DK Follow-Along Guide](https://projects.golioth.io/reference-designs/modbus-vibration-monitor/guide-nrf9160-dk) |
41+
42+
**Follow-Along Hardware**
43+
44+
| Hardware | Zephyr Board | Project Page |
45+
| ---------------------------------------------------------------------- | -------------------------------- | --------------------------------------------------------------------------------------------------------------- |
46+
| ![image](images/modbus_vibration_monitor_aludel_mini_v1_photo_top.jpg) | `aludel_mini_v1_sparkfun9160_ns` | [Modbus Vibration Monitor Project Page](https://projects.golioth.io/reference-designs/modbus-vibration-monitor) |
47+
| ![image](images/modbus_vibration_monitor_aludel_mini_v1_photo_top.jpg) | `aludel_elixir_ns` | |
48+
49+
**Custom Golioth Hardware**
50+
51+
## Firmware Overview
52+
53+
This reference design firmware demonstrates how to interface with a
54+
[Banner Sure Cross®
55+
QM30VT2](https://www.bannerengineering.com/us/en/products/part.806276.html)
56+
sensor via the Modbus protocol and send vibration and temperature
57+
measurements to the cloud using the Golioth IoT platform.
58+
59+
Sensor values are uploaded to the LightDB stream database in the Golioth
60+
Cloud. The sensor sampling frequency and other sensor parameters are
61+
remotely configurable via the Golioth Settings service.
62+
63+
### Supported Golioth Zephyr SDK Features
64+
65+
This firmware implements the following features from the Golioth Zephyr
66+
SDK:
67+
68+
- [Device Settings
69+
Service](https://docs.golioth.io/firmware/zephyr-device-sdk/device-settings-service)
70+
- [LightDB State
71+
Client](https://docs.golioth.io/firmware/zephyr-device-sdk/light-db/)
72+
- [LightDB Stream
73+
Client](https://docs.golioth.io/firmware/zephyr-device-sdk/light-db-stream/)
74+
- [Logging
75+
Client](https://docs.golioth.io/firmware/zephyr-device-sdk/logging/)
76+
- [Over-the-Air (OTA) Firmware
77+
Upgrade](https://docs.golioth.io/firmware/device-sdk/firmware-upgrade)
78+
- [Remote Procedure Call
79+
(RPC)](https://docs.golioth.io/firmware/zephyr-device-sdk/remote-procedure-call)
80+
81+
#### Device Settings Service
82+
83+
The following settings can be set in the Device Settings menu of the
84+
[Golioth Console](https://console.golioth.io).
85+
86+
- `LOOP_DELAY_S`
87+
Adjusts the delay between sensor readings. Set to an integer value
88+
(seconds).
89+
90+
Default value is `60` seconds.
91+
92+
#### LightDB Stream Service
93+
94+
Sensor data is periodically sent to the following `sensor/*` endpoints
95+
of the LightDB Stream service:
96+
97+
- `sensor/temperature/celcius`: Temperature (°C)
98+
- `sensor/temperature/farenheight`: Temperature (°F)
99+
- `sensor/x_axis/acceleration/crest_factor`: X-Axis Crest Factor
100+
- `sensor/x_axis/acceleration/high_frequency_rms`: X-Axis
101+
High-Frequency RMS Acceleration (G)
102+
- `sensor/x_axis/acceleration/kurtosis`: X-Axis Kurtosis
103+
- `sensor/x_axis/acceleration/peak`: X-Axis Peak Acceleration (G)
104+
- `sensor/x_axis/acceleration/rms`: X-Axis RMS Acceleration (G)
105+
- `sensor/x_axis/velocity/peak/frequency`: X-Axis Peak Velocity
106+
Component Frequency (Hz)
107+
- `sensor/x_axis/velocity/peak/in_per_sec`: X-Axis Peak Velocity
108+
(in/sec)
109+
- `sensor/x_axis/velocity/peak/mm_per_sec`: X-Axis Peak Velocity
110+
(mm/sec)
111+
- `sensor/x_axis/velocity/rms/in_per_sec`: X-Axis RMS Velocity
112+
(in/sec)
113+
- `sensor/x_axis/velocity/rms/mm_per_sec`: X-Axis RMS Velocity
114+
(mm/sec)
115+
- `sensor/x_axis/acceleration/crest_factor`: X-Axis Crest Factor
116+
- `sensor/x_axis/acceleration/high_frequency_rms`: X-Axis
117+
High-Frequency RMS Acceleration (G)
118+
- `sensor/z_axis//acceleration/kurtosis`: X-Axis Kurtosis
119+
- `sensor/z_axis//acceleration/peak`: Z-Axis Peak Acceleration (G)
120+
- `sensor/z_axis//acceleration/rms`: Z-Axis RMS Acceleration (G)
121+
- `sensor/z_axis//velocity/peak/frequency`: Z-Axis Peak Velocity
122+
Component Frequency (Hz)
123+
- `sensor/z_axis//velocity/peak/in_per_sec`: Z-Axis Peak Velocity
124+
(in/sec)
125+
- `sensor/z_axis//velocity/peak/mm_per_sec`: Z-Axis Peak Velocity
126+
(mm/sec)
127+
- `sensor/z_axis//velocity/rms/in_per_sec`: Z-Axis RMS Velocity
128+
(in/sec)
129+
- `sensor/z_axis//velocity/rms/mm_per_sec`: Z-Axis RMS Velocity
130+
(mm/sec)
131+
132+
On hardware platforms with support for battery monitoring, battery
133+
voltage and level readings are periodically sent to the following
134+
`battery/*` endpoints:
135+
136+
- `battery/batt_v`: Battery Voltage (V)
137+
- `battery/batt_lvl`: Battery Level (%)
138+
139+
#### LightDB State Service
140+
141+
The concept of Digital Twin is demonstrated with the LightDB State
142+
`example_int0` and `example_int1` variables that are members of the
143+
`desired` and `state` endpoints.
144+
145+
- `desired` values may be changed from the cloud side. The device will
146+
recognize these, validate them for \[0..65535\] bounding, and then
147+
reset these endpoints to `-1`
148+
- `state` values will be updated by the device whenever a valid value
149+
is received from the `desired` endpoints. The cloud may read the
150+
`state` endpoints to determine device status, but only the device
151+
should ever write to the `state` endpoints.
152+
153+
#### Remote Procedure Call (RPC) Service
154+
155+
The following RPCs can be initiated in the Remote Procedure Call menu of
156+
the [Golioth Console](https://console.golioth.io).
157+
158+
- `get_network_info`
159+
Query and return network information.
160+
161+
- `reboot`
162+
Reboot the system.
163+
164+
- `set_log_level`
165+
Set the log level.
166+
167+
The method takes a single parameter which can be one of the
168+
following integer values:
169+
170+
- `0`: `LOG_LEVEL_NONE`
171+
- `1`: `LOG_LEVEL_ERR`
172+
- `2`: `LOG_LEVEL_WRN`
173+
- `3`: `LOG_LEVEL_INF`
174+
- `4`: `LOG_LEVEL_DBG`
175+
176+
## Building the firmware
177+
178+
The firmware build instructions below assume you have already set up a
179+
Zephyr development environment and have some basic familiarity with
180+
building firmware using the Zephyr Real Time Operating System (RTOS).
181+
182+
If you're brand new to building firmware with Zephyr, you will need to
183+
follow the [Zephyr Getting Started
184+
Guide](https://docs.zephyrproject.org/latest/develop/getting_started/)
185+
to install the Zephyr SDK and related dependencies.
186+
187+
We also provide free online [Developer
188+
Training](https://training.golioth.io) for Zephyr at:
189+
190+
<https://training.golioth.io/docs/zephyr-training>
191+
192+
> Do not clone this repo using git. Zephyr's `west` meta-tool should be
193+
> used to set up your local workspace.
194+
195+
### Create a Python virtual environment (recommended)
196+
197+
``` shell
198+
cd ~
199+
mkdir golioth-reference-design-modbus-vibration-monitor
200+
python -m venv golioth-reference-design-modbus-vibration-monitor/.venv
201+
source golioth-reference-design-modbus-vibration-monitor/.venv/bin/activate
202+
```
203+
204+
### Install `west` meta-tool
205+
206+
``` shell
207+
pip install wheel west
208+
```
209+
210+
### Use `west` to initialize the workspace and install dependencies
211+
212+
``` shell
213+
cd ~/golioth-reference-design-modbus-vibration-monitor
214+
west init -m [email protected]:golioth/reference-design-modbus-vibration-monitor.git .
215+
west update
216+
west zephyr-export
217+
pip install -r deps/zephyr/scripts/requirements.txt
218+
```
219+
220+
### Build the firmware
221+
222+
Build the Zephyr firmware from the top-level workspace of your project.
223+
After a successful build you will see a new `build/` directory.
224+
225+
Note that this git repository was cloned into the `app` folder, so any
226+
changes you make to the application itself should be committed inside
227+
this repository. The `build` and `deps` directories in the root of the
228+
workspace are managed outside of this git repository by the `west`
229+
meta-tool.
230+
231+
Prior to building, update `CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION` in the
232+
`prj.conf` file to reflect the firmware version number you want to
233+
assign to this build.
234+
235+
> When running the commands below, make sure to replace the placeholder
236+
> `<your_zephyr_board_id>` with the actual Zephyr board from the table
237+
> above that matches your follow-along hardware.
238+
239+
``` text
240+
$ (.venv) west build -p -b <your_zephyr_board_id> app
241+
```
242+
243+
For example, to build firmware for the [Nordic nRF9160
244+
DK](https://www.nordicsemi.com/Products/Development-hardware/nrf9160-dk)-based
245+
follow-along hardware:
246+
247+
``` text
248+
$ (.venv) west build -p -b nrf9160dk_nrf9160_ns app
249+
```
250+
251+
### Flash the firmware
252+
253+
``` text
254+
$ (.venv) west flash
255+
```
256+
257+
### Provision the device
258+
259+
In order for the device to securely authenticate with the Golioth Cloud,
260+
we need to provision the device with a pre-shared key (PSK). This key
261+
will persist across reboots and only needs to be set once after the
262+
device firmware has been programmed. In addition, flashing new firmware
263+
images with `west flash` should not erase these stored settings unless
264+
the entire device flash is erased.
265+
266+
Configure the PSK-ID and PSK using the device UART shell and reboot the
267+
device:
268+
269+
``` text
270+
uart:~$ settings set golioth/psk-id <my-psk-id@my-project>
271+
uart:~$ settings set golioth/psk <my-psk>
272+
uart:~$ kernel reboot cold
273+
```
274+
275+
## External Libraries
276+
277+
The following code libraries are installed by default. If you are not
278+
using the custom hardware to which they apply, you can safely remove
279+
these repositories from `west.yml` and remove the includes/function
280+
calls from the C code.
281+
282+
- [golioth-zephyr-boards](https://github.com/golioth/golioth-zephyr-boards)
283+
includes the board definitions for the Golioth Aludel-Mini
284+
- [libostentus](https://github.com/golioth/libostentus) is a helper
285+
library for controlling the Ostentus ePaper faceplate
286+
- [zephyr-network-info](https://github.com/golioth/zephyr-network-info)
287+
is a helper library for querying, formatting, and returning network
288+
connection information via Zephyr log or Golioth RPC
289+
290+
## Pulling in updates from the Reference Design Template
291+
292+
This reference design was forked from the [Reference Design
293+
Template](https://github.com/golioth/reference-design-template) repo. We
294+
recommend the following workflow to pull in future changes:
295+
296+
- Setup
297+
- Create a `template` remote based on the Reference Design
298+
Template repository
299+
- Merge in template changes
300+
- Fetch template changes and tags
301+
- Merge template release tag into your `main` (or other branch)
302+
- Resolve merge conflicts (if any) and commit to your repository
303+
304+
<!-- end list -->
305+
306+
``` shell
307+
# Setup
308+
git remote add template https://github.com/golioth/reference-design-template.git
309+
git fetch template --tags
310+
311+
# Merge in template changes
312+
git fetch template --tags
313+
git checkout your_local_branch
314+
git merge template_v1.0.0
315+
316+
# Resolve merge conflicts if necessary
317+
git add resolved_files
318+
git commit
319+
```

0 commit comments

Comments
 (0)