Use ESP32 sensors from Linux and ROS 2

Read a XIAO camera and microphone as Linux devices, replay a thermal recording, or subscribe to live temperatures in ROS 2.

Guided walkthrough·Intermediate·5 min read
Requirements and learning goals

Before you start

  • For replay: Git, Python 3.9 or newer, and a browser
  • For live hardware: an enrolled WendyOS Linux receiver, the Wendy CLI, and a container builder. Use a XIAO ESP32-S3 Sense for video and sound, or a scalar Celsius source and a ROS 2-capable receiver for temperature.
  • The receiver can reach the source. Both belong to the same organization and your signed-in account can pair the source and deploy apps on the receiver.

You will be able to

  • Scrub a saved temperature recording across its trigger
  • Read a remote XIAO camera through V4L2 and its microphone through ALSA
  • Read three fresh temperature messages from a paired source in ROS 2 domain 42

A paired XIAO ESP32-S3 Sense gives a Linux app a camera it can open and a microphone it can record from. A temperature board supplies a different kind of channel, which Wendy can publish to . If you have the XIAO and a receiver, go straight to Use the XIAO camera and microphone. With only a laptop, try the recording below.

Replay a recorded moment

Get the Thermal Wall example and start its replay viewer on your computer. It uses Python's standard library.

git clone --depth 1 --sparse https://github.com/wendylabsinc/wendyos.git sensorlink-workshop
cd sensorlink-workshop
git sparse-checkout set Examples/ThermalWall
cd Examples/ThermalWall
THERMAL_WALL_SOURCE=none THERMAL_WALL_EPISODES_DIR=tests/fixtures PORT=18090 python3 app.py

Open the local viewer. In Moments, choose the recording that includes about three seconds before the trigger. Drag the timeline through zero and watch the middle thermal tile, marked TRIGGER. The other two tiles show readings from the same time. The fixtures contain synthetic thermal grids recorded by the agent on a development machine. You can finish this part with any laptop, including one connected only to a XIAO camera.

Press Ctrl+C to stop the viewer. Keep the example directory if you want to try live temperature readings.

Use the XIAO camera and microphone

Attach the Sense expansion board and use its . The board and receiver must be reachable from each other and enrolled in the same organization. In this exercise, every Wendy command runs against the Linux receiver. Choose it by name whenever the CLI asks for a device. You will choose the XIAO in the receiver's SensorLink tab.

wendy device pair

Press Tab to reach SensorLink. Highlight the XIAO and press Enter to pair it. If it is already paired, leave the pairing in place. Press r to refresh until Connected shows yes, then q to quit.

Open the camera viewer. Choose the XIAO camera by its pairing name if several cameras appear. Cover and uncover its lens. Watch the picture darken and brighten, then exit with Ctrl+C.

wendy device camera view

Now open the audio picker. Highlight the Input row whose Description starts with sensor-link: and includes your XIAO's pairing name. Press l (lowercase L) to listen through your computer. Clap near the XIAO and listen for the clap, then press q to quit. The Name on that row is the ALSA address you can use in your own app.

wendy device audio

Open both devices in a Linux app

Run wendy device camera list and look in the XIAO camera's Where column for its V4L2 path. The receiver uses v4l2loopback to expose paired cameras at /dev/video96 through /dev/video127. The camera makes that path available inside the app. The audio entitlement exposes /dev/snd. Even on PipeWire receivers the paired microphone uses ALSA's snd-aloop capture endpoint, plughw:<card>,1,<subdevice>. Use its Name from the audio picker. PipeWire's generic Loopback Analog Stereo reads a different endpoint.

On your computer, create a small app that reads ten frames with v4l2-ctl and records five seconds of mono audio with arecord. Replace the two example addresses with those from your receiver.

