uThing::iPH Configuration¶
The uThing::iPH device can be configured through its serial interface using two distinct modes: Interactive and JSON.
Configuration Modes¶
Interactive Mode
The interactive mode is designed for simplicity and ease of use directly from a serial terminal. All commands are a single character followed by the Enter key.
For example, to send the S (Status) command via a Linux/macOS terminal, you would use:
$ printf 'S\n' > /dev/ttyACM0
JSON Mode
The JSON mode is intended for programmatic control. Commands are sent as a valid JSON object string. You can combine multiple commands into a single JSON object.
For example, to enable the LED, set the reporting period to 30 seconds, and change the format to CSV all at once, you would send:
{"led":true,"reportingPeriod":30,"format":"CSV"}
Note
For both modes, the device returns a status report after every command to confirm that it was received and processed correctly.
Commands¶
Below are the available commands to configure the uThing::iPH.
Reporting Format¶
This command changes the format of the periodic data output.
| Command | Format |
|---|---|
J |
JSON |
C |
CSV |
M |
Human-Readable |
| Command | Format |
|---|---|
{"format":"json"} |
JSON |
{"format":"csv"} |
CSV |
{"format":"human"} |
Human-Readable |
Reporting Period¶
This command changes how often the device sends a data report.
| Command | Reporting Period |
|---|---|
1 |
1 second (default) |
2 |
10 seconds |
3 |
30 seconds |
4 |
1 minute |
5 |
10 minutes |
6 |
30 minutes |
7 |
1 hour |
| Command | Reporting Period |
|---|---|
{"reportingPeriod":<seconds>} |
An integer from 1 to 3600. |
LEDs¶
This command enables or disables the onboard status LEDs.
| Command | State |
|---|---|
E |
Enabled |
D |
Disabled |
| Command | State |
|---|---|
{"led":true} |
Enabled |
{"led":false} |
Disabled |
Calibrate¶
This command initiates the interactive two-point calibration procedure. For a detailed guide, see the Calibration page. This command is only available in Interactive mode.
| Command | Action |
|---|---|
K |
Start calibration procedure |
Save Configuration¶
This command saves the current settings to the device's permanent flash memory. The saved configuration will be retained after the device is unplugged and reconnected. This command is only available in JSON mode.
| Command | Detail |
|---|---|
{"saveConfig":true} |
Stores the current configuration in Flash memory. |
Status¶
This command retrieves the device's current configuration and status.
| Command | Detail |
|---|---|
S |
Retrieves device info, configuration, calibration parameters, and uptime. |
Example Response:
--------------------------------------------------------
*** Device: "uThing::iPH rev.A" -- Status:
Reporing period: 1 sec, Format: CSV, Uptime: 370283 ms, Serial #: 7F8D2D3F608B7E54, FW: v0.1.0, Calibration: Slope 1.00, Offset 0.02
--------------------------------------------------------
| Command | Detail |
|---|---|
{"status":true} |
Retrieves the current configuration, calibration, and uptime. |
Example Response:
{
"status": {
"reportingPeriod": 1,
"format": "JSON",
"slopeCalib": 1.01,
"offsetCalib": 0.02,
"upTime": 1802065
}
}
Device Info¶
This command retrieves static information about the device hardware, firmware, and serial number. This command is only available in JSON mode.
Interactive Mode
In Interactive mode, this information is already included in the Status command (S).
| Command | Detail |
|---|---|
{"info":true} |
Retrieves device hardware, firmware, and serial number. |
Example Response:
{
"info": {
"device": "uThing::iPH rev.A",
"serial": "7F8D2D3F608B7E54",
"firmware": "1.0.0"
}
}
Help & Commands Summary¶
Invalid Command Response¶
In interactive mode, sending an invalid character (e.g., h) will print a help message summarizing the available commands.
-------------------------------------------------------
*** Invalid option.
Use: [m] Human readable, [j] JSON, [c] CSV, [s] status, [e/d] enable/disable LED, [k] Start calibration
Reporting period: [1] 1 sec, [2] 10 sec, [3] 30 sec, [4] 1 min, [5] 10 min, [6] 30 min, [7] 1 hour.
--------------------------------------------------------
Commands Summary Table¶
The table below summarizes the commands available in firmware v1.0.0.
| Command | Interactive | JSON | Description |
|---|---|---|---|
| Format | J, C, M |
{"format":"<string>"} |
Change reporting format (JSON, CSV, HUMAN) |
| Period | 1-7 |
{"reportingPeriod":<integer>} |
Change reporting period |
| LEDs | E, D |
{"led":<boolean>} |
Enable / Disable LEDs |
| Calibrate | K |
n/a | Start calibration procedure |
| Save Config | n/a | {"saveConfig":true} |
Save configuration parameters to flash |
| Status | S |
{"status":true} |
Show current configuration and uptime |
| Device Info | (S) |
{"info":true} |
Show device hardware, firmware, and serial |
```