Network Initialization
The Ethernet interface uses network.WIZNET5K over SPI(2).
Signal |
Pin |
|---|---|
CS |
|
Reset |
|
Power / enable |
|
Network mode is selected by DHCP in config.py. The application attempts
DHCP when it is enabled and falls back to its static configuration if DHCP
fails.
Field |
Default static value |
|---|---|
IP address |
|
Subnet mask |
|
Gateway |
|
DNS |
|
The HTTP server listens on port 80. A WebSocket server for live telemetry
listens on port 8080.
Page Routes
Method |
Path |
Description |
|---|---|---|
|
|
Home page. |
|
|
Network configuration page. |
|
|
Digital I/O control page. |
|
|
Analog-input page. |
|
|
Serial page, when UART is enabled. |
|
|
EEPROM storage page. |
|
|
Load-cell monitoring page. |
|
|
K-type thermocouple monitoring page. |
JavaScript, CSS, and image assets are served from /js/, /css/, and /img/.
Network Configuration API
Read the active configuration
GET /netconfig/config
Example response:
{
"ip_addr": "192.168.1.2",
"subnet_mask": "255.255.255.0",
"default_gateway": "192.168.1.1",
"dns": "192.168.1.1",
"dhcp": true
}
Change the configuration
POST /netconfig/config
Content-Type: application/json
Use DHCP:
{"dhcp": true}
Use a static address:
{
"dhcp": false,
"ip": "192.168.1.2",
"subnet_mask": "255.255.255.0",
"default_gateway": "192.168.1.1",
"dns": "192.168.1.1"
}
The server validates static IPv4 values, then applies the change after sending
the response. A successful static request returns {"redirect": true}; the
browser can open the new address. For DHCP, use the address printed in the
REPL after reconnection.
Digital I/O API
The application supports two digital inputs, IN1 and IN2, and two relay
outputs, RY1 and RY2.
Set a relay
POST /io
Content-Type: application/json
{"pin": "RY1", "value": 1}
The response contains the output state:
{"value": 1}
Read all digital states
GET /io/state
{
"output": [["RY1", 1], ["RY2", 0]],
"input": [["IN1", 0], ["IN2", 1]]
}
Read inputs only
GET /din
{"IN1": 0, "IN2": 1}
Analog Input API
The supplied application has two analog inputs, AI0 and AI1. Both are
current-mode inputs and return values in milliamperes.
GET /analog_io/state
Example response:
{
"AI0": {"value": 12.3, "mode": 1},
"AI1": {"value": 11.8, "mode": 1}
}
mode: 1 means current mode; mode: 0 means voltage mode. The supplied
WIZio-SEN configuration does not expose analog outputs.
Serial API
These endpoints are available only when UART is enabled in config.py.
POST /serial
Content-Type: application/json
{"message": "Hello from the browser\r\n"}
The successful response is the plain-text message Received.. To collect data
received from the UART, use:
GET /serial/recv
{"message": "Reply from the serial device"}
When CAN is selected instead of UART, the serial route returns the server’s error response and the page is hidden from the home screen.
EEPROM Storage API
POST /storage/write
The request body is written as UTF-8 text at EEPROM offset 0. The response
is plain text: Success. or Failed.
GET /storage/read
Returns up to 1000 bytes of data beginning at EEPROM offset 0.
Live Sensor Monitoring
The load-cell and thermocouple pages receive live readings through a WebSocket
connection at ws://<board-ip>:8080.
Serial Monitoring
When UART is enabled, the server forwards received serial data to connected
WebSocket clients. This lets the Serial Test page display incoming messages
without repeatedly requesting /serial/recv.
Example message:
{"type": 3, "message": "Reply from the serial device"}
The message value contains the UTF-8 text received from the UART. No message
is broadcast until serial data is available.
Weight Detection
The Load Cell Sensor page receives weight readings in kilograms. The page can also display the same value in grams.
Example message:
{"type": 4, "weight": 2.34}
The weight value is calculated from the load-cell input using
LOADCELL_CAPACITY_KG and LOADCELL_RATED_OUTPUT in config.py. Set these
values to match the connected load cell.
Temperature Monitoring
The Thermocouple Temperature page receives readings from the two K-type
channels, K1 and K2, in degrees Celsius.
Example message:
{"type": 5, "temperature": [23.4, 24.1]}
The first value is K1 and the second is K2. A message is sent after both
channels have a valid reading within the configured temperature range.