Connected Phone
ConnectivityThe RemoteSensor block is a hardware-in-the-loop (HIL) source that streams real-time 6-DOF inertial measurement unit (IMU) telemetry from a paired smartphone into the BlockWerk simulation canvas over a WebRTC peer-to-peer data channel.
Placing the block renders a QR code on the canvas. Scanning the code with a smartphone camera establishes a direct low-latency connection, streaming 3-axis linear acceleration (), 3-axis rotational orientation (degrees), and playout buffer health metrics directly into simulation blocks.
Mathematical Model
The paired mobile device streams 3-axis linear acceleration and 3-axis Euler orientation angles:
Signals are reconstructed continuously across solver steps with playout buffer latency s:
The buffer health output indicates instantaneous lookahead buffer depth:
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| ← Out | accelX |
Accel X | number | Output |
| ← Out | accelY |
Accel Y | number | Output |
| ← Out | accelZ |
Accel Z | number | Output |
| ← Out | gyroAlpha |
Rotation Alpha | number | Output |
| ← Out | gyroBeta |
Tilt Beta | number | Output |
| ← Out | gyroGamma |
Tilt Gamma | number | Output |
| ← Out | bufferLevel |
Buffer (ms) | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
playoutDelay |
Playout Delay (ms) | number | 250 |
|
interpolation |
Interpolation | select | linear |
How to reconstruct signal values between received sensor packets. Linear is the best default. PCHIP is smoother but heavier. |
outputLabels |
Output Labels | vector | accelX,accelY,accelZ,gyroAlpha,gyroBeta,gyroGamma,bufferLevel |
Usage Examples
Example 1: Hardware-in-the-Loop Inverted Pendulum Balancing
Mounting a smartphone to an inverted pendulum cart. The phone's live tilt angle (gyroBeta) is ingested by RemoteSensor and routed into a state-feedback LQR controller to balance the physical cart in real time.
Example 2: 6-DOF Inertial Motion Analysis and Vibration Logging
Measuring hand tremor or physical structural vibration by streaming 3-axis accelerations (accelX, accelY, accelZ) into uPlotDisplay and FFTScope blocks to compute spectral frequency peaks.
Remarks & Best Practices
- Peer-to-Peer WebRTC: Connects directly between smartphone and desktop browser using WebRTC DataChannels, eliminating cloud server latency after initial signaling.
- Dynamic Port Generation: Automatically reveals additional output ports when connected phones report magnetometer, barometer, or GPS hardware.
- Buffer Health Monitoring: The
bufferLeveloutput provides a continuous readout of buffer health in milliseconds to detect wireless link degradation. - Raw Telemetry CSV Export: Clicking the record button on the block face captures raw packet telemetry (timestamps, jitter, all axes) and exports the data to CSV.
Related Components
- PhoneController: Mobile controller featuring touch/tilt joystick and yaw slider.
- MQTTSubscriber: Ingests sensor telemetry over an MQTT network broker.
- Gimbal3D: Real-time 3D flight attitude visualizer.
- uPlotDisplay: Multi-channel oscilloscope for live waveform display.