Charter 08 · sense · available project

Motion Laboratory

Sensor Fusion Challenge

Let three motion witnesses disagree, then build a rule worthy of their combined confidence.

Difficulty
★★☆
Prefix
mb
Zone
workshop
Type
motion-node
Device
mb-01
Build time
8 hours

Mission

Build this

Build a small courtroom for PIR, tilt, and GY-6500 evidence, with a display for raw clues and a gesture for the combined verdict.

One kit, one team repository.

Borrowed parts are labelled below and have a fallback. The registered device ID is fixed; sensing and behaviour decisions remain yours.

Bill of materials

Parts

SourcePartFallback
● kitPIR sensor—
● kitTilt switch—
● kitGY-6500 module—
● kitOLED—
● kitSG90 servo—

Disconnect USB before rewiring. Motors, the relay, and the servo need appropriate power and a shared ground. Never drive an actuator from the ESP32 3V3 pin.

Your invitation

Three witnesses watch the same movement and tell different stories

One notices a warm body crossing its view. One notices that the device tipped. One feels acceleration and rotation in its own frame. Ask “did something move?” and all three may answer differently—without any of them being broken.

Your laboratory will stage repeatable motions, record who noticed, and invent a fair rule for combining their testimony.

PIR

Notices changing patterns of warm infrared light.

Tilt switch

Notices a change in orientation or a physical knock.

GY-6500

Notices acceleration and rotation of the device itself.

The central idea

A sensor does not detect “motion.” It detects its own clue.

A person walking past can trigger the PIR while leaving the table perfectly still. A tap can wake the tilt switch and motion module while the PIR sees no warm body crossing. A slow tilt may change orientation without creating a sharp acceleration.

Person walks past

PIR: likely · tilt: no · module: no

Table is bumped

PIR: maybe · tilt: likely · module: likely

Warm room stays still

PIR: should not · tilt: no · module: no

Device turns slowly

PIR: maybe · tilt: likely · module: likely

Predictions, not answers. Your trials decide what “likely” means for your setup.

What does “sensor fusion” mean without the buzzword?

It means using more than one clue to make one decision. An OR rule believes any witness and catches more events, but also accepts more false alarms. AnAND rule demands agreement and is cautious, but misses motions only one sensor can see.

You can also give each scene its own rule: PIR alone may mean “someone crossed nearby,” while tilt plus GY-6500 may mean “the device was disturbed.”

Design the courtroom

Define the event before judging the sensor

“Motion happened” is too vague for a fair test. Mark where the person walks, how the table is tapped, how far the sensor sits, and when each trial begins and ends.

RealityDevice saysName
motionmotioncaught it
stillstillleft it alone
stillmotionfalse alarm
motionstillmissed event

This four-box record is a confusion table. Its purpose is not to confuse you. It stops one impressive success from hiding five quiet failures.

Wiring

Introduce the witnesses one at a time

Read the PIR first, then the tilt switch, then the GY-6500. Let the OLED show each raw witness before your combined rule replaces them with one verdict.

The power rule: The GY-6500 and OLED use 3V3. The common PIR module uses 5 V but returns 3.3 V logic. The servo uses a separate 5 V supply. Join all grounds.

Bench referenceOpen the exact wiring map
WiringThree motion witnesses, display, and agreement gesture
ESP325V / VINPIR sensorVCCGPIO 27PIR sensorOUTGNDPIR sensorGNDGPIO 32Tilt switchone legGNDTilt switchother leg3V3GY-6500VCCGNDGY-6500GNDGPIO 21GY-6500SDAGPIO 22GY-6500SCL3V3OLED (SSD1306)VCCGNDOLED (SSD1306)GNDGPIO 21OLED (SSD1306)SDAGPIO 22OLED (SSD1306)SCLGPIO 18SG90 servosignal (orange)external 5 VSG90 servopower (red)GNDSG90 servoground (brown)
ESP32 pinPartPart markingCarries
5V / VINPIR sensorVCC5V power — common HC-SR501 module supply
GPIO 27PIR sensorOUTDigital in/out — module output is 3.3 V logic
GNDPIR sensorGNDGround
GPIO 32Tilt switchone legDigital in/out — configure INPUT_PULLUP
GNDTilt switchother legGround
3V3GY-6500VCC3V3 power — safe supply for the sensor module
GNDGY-6500GNDGround
GPIO 21GY-6500SDAI²C bus — shares the display data bus
GPIO 22GY-6500SCLI²C bus — shares the display clock bus
3V3OLED (SSD1306)VCC3V3 power
GNDOLED (SSD1306)GNDGround
GPIO 21OLED (SSD1306)SDAI²C bus
GPIO 22OLED (SSD1306)SCLI²C bus
GPIO 18SG90 servosignal (orange)PWM to actuator — shows the agreement state
external 5 VSG90 servopower (red)5V power — separate supply
GNDSG90 servoground (brown)Ground — join servo and ESP32 grounds

