Wire and test access-control indicators
Trace the controller’s two active-low buttons and four indicators, then compare identity recognition with a zone access decision.

Shield Shelly: I want you to trace the button, the identity, and the permission before trusting the green light.
Predict the reading, then compare it with the measurement.
Wokwi ESP32
Third party ToolTrace the controller’s two active-low buttons and four indicators, then compare identity recognition with a zone access decision.
Open the ESP32 editor, paste diagram.json, then paste sketch.ino.
Open Wokwi to paste in the files (new tab)Get the files
Use both prepared files. This is a paste-in setup; saving a project requires a Wokwi account.
sketch.ino
- Use the launch button above to open the ESP32 editor in Wokwi.
- Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
- Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.
Steps
Step 1
- Do
- Paste the supplied diagram.json and sketch.ino into a new Wokwi ESP32 project. Trace each LED back to its GPIO and ground.
- You will see
- Green, red, yellow, and blue LEDs connect to GPIO 2, 4, 5, and 18 respectively, each with a 220 Ω resistor.
- Why it matters
- A security decision needs an observable result. The host distinguishes the identity check from the authorization that should drive an output.

Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 2
- Do
- Trace the two pushbuttons and buzzer before starting.
- You will see
- Select card joins GPIO 15 to ground when pressed; Request access joins GPIO 16 to ground. The buzzer’s positive pin is on GPIO 19.
- Why it matters
- INPUT_PULLUP gives each released button a known HIGH state. A grounded press is the event that starts the identity or access workflow.

Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 3
- Do
- Start the simulation. Send STATUS in Serial Monitor at 115200 baud.
- You will see
- The heading IoT ACCESS CONTROL SYSTEM v1.0 appears; STATUS shows Locked: NO | Fails: 0 | Card: RFID_ADMIN_001.
- Why it matters
- The default card identifies the initial actor. The host asks who made a request before asking whether that actor may perform it.

Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 4
- Do
- Briefly click Request access and release it.
- You will see
- ACCESS GRANTED: Alice Admin -> Server Room appears, with green and blue LED feedback.
- Why it matters
- The initial admin identity has the required role. Seeing a grant tests the complete input-to-output path, not just a successful lookup.
Server Room appears after clicking Request access. The ring marks the grant message." loading="lazy">Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 5
- Do
- Briefly click Select card once and release it; wait for Card selected: RFID_USER_001, then click Request access.
- You will see
- The selected card is recognized, but ACCESS DENIED: Charlie User has USER, needs ADMIN appears and the red LED flashes.
- Why it matters
- This is the host’s central distinction: authenticating Charlie does not authorize Charlie for every door.

Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 6
- Do
- Send ZONE 1 in Serial Monitor while the user card is selected.
- You will see
- ACCESS GRANTED: Charlie User -> Office Area appears and the green LED illuminates without the blue admin indicator.
- Why it matters
- The same identity has a different outcome for a different resource. Authorization is scoped to the requested operation.
Office Area appears. The ring marks the grant for the same identity in a different zone." loading="lazy">Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) Step 7
- Do
- Send LOG, inspect the grant and denial entries, then stop and restart the simulation and send LOG again.
- You will see
- The first log contains ACCESS_GRANTED and ACCESS_DENIED_AUTHZ rows. After restart only the SECURITY AUDIT LOG heading appears because the in-memory entries were cleared.
- Why it matters
- Evidence must survive the event it explains. This setup uses replayable fictional card strings and volatile logs; it does not implement the host’s fresh-nonce challenge-response protocol.

Step 7 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
Chapter checks
These questions refer to the chapter’s examples. Use the return links to review their answers.
A smart-building controller correctly verifies every user's certificate, but once verified, every user can unlock every door and reconfigure the HVAC. Which control is missing?
Return to the chapter’s knowledge checkA challenge-response scheme uses HMAC over a strong 256-bit per-device key, but the verifier reuses the same challenge nonce for every device every hour. Why is this insecure despite the long key?
Return to the chapter’s knowledge check