WEEK 9

TASK
MONDAY
WEDNESDAY
FRIDAY
MONDAY

✦ Working with Inputs

During this week, I focused on understanding how microcontrollers perceive the physical surroundings through input devices. Also, the main objective of the assignment was to integrate a sensor to the Seeed Xiao RP2350 in the PCB I designed and read its data. To fulfill this, I will be using a PIR (Passive Infrared) motion sensor, an electronic device that detects movement based on changes in infrared radiation. Also, for this week I will be consulting our Group Assignment.

◆ What is an Input Device?

An input device is a component that allows a microcontroller to receive information from its surroundings. It converts physical phenomena into electrical signals that can be read and processed. Besides, depending on the sensor’s architecture, this communication occurs through two types of signals.

Signal
Description
Analog
Continuous values that vary over time, such as temperature or light intensity.
Digital
Discrete values represented as HIGH or LOW, such as a button press or motion detection.
I2C Communication
Digital communication protocol that allows multiple devices to send data using two lines (SDA AND SCL).

✦ PIR Motion Sensor

The PIR (Passive Infrared) sensor detects motion by measuring changes in infrared radiation emitted by objects, such as the human body. When a person crosses its field of view, the sensor registers this thermal variation and outputs a digital signal.

Pinout Diagram

The PIR sensor communicates via a digital signal, operating on a binary state. When the sensor detects movement through thermal variations, it triggers a HIGH output. Conversely, when the environment remains static, the output defaults to a LOW state.

◆ Components

✦ What I will be using?
  • 1.Seeed XIAO RP2035
  • 2.PIR Motion Sensor
  • 3.Jumper wires
Pinout Diagram

◆ Circuit Connections

The PIR sensor typically has three pins:

Pinout Diagram

✦ Sensor Callibration

Adjustment controls of the PIR motion sensor. The module includes two potentiometers: one for time delay and another for sensitivity. Rotating clockwise increases the delay time (up to 5 minutes) and decreases sensitivity (down to 3 meters), while rotating counterclockwise reduces the delay (down to 3 seconds) and increases the sensitivity (up to 7 meters).

Pinout Diagram

✦ Programming

The following code is programmed so that when the sensor detects nearby movement, the LED lights on the PCB will illuminate, remaining on for a few seconds, and then turn off when no nearby presence is detected.


//PIR Sensor

void setup() {
  pinMode(D10,INPUT);
  pinMode(D1, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);
  pinMode(D7, OUTPUT);
  pinMode(D8, OUTPUT);
}

void loop() {
 if(digitalRead(D10) == HIGH){
  digitalWrite(D1, HIGH);
  digitalWrite(D2, HIGH);
  digitalWrite(D3, HIGH);
  digitalWrite(D7, HIGH);
  digitalWrite(D8, HIGH);
  
  }
else{
  digitalWrite(D1, LOW);
  digitalWrite(D2, LOW);
  digitalWrite(D3, LOW);
  digitalWrite(D7, LOW);
  digitalWrite(D8, LOW);
  
}}
    

✦ Uploading the Code in Arduino IDE

To read the data from the sensor, the program was uploades to the microcontroller using Arduino IDE

✦ RESULTS

Throughout this week, I encountered some difficulties as I had to delve deeper into the world of electronics. Therefore, I can say there was a lot of trial and error when programming the Arduino code, as it was my first time using it. However, I was able to achieve the assignment goal, and I'm surprised by what I was able to accomplish during the week of inputs.

✦ Download Here!

In this section, you can find the downloadable source files developed during this week.

INO

ARDUINO IDE

Download File