Sensor HMI
A dashboard that reads the sensors of an Android phone and plots them live in the browser. The phone runs a small WebSocket server; this page reads the stream. No install on the computer, no account, and no server of mine in the middle.
Open the dashboard Save a copy
With no address typed in, the dashboard runs on simulated data and labels it DEMO in the header. Type the phone address on page 04 LINK and press Connect to switch to the real stream.
Page 01, Motion. Three vector channels, each with X, Y, Z, a magnitude, and a 10-second trace. The header carries the link state, the message rate, and the target.
Connect a phone
Both devices must be on the same Wi-Fi network. A guest network will not work if it blocks clients from each other.
- Install SensorServer by Umer Farooq on the phone. It is free and open source under GPL-3.0. Get it from F-Droid or from GitHub releases. Android 6.0 or newer is required.
-
Open the app and tap Start. The app starts its WebSocket server and prints
its address, for example
192.168.1.7:8080. Keep the port. -
Optional: open the app drawer and turn on Test in a Web Browser. The
app then also serves a page on port
9090athttp://192.168.1.7:9090. Open that address in a browser on the computer. If the sensor list appears, the network path works. This dashboard does not read that page: browsers block it across origins, so only the WebSocket stream is used. - Open the dashboard, go to page 04 LINK, type the address in Host, set the WebSocket port, and press Connect. The header turns from DEMO to STREAMING.
-
To share a prepared link, put the target in the URL:
?host=192.168.1.7&port=8080. The page then connects on load.
The five pages
- 01 Motion accelerometer, gyroscope, and magnetometer, with a vector magnitude and a 10-second trace per axis.
- 02 Attitude the rotation vector decoded to roll, pitch, and yaw, a wireframe of the phone body, gravity, linear acceleration, the step count, and the tilt state.
- 03 Environment ambient light, proximity, barometric pressure with a 60-second window, and the three device temperatures.
- 04 Link the host form, a table of channels with rate and last interval, the raw JSON of the last message, and the event log.
- 05 Axes a three.js model of the phone with the Android device axes attached. The model follows the rotation vector, so X, Y, and Z stay fixed to the device while it turns: X points right, Y points up, and Z points out of the screen. Drag to orbit and use the wheel to zoom. The view starts with the phone upright and facing you.
Page 02, Attitude. The quaternion from
android.sensor.rotation_vector drives both the angle readout
and the wireframe.
What the wire looks like
One WebSocket per sensor. The URL is
ws://HOST:PORT/sensor/connect?type=TYPE, and each message is one
JSON object:
{
"values": [-0.52890337, 1.4911026, 0.22983061],
"timestamp": 95529311677817,
"accuracy": 3
}
values holds one, three, or five numbers depending on the sensor.
A rotation vector sends a quaternion plus a heading. timestamp is
nanoseconds since the phone booted, so the page uses it for sample intervals
only, never as a clock. accuracy runs from 0 to 3.
Limits worth knowing
-
Chrome and Edge open a plain
ws://socket from an HTTPS page and print a console warning, so it still works there. Firefox and Safari refuse; in that case save the page and open the file from disk, or serve it over plainhttp://. The dashboard detects a failed socket and shows a notice with a download link. -
If the link stays silent in Chrome, the phone is the usual cause. Android
pauses the server when the screen locks: the socket then accepts the
connection and never answers, and the dashboard falls back to simulated
data. The event log on page 04 prints
TIMEOUTfor that case andCONNECTION REFUSEDwhen the port is closed. - The address changes when the phone reconnects to the network, and the WebSocket port can change each time the server starts. Read the app screen again after a restart.
- The page keeps the last 600 samples per channel and drops the oldest. The chart is a monitor, not a logger: nothing is stored and nothing is uploaded.
Credit
Sensor data comes from SensorServer by Umer Farooq, GPL-3.0, versions 6.4.0 to 7.2.1. The dashboard itself is one HTML file: no framework, no build step, and no network request except the sensor stream.