Map BCM signals to physical header positions and distinguish mock GPIO from electrical output.
The focus of this experiment is to map physical header numbers to BCM signals and distinguish supply, ground and signal pins. Students then calculate a safe ideal resistor or divider value from the stated voltages, and check pin identity and electrical limits before connecting hardware. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.
Learning objectives
Map physical header numbers to BCM signals and distinguish supply, ground and signal pins.
Calculate a safe ideal resistor or divider value from the stated voltages.
Check pin identity and electrical limits before connecting hardware.
Identify the configured inputs (Numbering scheme; Pin number; Requested action) and record the corresponding observed outputs with units where applicable.
Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.
Expected learning outcomes
On completion, students can map physical header numbers to BCM signals and distinguish supply, ground and signal pins, calculate a safe ideal resistor or divider value from the stated voltages, and check pin identity and electrical limits before connecting hardware.
Required deliverables
Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing check pin identity and electrical limits before connecting hardware. Separate predicted values from observations.
Prerequisite knowledge and related learning
Review the following catalogue prerequisites before starting. After completion, continue to Lab 3 · Linux command line.
Browser teaching model, the named WSL or Python environment, and the physical board/components only for the hardware activity described in the practical instructions.
Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.
R2 / PREPARE
Before starting
Follow the setup guide and use the named terminal or editor. A browser model is not a real GPIO measurement or a running service.
Use the Pi 4 reference header only. Verify pinout output before interpreting the mock GPIO example.
CONCEPTS / ACTIVE RECALL
Understand the experiment
Scientific architecture · Raspberry Pi GPIO pinout and numbering
Scientific concept map: 40-pin header — Physical BOARD numbering; BCM lookup — GPIO17 ↔ pin 11; Pin classification — GPIO / 3.3V / 5V / GND; Direction request — Input or output; Safe wiring — Common ground; never 5V to GPIO.
Scientific foundations and analytical reasoning
BCM numbering identifies SoC GPIO signals; BOARD numbering identifies physical header positions. Power and ground are not programmable GPIO.
Before operating the equipment or executing the program, derive the expected outcome using the required theoretical work in Experiment. Use the diagram to identify the variables and system boundaries.
Scientific theory · Physical header versus SoC signals
The 40-pin header combines power rails, grounds and programmable signals. BCM names refer to the controller's GPIO numbering, not the ordinal position on the connector. A pin can have alternate functions such as UART, SPI or I²C. The selected software numbering convention determines which physical pin a command addresses; check the pin map and board model before connecting power.
Worked example and engineering interpretation
On a Raspberry Pi 4, BCM17 corresponds to physical pin 11; physical pin 17 is 3.3 V power, not BCM17. A program targeting BCM17 and a wire on pin 17 therefore refer to different objects. Never apply a 5 V signal directly to a Pi GPIO input.
Engineering principles · additional worked teaching example
BCM numbers identify SoC signals; BOARD numbers identify physical connector positions. On a Pi 40-pin header BCM18 is physical 12 and ground can be physical 14. The number is not a voltage or port mode. A drawing verifies mapping, but only electrical testing verifies a signal.
From theory to experiment
Predict the reference result before operating the workbench; check the actual intermediate state, units and constraints. The existing simulation, implementation and procedure below are distinct sources of evidence.
How to investigate Lab 2 · GPIO header & numbering
Map BCM signals to physical header positions and distinguish mock GPIO from electrical output.
Analytical investigation means collecting an observation, identifying the mechanism, using a calculation or state trace to explain it, and checking your conclusion against evidence. Controlled comparison means changing one independent variable, holding the remaining relevant conditions constant, and measuring a dependent variable against a baseline. Experimental validation means comparing a predicted result to a reproducible observation or assertion; agreement inside a model does not certify hardware. Evidence-based reasoning connects a specific observation to a theoretical rule and states uncertainty, not merely an opinion. Performance characterization records a named metric and its units across conditions; sensitivity analysis changes one parameter across several values. A threat assessment links an asset, threat, consequence and evidence to a mitigation.
Experiment-specific guided practice
Objective: Map BCM signals to physical header positions and distinguish mock GPIO from electrical output.
Select BCM17 and locate physical header pin 11.
Switch to BOARD and enter 11. Confirm both selections identify the same GPIO.
Enter physical pin 2 and then pin 6: distinguish 5 V and GND from configurable GPIO.
Use the actual pinout command or documented pinout and check the wiring before powering hardware.
Reference check:
Model boundary:
Independent task and submission evidence
2. Switch to BOARD and enter 11. Confirm both selections identify the same GPIO. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.
Before execution write the independent variable and its levels, dependent observation with units where applicable, baseline, controlled variables, measurement method and expected result. For a state machine use state/event/output rather than inventing a numeric metric. Record failures and repeat the baseline. A weak conclusion is “it works”; a supported conclusion names the changed setting, observed value/state, corresponding rule and one limitation.
Trial
Changed setting
Fixed settings
Predicted result
Actual observation / units
Evidence / uncertainty
A: baseline
Reference
Record
Predict
Record
Record
B: one change
Record
Same as A
Predict
Record
Record
A: repeat
Restore
Same as A
Predict
Record
Record
Completion: submit the filled table, relevant simulator screenshot or terminal/notebook output, reasoning with units/assumptions, and one limitation. Preserve the independent assessment questions; this guide does not fill their answers.
Worked engineering reasoning and boundary conditions
Engineering reference configuration: Numbering scheme = BCM; Pin number = 17; Requested action = Output. In the classroom model, Physical pin = 11; BCM signal = 17; GPIO configurable = Yes; Pin category = GPIO; Requested direction = Output. This mapping describes the standard 40-pin header; it does not drive GPIO. A closed, deterministic browser model. The existing practical instructions and source files provide independent execution; browser results are not hardware measurements.
Use the diagram to follow the calculation or state progression. Keep the teaching configuration separate from the independent exercise values; compare observations with the actual model and implementation.
Concept animation · matrix and row processing
Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.
Step 1 of 7 · Row 1
Row 1
Row 1
["1 / —", "2 / —"]
Row 3
Row 1
["1 / —", "2 / —"]
Row 2
["3 / 2", "4 / —"]
Row 3
["5 / 3", "6 / —"]
Row 4
Row 1
["1 / —", "2 / —"]
Row 2
["3 / 2", "4 / —"]
Row 3
["5 / 3", "6 / —"]
Row 4
["7 / 4", "8 / 14"]
Row 5
Row 1
["1 / —", "2 / —"]
Row 2
["3 / 2", "4 / —"]
Row 3
["5 / 3", "6 / —"]
Row 4
["7 / 4", "8 / 14"]
Row 5
["9 / —", "10 / 15"]
Row 7
Row 1
["1 / —", "2 / —"]
Row 2
["3 / 2", "4 / —"]
Row 3
["5 / 3", "6 / —"]
Row 4
["7 / 4", "8 / 14"]
Row 5
["9 / —", "10 / 15"]
Row 6
["11 / 17", "12 / 18"]
Row 7
["13 / 27", "14 / —"]
Row 9
Row 1
["1 / —", "2 / —"]
Row 2
["3 / 2", "4 / —"]
Row 3
["5 / 3", "6 / —"]
Row 4
["7 / 4", "8 / 14"]
Row 5
["9 / —", "10 / 15"]
Row 6
["11 / 17", "12 / 18"]
Row 7
["13 / 27", "14 / —"]
Row 8
["15 / 22", "16 / 23"]
Row 9
["17 / —", "18 / 24"]
Row 10
Row 1
["1 / —", "2 / —"]
Row 2
["3 / 2", "4 / —"]
Row 3
["5 / 3", "6 / —"]
Row 4
["7 / 4", "8 / 14"]
Row 5
["9 / —", "10 / 15"]
Row 6
["11 / 17", "12 / 18"]
Row 7
["13 / 27", "14 / —"]
Row 8
["15 / 22", "16 / 23"]
Row 9
["17 / —", "18 / 24"]
Row 10
["19 / 10", "20 / —"]
Teaching example only; inspect live calculations or real practical evidence separately.
Recall the concept before revealing its explanation.
0 / 3 revealed
R2 · 01 / 08What is BCM numbering?Reveal explanation
Engineering explanation
BCM identifies GPIO signals, not physical header positions; BCM17 is pin 11.
R2 · 02 / 08Why distinguish power pins?Reveal explanation
Engineering explanation
3.3 V and 5 V rails are not software-controlled GPIO outputs.
R2 · 03 / 08What must you verify before interpreting BOARD pin 11 in the Pi 4 mock?Reveal explanation
Engineering explanation
Use the Pi 4 reference header only. Verify pinout output before interpreting the mock GPIO example.
R2 · 04 / 08How do you locate GPIO17 on a Pi 4 header?Reveal explanation
Engineering reasoning
Use BCM numbering in the program and physical pin 11 in the 40-pin header diagram; also identify a ground pin.
R2 · 05 / 08Why must a pin map distinguish power, ground and GPIO?Reveal explanation
Engineering reasoning
Power rails are fixed supply connections, not programmable digital outputs. A pin number alone does not establish a safe voltage or function.
R2 · 06 / 08A student connects an LED using BCM17. Select every technically valid statement.
A. BCM17 corresponds to physical pin 11 on Pi 4.
B. A ground return and series resistor are needed for a physical LED circuit.
C. BCM17 means physical pin 17.
D. The 5 V rail is a programmable GPIO output.Reveal explanation
Applied scenario
Correct: A. BCM17 corresponds to physical pin 11 on Pi 4.; B. A ground return and series resistor are needed for a physical LED circuit.
R2 · 07 / 08In GPIO header & numbering, which command or code executes Execute a Python block from Bash?Reveal explanation
R2 · 08 / 08For GPIO header & numbering, which actual output or state confirms the prescribed practical run succeeded, and what does it not establish?Reveal explanation
Evidence & acceptance
Use the Ubuntu toolkit virtual environment, not a physical Pi. BOARD pin 11 corresponds to BCM17. The mock trace must show GPIO17 HIGH; cleanup ends the logical test. The pinout utility needs gpiozero. A printed trace is not voltage or current evidence.
Execution boundary · Simulated header. Browser simulation below is a teaching model, not execution of Python or firmware. The real commands run in VS Code/WSL; Wokwi is used for Arduino/ESP32 where indicated.
GPIO header architecture. Supply, ground and signal classes.
Shared research workbenches · network designer & advanced studiesConcurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery researchLoading experiment-specific apparatus…Previous model / additional reference tools
Simulation task
Map BCM signals to physical header positions and distinguish mock GPIO from electrical output.
Explore the model using its own controls. Record a prediction before changing a condition. Compare the reference with a changed condition, then use the Experiment tab for the procedure, acceptance criteria and notebook. Model outputs and physical observations must remain separate.
Interactive engineering workbenchR2 · Existing model
Original virtual instrument; model signals and execution trace.
Loading instrument…
Awaiting model display.
Experimental instrumentation · A/B
Compare two model conditions
Capture a baseline, change one experimental condition, run the model if required and capture the comparison. Snapshots contain visible controls and display text, not physical sensor readings. Review before exporting.
Ask Dr. Mohammad locally, or prepare an experiment-aware prompt for ChatGPT, Gemini or Claude. The external providers open in their own tabs; nothing is automatically submitted.
Public course objective, displayed commands, source excerpts and procedure. Private assessment content is not collected.
Prepare a contextual AI prompt
0 characters
Common secret and email patterns are redacted on preparation; this is not a comprehensive privacy filter. Review the entire editable prompt, including student work and unpublished research, before sharing. The providers apply their own accounts, privacy settings and limits.
Use the Ubuntu toolkit virtual environment, not a physical Pi. BOARD pin 11 corresponds to BCM17. The mock trace must show GPIO17 HIGH; cleanup ends the logical test. The pinout utility needs gpiozero. A printed trace is not voltage or current evidence.
Record the actual output, source (mock/model or physical), and any error. A missing tool, timeout or untested external service is not a pass.
Before the simulation or practical, solve both experiment-specific tasks. List the given inputs, show the intermediate calculation or state trace, identify the expected observation, and state a limitation. Show formulas and intermediate calculations where relevant, or draw the requested state/sequence diagram. These are independent classroom fixtures; where they differ from the reference configuration below, do not treat them as measured values. Compare your predictions with the corresponding experiment afterwards.
01 · Predict and derive using the given inputs
Using the header diagram, map BCM17, BCM24 and BCM23 to physical pins. Mark a ground and a 3.3 V supply pin.
Engineering method — BCM numbers identify SoC signals; BOARD numbers identify physical connector positions. On a Pi 40-pin header BCM18 is physical 12 and ground can be physical 14. The number is not a voltage or port mode. A drawing verifies mapping, but only electrical testing verifies a signal. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Compare or justify using evidence
Explain why connecting an output to a supply pin is unsafe and why mock GPIO cannot establish an electrical voltage.
Engineering method — BCM numbers identify SoC signals; BOARD numbers identify physical connector positions. On a Pi 40-pin header BCM18 is physical 12 and ground can be physical 14. The number is not a voltage or port mode. A drawing verifies mapping, but only electrical testing verifies a signal. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
03 · Configuration debugging
Configuration debugging · Independent work
A GPIO program uses BCM27, but the student attaches the wire to physical pin 27. Explain the error and specify a corrected wiring point and a ground.
Configuration debugging — BCM numbers identify SoC signals; BOARD numbers identify physical connector positions. On a Pi 40-pin header BCM18 is physical 12 and ground can be physical 14. The number is not a voltage or port mode. A drawing verifies mapping, but only electrical testing verifies a signal. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
Work is saved locally when browser storage is available. Export it for submission; no remote upload or automatic grade is assigned.
Expanded independent theoretical exercise bank
Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.
Intermediate · Explain a changed-input result
Independent theoretical exercise · R2-01
Use the reference configuration (Numbering scheme = BCM; Pin number = 17; Requested action = Output), but change Numbering scheme = BOARD. The model reports Physical pin = 17. Explain the governing rule and assumptions that make this output plausible; identify an independent verification method.
Intermediate · Quantitative comparison
Independent theoretical exercise · R2-02
Two model observations of Physical pin are 11 (reference) and 17 (changed condition). Compute signed change and, when the reference is nonzero, percentage change. Explain why units matter.
Intermediate · Interpret a technical trace
Independent theoretical exercise · R2-03
For Pin number = 19, the model supplies this excerpt from 40-pin signal mapping:
Odd pin · BCM · Even pin · BCM
1 · — · 2 · —
3 · 2 · 4 · —
5 · 3 · 6 · —
7 · 4 · 8 · 14
9 · — · 10 · 15
Count rows whose BCM value is exactly “—”, and identify the displayed row numbers. Explain what the count describes.
Advanced · Reverse reasoning
Independent theoretical exercise · R2-04
An observation is Physical pin = 35. Candidate A uses Numbering scheme = BCM; Pin number = 17; Requested action = Output. Candidate B changes the listed settings (Pin number = 19) and keeps the remaining settings fixed. Which is consistent with the observation? If both can explain it, say what additional evidence is required.
Advanced · Diagnose a reported mismatch
Independent theoretical exercise · R2-05
A student configures Requested action = Input while preserving all other reference settings, but copies the reference report of Requested direction = Output. Evaluate whether the report is justified. Identify the first configuration/output check to perform.
Challenging · Design a controlled verification
Independent theoretical exercise · R2-06
Design a controlled comparison for Lab 2 · GPIO header & numbering using reference Numbering scheme = BCM; Pin number = 17; Requested action = Output and test Numbering scheme = BOARD. Specify the changed setting(s), measured metric Physical pin, controls, repetitions, an acceptance check and what evidence can distinguish an actual implementation from the model.
Challenging numerical variant 1
Calculation · Independent work
The diagram shows an ideal unloaded 3.3 V divider. R1=5000 Ω and R2=2000 Ω. Calculate midpoint voltage in millivolts, rounded to nearest integer.
Challenging numerical variant 2
Calculation · Independent work
The diagram shows an ideal unloaded 3.3 V divider. R1=2000 Ω and R2=3000 Ω. Calculate midpoint voltage in millivolts, rounded to nearest integer.
Challenging numerical variant 3
Calculation · Independent work
The diagram shows an ideal unloaded 3.3 V divider. R1=8000 Ω and R2=3000 Ω. Calculate midpoint voltage in millivolts, rounded to nearest integer.
Step-by-step experimental procedure
Resolve a selected BCM or physical pin against the 40-pin header; distinguish power, ground and configurable GPIO.
1 · Reference workbench configuration
Use the named reference workbench and its reference inputs. Additional live instruments may have different controls; use the matching instrument. Record virtual and practical results separately.
Numbering schemeBCM
Pin number17
Requested actionOutput
2 · Perform the investigation in order
Select BCM17 and locate physical header pin 11.
Switch to BOARD and enter 11. Confirm both selections identify the same GPIO.
Enter physical pin 2 and then pin 6: distinguish 5 V and GND from configurable GPIO.
Use the actual pinout command or documented pinout and check the wiring before powering hardware.
3 · Compare controlled trials
Trial
Independent change
Expected check
Observation
BCM17
Use reference inputs above
Physical pin: 11
Record actual result
Board 11
Numbering scheme = BOARD; Pin number = 11
BCM signal: 17
Record actual result
Power pin
Numbering scheme = BOARD; Pin number = 2
GPIO configurable: No
Record actual result
4 · Analyze and report
Why is pin 17 in BOARD mode not the same as BCM17? Do not connect 5 V directly to 3.3 V GPIO.
Required evidence: Record the named metrics and trace for the reference and changed cases, then attach the corresponding practical command output or device evidence if available.
Model boundary: A closed, deterministic browser model. The existing practical instructions and source files provide independent execution; browser results are not hardware measurements.
Controlled investigation · reproducible evidence
Method. Use the existing reference workbench configuration and the named controlled changes below. A controlled variable stays fixed while the independent variable is intentionally changed; the dependent variable is the resulting observed output. First predict each trial from the Concepts page. Run the baseline, then change only the specified setting and record the outcome. For deterministic traces one execution per case and a repeated verification are sufficient; for timing or stochastic measurements repeat at least five times, recording each run, median and range. Reset to the reference state between independent comparisons.
Trial
Independent change
Dependent observation
BCM17
Use reference inputs above
Record actual outcome and units
Board 11
Numbering scheme = BOARD; Pin number = 11
Record actual outcome and units
Power pin
Numbering scheme = BOARD; Pin number = 2
Record actual outcome and units
Evidence: attach the completed comparison table, one trace or screenshot per condition, and actual practical terminal/hardware evidence where applicable. Explain any prediction mismatch and distinguish modeled behavior from measured results.
Loading laboratory-specific procedure…
Python / Google Colab notebook
Bounded notebook reference exercise; original device/service commands are reference-only. Validated locally in a fresh Jupyter kernel. Download, then upload to Google Colab.
Use the Pi 4 reference header only. Verify pinout output before interpreting the mock GPIO example.
Complete one-time setup first. Copy one command block at a time into the indicated environment. Do not copy prompt characters. Open new terminals where named; variables are terminal-specific. Ctrl+C stops a running foreground command.
✓ Expected: A Pi 4 reference pin map is printed. Physical pin 11 is BCM17 and physical pin 12 is BCM18; this is a reference, not hardware detection.Expected result for each action (2)
source ~/psut-wsl/activate.shThe toolkit virtual environment is selected in this terminal, usually with (.venv) in the prompt. Verify which python points into ~/psut-wsl/.venv.
pinout -r d03114 --monochromeA Pi 4 reference pin map is printed. Physical pin 11 is BCM17 and physical pin 12 is BCM18; this is a reference, not hardware detection.
Checkpoint The Pi 4 reference pin map appears; physical pin 11 = BCM GPIO17.
02
Execute a Python block from Bash
Copy the entire heredoc including both PY markers. Do not type Python statements directly into Bash.
✓ Expected: The embedded Python block executes as one unit. The fake GPIO driver reports setup, output and cleanup; no physical pin changes.Expected result for each action (2)
source ~/psut-wsl/activate.shThe toolkit virtual environment is selected in this terminal, usually with (.venv) in the prompt. Verify which python points into ~/psut-wsl/.venv.
python - <<'PY'
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.output(11, GPIO.HIGH)
GPIO.cleanup()
PYThe embedded Python block executes as one unit. The fake GPIO driver reports setup, output and cleanup; no physical pin changes.
Checkpoint Mock GPIO output for physical 11 / BCM17.
Experimental notebook
Record your own results. Values are not prefilled or independently verified.
03 / Inspect
Source code and method
Use the inline source or commands in the steps above. No separate source file is required for this foundational lab.
04 / Verify
Evidence of completion
Save the actual terminal output from the checkpoints above. For simulated inputs explicitly record browser model, fakepi, mock or Wokwi. Never present those data as physical measurements. If a checkpoint fails, see the troubleshooting guide.
Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.
Execution scope: Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.
01Instructions · Markdown
# r2 · Lab 2 · GPIO header & numbering
**PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh**
## Introduction
Map BCM signals to physical header positions and distinguish mock GPIO from electrical output.
## How to run
1. Download this notebook from the laboratory page. Open Google Colab → File → Upload notebook.
2. Select a Python CPU runtime. Run cells from top to bottom using Shift+Enter, or Runtime → Run all.
3. Read the printed observations and assertions. Change one parameter at a time and rerun the relevant cell.
4. Save your own outputs and compare them to the portal Experiment tab.
**Execution boundary:** Bounded notebook reference exercise; original device/service commands are reference-only. Do not run the hardware or service commands in Colab. No real credentials are needed. The notebook is self-contained.
02Instructions · Markdown
## Experiment-specific preparation
Map BCM signals to physical header positions and distinguish mock GPIO from electrical output.
**Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):**
1. Select BCM17 and locate physical header pin 11.
2. Switch to BOARD and enter 11. Confirm both selections identify the same GPIO.
3. Enter physical pin 2 and then pin 6: distinguish 5 V and GND from configurable GPIO.
4. Use the actual pinout command or documented pinout and check the wiring before powering hardware.
**Evidence:**
**Boundary:**
03Instructions · Markdown
## 1. Objectives and reference condition
- Reproduce the specific computational mechanism in this laboratory.
- Inspect the output, compare the reference condition with a changed or rejected condition where implemented, and explain any discrepancy.
- Distinguish actual local Python execution from mock, physical and external-service observations.
## 2. Environment check
04Python · executable cell
PYTHON · Code cell
# =====================================================================
# R2 | Code cell 01 | Lab 2 · GPIO header & numbering
# Purpose: 1. Objectives and reference condition - Reproduce the specific computational mechanism in this laboratory. - Inspect the output, compare the reference condition with a changed or rejected condition where implem
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
import sys
print("Python",sys.version.split()[0])
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert sys.version_info >= (3,10)
## 3. Implementation
Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
06Python · executable cell
PYTHON · Code cell
# =====================================================================
# R2 | Code cell 02 | Lab 2 · GPIO header & numbering
# Purpose: 3. Implementation Read the comments and variable definitions before execution. Assertions must pass; inspect values, not just completion.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Set BCM_TO_PHYSICAL for the next computation or reference condition.
BCM_TO_PHYSICAL={17:11,18:12,22:15,25:22,27:13}
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert BCM_TO_PHYSICAL[17]==11
print(BCM_TO_PHYSICAL)
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert 17 != BCM_TO_PHYSICAL[17]
## Original portal implementation (reference only)
These are the actual laboratory snippets. They are retained for comparison; follow the portal setup for WSL, hardware or services. They are **not** executed by Run all.
```bash
source ~/psut-wsl/activate.sh
python - <<'PY'
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.output(11, GPIO.HIGH)
GPIO.cleanup()
PY
```
08Instructions · Markdown
## 4. Results and analysis
Record the actual output and whether the assertions pass. Identify a parameter to vary, state your prediction, repeat the reference calculation, then explain the changed result.
| Trial | Configuration | Observation | Interpretation |
|---|---|---|---|
| A | Reference | | |
| B | One controlled change | | |
| C | Reference repeat | | |
**Limitations:** Bounded notebook reference exercise; original device/service commands are reference-only. Notebook success does not certify external equipment or services.
09Instructions · Markdown
## Guided reasoning and evidence
A controlled comparison changes one independent input while keeping the other relevant inputs fixed; the dependent variable is the recorded output. Use this lab’s reference condition above.
**Independent task:** 2. Switch to BOARD and enter 11. Confirm both selections identify the same GPIO. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.
| Trial | Input/configuration | Prediction | Observation | Evidence / limitation |
|---|---|---|---|---|
| A | Reference | | | |
| B | Changed input | | | |
| A repeat | Reference | | | |
A conclusion is supported only when it cites the recorded values or observed states and explains them with the experiment theory.