Confirm the exact labels on your PIR and GY-6500 boards before powering them. Never send 5 V into an ESP32 GPIO, and never power the servo from 3V3.

  • 5V power
  • Digital in/out
  • Ground
  • 3V3 power
  • I²C bus
  • PWM to actuator

The GY-6500 and OLED share GPIO 21 and 22 because I²C devices have different addresses. Test each alone before combining the bus.

Give agreement a body

One clue should not look like three clues

0Resting

No witness currently reports its clue.

1Curious

One witness noticed something. Hold judgement.

2+Convinced

Several clues agree—or your scene-specific rule is satisfied.

Your team decides:

  • Which sensor combinations deserve different names?
  • How close in time must two clues arrive to count as agreement?
  • Does the servo show confidence, motion type, or a short reaction?

Your trial programme

Rehearse both movement and stillness

  1. Write four scenes.

    Include at least two motions and two no-motion conditions that could fool a sensor.

  2. Predict the witnesses.

    Write which sensors you expect before running the trial.

  3. Run twenty repetitions per scene.

    Keep placement and timing fixed. Record every witness, delay, and final verdict.

  4. Tune once, then stop.

    Use one run to design the rule and a fresh run to evaluate it. Do not keep moving the goalposts.

SceneExpectedPIRTiltGY-6500Verdict
walk pastmotion____________
table bumpdisturbed____________
quiet minutestill____________

When witnesses behave strangely

Disagreement is often the result you need

The PIR stays silent for nearly a minute after startup

Many PIR modules need a warm-up period. Keep the scene still and exclude that time from the trials.

The PIR fires while nobody moves

Sun, heaters, or moving warm air can change its infrared pattern. Turn or shield it and record the environment.

The tilt switch chatters during one tip

The metal contact bounces. Treat several rapid edges inside a short window as one event.

The GY-6500 reports motion while sitting on the desk

Its raw values include gravity and electrical noise. Measure the resting spread before choosing a threshold.

The servo or display makes the motion module fire

The device is sensing its own movement or power disturbance. Separate the servo supply and ignore a short known window after your own gesture.

Choose your laboratory

What kind of motion scientist will you become?

The fair judges

Compare AND, OR, and scene-specific rules on the same untouched evaluation trials.

The motion choreographers

Design a varied set of repeatable gestures and discover which sensor has the clearest vocabulary.

The travelling testers

Keep one rule fixed and move the laboratory to a second environment to see what stops transferring.

A calm way through the build

Collect four small wins

  1. mb-01 says hello.

    Prove the garden connection first.

  2. Each witness has a raw display.

    Test PIR, tilt, and GY-6500 separately.

  3. One fixed scene produces a repeatable record.

    Build the trial loop before inventing the fusion rule.

  4. The verdict survives fresh trials.

    Freeze the rule, add the servo gesture, and evaluate it without retuning.

The garden handshake

Share what you found

These names are the rigid part of the project. They let another team find your work without knowing what you called the variables in your code.

When verdict changes

Motion verdict

garden/workshop/motion-node/mb-01/motion

Unit: enum

Every 60 seconds

Accepted events

garden/workshop/motion-node/mb-01/count

Unit: events

Listen beyond your own device.

garden/entrance/counter/gk-01/count

The entrance counter supplies another aggregate event stream. Compare busy and quiet periods, but do not pretend the same event was seen by both devices.

Finish line

Ready to introduce to the garden

  • mb-01 stays online and publishes motion verdict and event count.

  • The reject feed stays clear after the final code starts.

  • The device reads the Gate Keeper count topic.

  • The display and servo distinguish raw clues from the combined verdict without blocking messages.

  • The build log contains defined scenes, at least twenty trials per condition, delays, misses, false alarms, and an untouched evaluation run.

  • All sensors are fixed, the servo is safely powered, and the device label can be scanned.

The goal is not to make three sensors agree. It is to understand what each witness can see, then build a rule that deserves its confidence.

Backbone now

Live status

Updates from the same public event stream

Checking mb-01…