Tilt Switch using Raspberry Pi 4 B

Aim

The goal of this activity is to demonstrate the use of a tilt switch as a switch that opens or closes the circuit.

Materials Required

  1. Raspberry Pi 4 B -1    
  2. Breadboard – 1
  3. LED -1
  4. Tilt Switch -1
  5. Several Jumper Wires   
  6. 220Ω Resistors – 2
  7. Type-C USB Cable-1  

Wiring Diagram

Desired Outcome

 When the tilt switch is in a vertical position, the LED is off, and when it’s in a horizontal position, the LED turns on.