-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMetaBase-README
150 lines (120 loc) · 6.44 KB
/
MetaBase-README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
MetaBase configures [MetaSensor](https://mbientlab.com/store/sensors/) boards to stream data to your MetaHub.
# Config File
The primary way to configure the application is with a JSON config file which is passed to the app via the ``--config`` options. Your config file must have at minimum the devices
and sensors defined.
```bash
sudo npm start -- --config metabase-config.json
```
## Commands
The first config option to set is the ``command`` key which controls what the app will do. You can choose from the following actions:
Action | Description
---------|------------------------------------------------------------------------------------
stream | Stream data realtime to the host device, also graphs the data live
log | Records data to the on-board flash memory, can download later with any MetaBase app
download | Retrieves the data from any board setup to record data with a MetaBase app
```json
{
"command": "stream"
}
```
## Devices
The ``devices`` key is an array that holds the mac addresses of the devices to use. The array elements can either be a MAC address string or an object containing both the MAC
address string and a user defined name identifying the device.
```json
{
"devices": [
"D4:5E:82:E1:15:01",
{"mac": "D5:7B:B9:7D:CE:0E", "name": "Demo Unit"}
]
}
```
In the above example, the ``D4:5E:82:E1:15:01`` mac address will have a default name assigned to it whereas the ``D5:7B:B9:7D:CE:0E`` will be referred to as "Demo Unit" in both
the UI window and MetaCloud
## Sensors
The ``sensors`` key is an object that the app uses the configure and enable the various on-board sensors. Its keys are the names of the enabled sensors and the values contain the sensor
configuration.
Each sensors have their own configurable parameters, detailed in the below table:
Name | Parameters | Example
--------------------|-----------------------------------|--------------------------------------------------
Accelerometer | ``odr``, ``range``, ``threshold`` | { "odr" : 100.0, "range": 2.0, "threshold": 2.0 }
Gyroscope | ``odr``, ``range`` | { "odr" : 25.0, "range": 250.0 }
Magnetometer | ``odr`` | { "odr" : 25.0 }
Quaternion | ``accRange``, ``gyroRange`` | { "accRange": 2.0, "gyroRange": 250.0 }
Euler Angles | ``accRange``, ``gyroRange`` | { "accRange": 4.0, "gyroRange": 500.0 }
Linear Acceleration | ``accRange``, ``gyroRange`` | { "accRange": 8.0, "gyroRange": 1000.0 }
Gravity | ``accRange``, ``gyroRange`` | { "accRange": 16.0, "gyroRange": 2000.0 }
Ambient Light | ``odr``, ``gain``, ``delta`` | { "odr": 10.0, gain: 4, "delta": 100000 }
Pressure | ``odr``, ``delta`` | { "odr": 1.96, "delta": 10.0 }
Temperature | ``period``, ``delta`` | { "period": 1800, "delta": 2.0 }
Humidity | ``period``, ``delta`` | { "period": 3600, "delta": 2.0 }
For example, to sample accelerometer (+/-4g @ 100Hz), gyro (+/-1000 deg/s @ 100Hz), and mag data (25Hz):
```json
{
"sensors": {
"Accelerometer": {"odr" : 100.0, "range": 4.0, "threshold": 2.0},
"Pressure": {"odr" : 0.99, "delta": 10.0}
}
}
```
For all sensors, the ``odr`` or ``period`` parameter must be set if applicable. The app will select default values for the other parameters if not set by the user, and in the case where invalid
values are selected, the closest valid value will be used instead.
In the v2.0 release, accelmerometer, ambient light, pressure, temperature, humidity data are post processed to reduce the amount of memory used by the on-board flash chip. The
accelerometer data is only recorded when the vector magnitude is above a value, set by the ``threshold`` option. The remaining processed data is logged when the measured values
exceeds an offset from an updating reference value, set by the ``delta`` option.
### Units
Sampling frequency values are expressed in ``Hz`` except for temperature and humidity which express them in ``seconds``. For example, the previous JSON snippet will set the
sensors to sample at 100.0Hz, 100.0Hz, and 25.0Hz respectively. However, the below JSON snippet will sample temperature and humidity at 30min and 1hr respectively (1800s / 3600s):
```json
{
"sensors": {
"Temperature": {"period" : 1800.0 },
"Humidity": {"period" : 3600.0 }
}
}
```
Note that the ``period`` key is used in lieu of ``odr``.
## Resolution
The ``resolution`` key is optional and sets the windows' width and height for the real time graphs. If not set, the application will automatically create windows 1/4th the
screen resolution.
```json
{
"resolution": {
"width": 960,
"height": 540
}
}
```
## Tx Power
Use the ``tx-power`` key to set the transmission power of the board. The valid values are: 4, 0, -4, -8, -12, -16, -20, -30.
```json
{
"tx-power": 4
}
```
# Command Line Options
All settings in the config file have equivalent command line options. The ``--devices`` and ``--sensors`` flags are require and can be repeated for multiple devices and sensors respectively.
All other flags are optional.
The table below maps JSON keys to their matching option:
| JSON Key | Command Line | Required
|------------|------------------------------|---------
| command | --command | N
| devices | --device | Y
| sensors | --sensor | Y
| resolution | --width, --height | N
| txPower | --tx-power | N
The JSON configuration from the previous section can equivalently expressed in the command line as follows:
```bash
sudo npm start -- --device D4:5E:82:E1:15:01 --device "D5:7B:B9:7D:CE:0E=Demo Unit" \
--sensor Accelerometer='{"odr" : 100.0, "range": 4.0}' \
--sensor Gyroscope='{"odr" : 100.0, "range": 1000.0}' \
--sensor Magnetometer='{"odr" : 25.0}' \
--width 960 --height 540 \
--command stream
```
## Disable RealTime Graph
By default, the app will create a window for each connected board and graph the data in real time, one graph per stream. The realtime graphs can consume a lot of resources
so users can disable it by passing in the ``--no-graph`` option in the command line.
```bash
sudo npm start -- --config metabase-config.json --no--graph
```
This graph is only available when streaming the data.