Saltar al contenido
Social robotic creatures

How Cámara feels touch

Cámara feels when its hair, its side or its underside is touched, and reacts differently to each: it nods with a contented “mmmm”, giggles from the tickle or purrs. Without a single wire to the Pi.

Cámara is a robotic creature built on a commercial PTZ camera and a Raspberry Pi 5. It already sees and hears; now it also feels when it is touched. It has three sensitive zones —its hair, one side and its underside— and each one triggers a different reaction.

The hard part is not detecting a finger, it is where the sensor lives: it is mounted on the part that pans and tilts, and the camera keeps turning. A wire from there to the Pi got tangled with the movement. That is why touch is a separate node, battery-powered and over Bluetooth.

Feel

Copper tape and hair with conductive steel threads: the body becomes a sensor.

Report

A battery node that reports over Bluetooth Low Energy (BLE), with no wire to the Pi.

React

Each zone has its own gesture and sound, for as long as the touch lasts.

Feel: a finger changes the charge

Cámara's touch is capacitive, like a phone screen. Each sensitive zone is a piece of metal —an electrode— wired to a chip that measures how much electric charge it can hold. The human body conducts, so when a finger comes close the electrode effectively “grows” and the reading rises. No pressing needed: a brush is enough.

The chip is an MPR121, which reads 12 electrodes at once and reports which ones are touched. The electrodes come in two kinds:

The copper lines are strips of adhesive copper tape stuck on the side and on the underside. They are cheap, cut with scissors and go wherever you want skin. Each strip has its own wire to an MPR121 pin.

The hair is a plastic tuft of the kind used to decorate motorcycle helmets, with conductive steel threads woven through it. The plastic gives it shape and movement; the steel is what feels. That way Cámara reacts to a stroke of its hair, not just to a tap on a surface. The steel threads are joined with clips to the copper wire that runs to the MPR121: steel cannot be soldered with tin, and a clip makes the joint without solder. The hair uses only 2 electrodes, one at the front and one at the back, each tied to 10 threads: with more electrodes, the threads of one would end up brushing against another's and a touch would land in the wrong zone.

Wiring diagram with the boards drawn (blue CJMCU MPR121 and XIAO ESP32-C3): side on E0–E3, hair on E4–E5 and underside on E8–E11 of the MPR121; the MPR121 connects to the XIAO ESP32-C3 through 3V3, GND, SDA to D4, SCL to D5 and IRQ to D2, with ADD to GND; the LiPo goes to BAT+ and BAT−, with a 330 kΩ / 100 kΩ divider to D1; the XIAO reports over Bluetooth Low Energy (BLE) to the Raspberry Pi 5
Everything inside the dashed line sits on the tilt and turns with the camera. The only thing that reaches the Pi is the radio.
The three zones and their electrodes
zonematerialelectrodesconnection
sidecopper tapeE0–E3wire
hairsteel threads in plastic hairE4–E5clips to a copper wire
undersidecopper tapeE8–E11wire

The zones were mapped by touching each one separately: a hand activates several neighboring electrodes at once, never just one. That is why Cámara reacts to a zone, not to a single electrode.

Each electrode has its own noise, which depends on the wire length and on what is nearby. So at power-on the node spends 3 seconds measuring each one with nobody touching it, and sets its threshold at twice the measured noise (between 12 and 200). To call it released it asks for half that. If someone touches it during that window, the touch counts as noise and that zone ends up less sensitive.

12MPR121 electrodes. 10 are in use today, in three zones.
3 sCalibration at power-on. Measures each electrode's noise at rest.
2×Threshold = twice the noise. Each electrode with its own.
Takeaway

Any conductor can be skin

With a capacitive sensor, the shape is a design choice: a tape, a thread inside hair. Conducting is enough, but the joint to the wire needs thought: steel conducts but does not take tin solder, which is why it goes on clips.

Takeaway

Measure the threshold in place

An electrode's noise depends on where it is mounted. Calibrating at every power-on, fully assembled, is more reliable than a fixed number from the datasheet.

Report: wireless because the wire got tangled

The first idea was obvious: a wire from the MPR121 to the Raspberry Pi. But the sensor sits on top, on the part that tilts, and that part also pans. With every turn the wire wound itself around the camera. The fix was to remove the wire: touch is its own node, with its own battery and radio.

The touch node's parts
partwhat it does
Seeed XIAO ESP32-C3Microcontroller with Bluetooth Low Energy. Reads the MPR121, reports to the Pi and also charges the LiPo.
MPR12112-electrode capacitive sensor, connected over I2C (address 0x5A).
LiPo 822540, 600 mAhThe battery. Charges through the XIAO's USB.
330 kΩ / 100 kΩ dividerLets the XIAO measure the battery voltage.
Copper tape and hair with conductive steel threadsThe electrodes.

The node does not keep asking the MPR121 whether it is being touched. The MPR121 has an alert line, the IRQ, that only goes low when something changes: a new touch or a finger leaving. Only then does the XIAO read the 12 electrodes —they fit in 2 bytes, one bit per electrode— and send that to the Pi over Bluetooth.