VIDEO=/dev/video96
MIC=plughw:1,1,0
PROBE=$(mktemp -d)
cat > "$PROBE/wendy.json" <<'JSON'
{
  "appId": "sh.wendy.learn.sensorlink-media",
  "version": "0.1.0",
  "platform": "linux",
  "entitlements": [{"type": "camera"}, {"type": "audio"}]
}
JSON
cat > "$PROBE/Dockerfile" <<'DOCKER'
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends v4l-utils alsa-utils
CMD v4l2-ctl -d "$VIDEO" --stream-mmap --stream-count=10 --stream-to=/tmp/frames.bin && \
    wc -c /tmp/frames.bin && echo "Clap near the XIAO now" && \
    arecord -D "$MIC" -f S16_LE -r 16000 -c 1 -d 5 -V mono /tmp/mic.wav
DOCKER
wendy run --prefix "$PROBE" --env "VIDEO=$VIDEO" --env "MIC=$MIC" --no-restart

Look for a nonzero camera byte count in the app log. Clap when prompted and check that the recording meter responds. The app exits after five seconds of audio. If this is your only board, you can finish here.

Pair a source with a temperature channel

For this exercise the source must advertise chip-temperature with schema wendy.temperature.celsius.f32le.v1. For example, a development build with CONFIG_WENDY_NET_TEST_SENSOR_SERVICE reads the ESP32's internal temperature. The stock XIAO camera firmware supplies only video and audio. Wendy Lite chip-temperature probe

This command opens the receiver's SensorLink tab and gives the pairing a name you can recognize in ROS 2. Choose your Linux receiver, highlight the temperature board, and press Enter.

wendy device pair --name bench

Press r to refresh. When Connected says yes for bench, press q. If the board was already paired, use its existing pairing name in the topic below. Hyphens in names become underscores.

Subscribe and check the expected result

From sensorlink-workshop/Examples/ThermalWall in the replay exercise, deploy Thermal Wall to the receiver.

wendy run --detach
wendy device ros2 topics --domain 42

The example's wendy.json declares ROS 2 Humble, domain 42 and the sensor-read entitlement. Give the bridge about 20 seconds to find the running app, then list the topics again. Look for /sensorlink/bench/chip_temperature with type sensor_msgs/msg/Temperature. Read three samples:

wendy device ros2 echo /sensorlink/bench/chip_temperature --domain 42 --count 3

Expect three messages with a Celsius temperature and advancing header.stamp values. A stable board can report the same temperature in successive samples. To see the live tile, open port 18090 on the receiver's reachable address. Look for bench · chip_temperature in the Live view.

Troubleshooting

  • The XIAO is paired but a media device is missing. The receiver needs compatible v4l2loopback 0.15.x for video and snd-aloop for sound. Run wendy device logs --service wendy-agent on the receiver to see which channels it skipped.
  • Pairing succeeds but no topic appears. Check that the source advertises chip-temperature and the pairing includes it. Thermal Wall uses the host network. Every ROS 2 app sharing that network needs sensor-read for the agent to publish paired sensors there.
  • The topic exists but echo waits. Echo waits for new samples. Check that the pairing is still connected and the source is producing temperature readings. Use Ctrl+C to stop waiting.

When finished, run wendy device apps stop sh.wendy.examples.thermalwall and choose the receiver. SensorLink pairing and ROS 2 channels

Can you do each of these?

  • Scrub a saved temperature recording across its trigger
  • Read a remote XIAO camera through V4L2 and its microphone through ALSA
  • Read three fresh temperature messages from a paired source in ROS 2 domain 42
Previous: Find your ESP32 on Wendy Net
All lessons in this topic
  1. 1. Install Wendy Lite on your ESP32
  2. 2. Update an ESP32 app over Wi-Fi
  3. 3. Find your ESP32 on Wendy Net
  4. 4. Use ESP32 sensors from Linux and ROS 2
  5. 5. Run your first ESP32 app
  6. 6. Read a button, sample voltage, and drive PWM
  7. 7. Connect ESP32 sensors with I²C, SPI, and UART
  8. 8. Handle ESP32 interrupts and detect stalled work
  9. 9. Build an ESP32 alarm that tolerates noisy readings

Ask Wendy

Answers about Wendy and WendyOS

What would you like to know?

Ask about devices, development, and deployment.

Check linked docs for technical details.