C9: Arduino / RPi Pico Advanced + Sensor Interfacing

Aim:
To connect and test different types of sensors with a microcontroller.

Requirements:

  • Arduino Uno or Raspberry Pi Pico

  • Light sensor (LDR)

  • Gas sensor (MQ-2)

  • PIR motion sensor

  • IR sensor module

  • Jumper wires

  • Breadboard

  • Computer with Arduino IDE or Thonny IDE

Procedure:

  1. Set Up Your Microcontroller

    • Connect your Arduino Uno or Raspberry Pi Pico to your computer.

    • Open Arduino IDE (for Arduino) or Thonny IDE (for Pico).

  2. Choose Your First Sensor

    • For example, start with the LDR.

    • Identify the sensor pins (Vcc, GND, Output).

  3. Wire the Sensor

    • Connect Vcc to the board’s 5V or 3.3V pin.

    • Connect GND to ground.

    • Connect the output pin to an analog input pin (A0 for Arduino) or GP pin (for Pico).

  4. Upload Sample Code

    • Use a simple “read sensor value” program.

    • For Arduino: analogRead(A0);

    • For Pico (MicroPython): adc.read_u16()

  5. Test the Sensor

    • Shine light on the LDR — note the value.

    • Cover it with your hand — see the change in value.

  6. Repeat for Other Sensors

    • Gas Sensor: Blow gently across it to simulate gas presence.

    • PIR Motion Sensor: Wave your hand in front of it and watch the output change.

    • IR Sensor: Place an obstacle in front and observe detection.

  7. Record Observations

    • Write down how each sensor reacted to changes.

Note whether the output was analog or digital.

Fill in the form for S’O’A Fablab Orientation 2021.