On the Pi, a separate thread listens to the node (with the bleak library) and records each touch with its arrival time. That way a 30 ms touch that starts and ends between two turns of the main loop is not lost. To save energy, the chip sleeps between events and runs its clock at 40 to 80 MHz. The battery is measured every 30 seconds but not transmitted: the Pi reads it on connect, and the node only speaks up when it is running low or has finished charging.

Cámara stays alive without the node. If it is off, out of battery or out of range, the robot keeps seeing and hearing, and says so in its log: after 60 s without a link it warns; with the battery below 15 %, too. A sensor that goes silent without warning is indistinguishable from “nobody is touching it”.

2 bytesWhat travels per touch. One bit per electrode.
15–30 msBluetooth connection interval the node asks for.
2–5 díasEstimated battery life, roughly: the chip sleeps between events, but Bluetooth wakes it every 15–30 ms and the main crystal stays on. On the order of 5–10 mA. Still to be measured.
Takeaway

What rotates does not get wired

A sensor on a rotating part calls for a radio and a battery, or a slip ring. For little data, the radio is simpler.

Takeaway

Report changes, not states

Sending only when something changes saves radio and battery. The cost is paid on the other side: the receiver has to remember the last state.

React: each zone, its own response

Cámara does not have one reaction to touch: it has one per zone. Each zone is an impulse, a rule that says “if this happens, do that”. To avoid reacting to an accidental brush, the touch has to last at least 0.3 s. And while it is still being touched, the reaction repeats: a long stroke gets a long response.

What Cámara does depending on where it is touched
zonemovementsound
haira soft, wavy noda contented “mmmm”
sidea short head shakea ticklish giggle
undersidea purr on both axes at oncepurr

Movement and sound are two different bodies: the camera's motors and a speaker. Each has its own turn, so they can happen together —Cámara moves and purrs at the same time— without fighting over the same resource.

The purr goes through the speaker because the motors' purr is barely audible: the vertical axis hums at 150 Hz, only 8 to 11 dB above the room noise. The speaker's purr is a train of short pulses, about 24 per second, which the ear cannot separate and hears as a texture. The pitch sits around 182 Hz and changes a little each time, because repeating exactly the same sound reads as a recording on loop. The other two sounds are also synthesized and also change each time: the “mmmm” is a vowel with almost no high harmonics, which sounds like a closed mouth, and the giggle is a train of 7 to 9 short syllables that drop in pitch, like a laugh running out of air.

0.3 sMinimum touch to react. Filters out brushes.
~24/sPurr pulses. A real cat purrs at around 25 Hz.
+8–11 dBMotor hum above the room: that is why the purr uses the speaker.

An honest limit: if Cámara is following someone or in the middle of another gesture, it does not let go of the motors, and the touch is lost.

Takeaway

Zones, not electrodes

A real hand never touches a single point. Grouping sensors by body zone makes the reaction stable and easy to understand.

Takeaway

Each output, its own turn

Treating movement and sound as independent resources lets a creature do two things at once without an arbiter blocking them.

Problems we ran into

A resting finger looked like an old touch

The node reports changes: “touched” and “released”. But each impulse requires the data to be fresh, less than 1 s old, so it does not react to something that already happened. With a finger resting for 10 seconds, the last report was 10 seconds old, and Cámara treated it as stale exactly while it was being touched.

The fix: while the Bluetooth link is up, the Pi re-records the last touch state on every turn, with the current time. If the link drops, it stops: the age grows and Cámara stops believing it is being touched, which is the truth —it no longer knows.

Takeaway

“No change” is not “no data”

A change-driven sensor needs someone to know whether the link is still alive; otherwise, the absence of reports means two opposite things.

Takeaway

A datum's age is a datum

Storing when something was learned, not just what, lets the robot stop believing what it can no longer confirm.

How we tested it

The node is tested on its own, without the robot, from the Pi or from any computer with Bluetooth: a script of about 30 s connects and shows each touch per electrode and the battery. The zones came out of that same test, touching each part of the body separately.

The tests
testtoolstimuluswhat it measures
Node aloneble_check.pytouching each electrodelink, touch mask, battery
Zone mapble_check.pya hand on each zone, one at a timewhich electrodes fire together
Batterymultimeteractual LiPo voltagedivider correction (3.90 → 4.00 V)
Per-electrode noisefirmware, at power-on3 s untouchedeach electrode's threshold

What carries over to other robots

Cámara's touch is small, but it leaves rules that work on any creature.

1

Map by touching, not by drawing

Which electrode belongs to which zone is found with a real hand on the assembled body, not on the drawing.

2

Test each piece separately

A node that can be tested without the robot isolates failures: if the script sees the touch and the robot does not react, the problem is in the robot.

3

An optional sensor must announce when it is missing

A robot that keeps working without a part is good; one that does so silently hides the failure.