Tuscarora Intermediate Unit 11
Jigar Patel - Director of Innovation & Special Projects
jpatel@tiu11.org | stem.tiu11.org
List files in current directory
Change to a directory
Go up one directory
Show current directory path
Run a Python file
Create/edit a text file
Install Python libraries
Stop a running program
Wiring: Long leg (+) to GPIO, Short leg (-) to GND
Remember: Always use 220Ω resistor
Wiring: One pin to GPIO, opposite pin to GND
Code: button.wait_for_press()
DS18B20: Brown-GND, Blue-3.3V, Yellow-GPIO
Add: 4.7kΩ resistor between Blue and Yellow
Connect: Blue side faces away from SD card
Enable: sudo raspi-config → Interface → Camera
Model: B016
Specs: 0.5W, 5V max, 100mA max
R1 = 10kΩ, R2 = 1kΩ
Vout = Vin × (R2 / (R1 + R2))
Vout = 5V × (1k / 11k) = 0.45V per Volt
Final: 5V input → 0.45V output
Wiring: Red(+) to voltage divider, Black(-) to GND
Activity: Solar Energy Monitoring (Activity 6)
Connect: USB connection
Install: pip3 install Phidget22
"No device found": Check USB connection
"Permission denied": Run with sudo
"Device timeout": Check serial number
Activity: Environmental Monitoring (Activity 4)
"No Phidget found":
→ Check USB connection
→ Try: lsusb to see devices
"Permission denied":
→ Run: sudo python3 myfile.py
"Device timeout":
→ Check serial number in code
→ Try increasing timeout value
"Import error":
→ Run: pip3 install Phidget22
No voltage reading:
→ Check ADC0834 connections
→ Verify voltage divider
Wrong values:
→ Check calculation: V = ADC × 3.3/255 × 11
→ Test with known voltage source
SPI errors:
→ Enable SPI: sudo raspi-config
→ Install: pip3 install spidev

Raspberry Pi Setup

Physical Computing with Python

Learn Python
gpiozero - Hardware control made simpleflask - Create web serverspicamera2 - Camera controlguizero - Easy GUI creationPhidget22 - Phidget LCD controlspidev - SPI devices (solar monitor)sudo apt update && sudo apt upgrade