Wee09 Input Devices¶
Main sensor related to my FP¶
- PIR Sensor (Passive Infrared) A PIR sensor detects motion by measuring changes in the infrared (heat) levels emitted by surrounding objects (like humans or animals).
How it works: It has two slots made of a special material sensitive to IR. When a warm body passes in front, it intercepts one slot first and then the other. The “differential” change between these two slots is what triggers the “motion detected” signal.
Arduino Connection: Usually has 3 pins: VCC (5V), GND, and OUT (Digital).
Key Adjustment: Most PIRs have two potentiometers (small orange screws) on the back. One adjusts Sensitivity (distance) and the other adjusts Time Delay (how long the signal stays “High” after sensing motion.) The PIR sensors are digital. While we can read them with digitalRead(), they don’t give a “range” of how much motion occurred—just a “Yes” or “No.”
Best Source:PIR Sensor Tutorial – This is widely considered the “gold standard” beginner guide.
- Capacitive Touch Sensor (TTP223 or similar) This sensor acts like a smartphone screen. It detects the electrical capacitance of the human body.
How it works: The sensor creates an electric field. When our finger (which is conductive) touches the pad, it increases the capacitance of the circuit. The onboard chip detects this change and flips a switch.
Arduino Connection: 3 pins: VCC, GND, and SIG. Connect SIG to any digital or analog pin.
Libraries: For simple modules like the TTP223, no library is required—it works with a simple digitalRead(). However, if we are making our own touch sensor out of aluminum foil, we will need the CapacitiveSensor library.
i can hide these sensors behind a thin sheet of plastic or wood (up to 3mm), and they will still work!
Best Source: Arduino Get Started: Capacitive Touch Sensor – Excellent for clear wiring diagrams and basic code.
- Step Response Sensor (DIY Pressure/Proximity) This is less of a “bought” sensor and more of a technique. It measures how long it takes for a capacitor (or a DIY conductive pad) to charge.
How it works: i can use two pins on the Arduino and a high-value resistor (e.g., 10 Megaohm). One pin sends a “Step” (a pulse), and the other pin measures how long it takes for the receiving end to feel that pulse. If a human is touching or near the receiving end, their body “absorbs” some of that energy, changing the timing.
Arduino Connection: You bridge a Send Pin and a Receive Pin with a large resistor. The “Sensor” is just a wire attached to the Receive Pin.
This provides Analog Signal Data (a range of numbers), allowing us to detect how close someone is, not just if they touched it.
Libraries: Use the CapacitiveSensor library by Paul Stoffregen.
I test with Arduino UNO to test the input/sensor device I have in the center for Week 09 Assignment – Input Devices and Sensor Integration¶
Individual Assignment¶
Measure something: add a sensor to a microcontroller board and read it My PCB on the way so using Arduino UNO For the individual task, I integrated the flame sensor with an RGB LED module to create a simple fire detection system.
- When no flame is detected → RGB LED shows GREEN
- When flame is detected → RGB LED shows RED
This system simulates a basic real-world fire alert system.
Workflow followed for input/sensor devices¶

Components Used¶
- Arduino board
- KY-026 Flame Sensor
- KY-016 RGB LED
- Jumper wires
- Resistors, lu
Circuit Connections¶
Flame Sensor (KY-026)¶
- VCC → 5V
- GND → GND
- DO → Digital Pin 2
RGB LED (KY-016)¶
- R → Digital Pin 9
- G → Digital Pin 10
- B → Digital Pin 11
- GND → GND

Project Images¶
List of the sensors we have

Arduino Code For the test sensors and workflow¶

Code
int flamePin = 2; // Define the pin connected to the flame sensor (digital output)
int redPin = 9; // Define the pin for RED channel of RGB LED
int greenPin = 10; // Define the pin for GREEN channel of RGB LED
int bluePin = 11; // Define the pin for BLUE channel of RGB LED
int flameState = 0; // Variable to store the state of the flame sensor
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud rate
pinMode(flamePin, INPUT); // Set flame sensor pin as INPUT
pinMode(redPin, OUTPUT); // Set red LED pin as OUTPUT
pinMode(greenPin, OUTPUT); // Set green LED pin as OUTPUT
pinMode(bluePin, OUTPUT); // Set blue LED pin as OUTPUT
Serial.println("System Ready"); // Print message when system starts
}
void loop() {
flameState = digitalRead(flamePin); // Read the flame sensor value (HIGH or LOW)
if (flameState == LOW) { // Check if flame is detected (LOW means flame)
Serial.println("Flame Detected"); // Print message to Serial Monitor
digitalWrite(redPin, HIGH); // Turn ON RED LED (alert state)
digitalWrite(greenPin, LOW); // Turn OFF GREEN LED
digitalWrite(bluePin, LOW); // Turn OFF BLUE LED
} else { // If no flame is detected
Serial.println("No Flame"); // Print safe condition
digitalWrite(redPin, LOW); // Turn OFF RED LED
digitalWrite(greenPin, HIGH); // Turn ON GREEN LED (safe state)
digitalWrite(bluePin, LOW); // Keep BLUE LED OFF
}
delay(300); // Wait for 300 milliseconds before repeating the loop
}
Result¶

The system successfully detects flame and provides a visual indication using the RGB LED. The Serial Monitor displays real-time status messages.