Week 9 Input Devices

alt text

CODE alt text alt text alt text alt text alt text A push button is a momentary input device that only completes the circuit when pressed.It has internal metal contacts that touch when force is applied and disconnect when released. This produces a digital signal (HIGH/LOW) for microcontrollers. It is commonly used for triggering events like turning LEDs on/off or resetting systems. Debouncing is often required because mechanical contacts can create noise. It is one of the simplest and most reliable human input interfaces.

alt text A toggle switch is a latching mechanical switch that stays in its position after being flipped. Unlike push buttons, it does not require continuous force to maintain state. It is typically used for ON/OFF control of circuits. Internally, it connects or disconnects terminals based on lever position. It outputs a stable digital HIGH or LOW signal. Used in power control, mode selection, and hardware toggling.

alt text A slide switch changes state by sliding a small actuator horizontally. It is a latching switch, meaning it stays in position until moved again.It typically has 2 or 3 terminals depending on configuration (SPST/SPDT).Used for mode selection or power switching in compact devices.Provides a clean digital output without bouncing issues as severe as push buttons. Common in portable electronics and embedded systems

alt text A rocker switch operates by pressing one side down to toggle states.It is a latching switch commonly used for power control.Many versions include internal illumination to indicate ON state. It provides a stable HIGH/LOW output depending on position. Mechanically robust, suitable for higher current applications. Widely used in appliances and power distribution systems.

alt text This is a household AC switch used for controlling mains power. It works by physically connecting or disconnecting live wires. Unlike microcontroller switches, it handles high voltage (220–240V AC).Internally, it uses spring-loaded contacts for quick switching. Not directly interfaced with microcontrollers without relays or isolation.Represents real-world large-scale switching systems.

alt text This is a compact version of a slide switch designed for PCBs. Used in space-constrained electronic designs Operates the same as a regular slide switch but in smaller form factor. Typically used for configuration settings or power toggling. Provides reliable digital switching with minimal footprint. Common in wearable devices and compact circuits.

alt text A flex sensor measures bending by changing its resistance. When straight, resistance is low; when bent, resistance increases. It provides an analog output proportional to curvature. Used in gesture detection, robotics, and wearable tech. Requires a voltage divider to read values using a microcontroller. Useful for capturing physical motion as electrical data

alt text An FSR detects pressure or force applied to its surface. Resistance decreases as more force is applied. It outputs an analog signal based on applied pressure. Used in touch sensing, weight detection, and interactive surfaces. Not highly precise but good for relative force measurement. Requires calibration for consistent readings.

alt text A rotary encoder detects rotation and direction instead of absolute position. It outputs digital pulses (CLK and DT) when rotated.Unlike potentiometers, it has no fixed start or end. Often includes a push button for additional input. Used in menus, volume control, and navigation systems.Requires decoding logic in software

alt text A joystick module provides two-axis analog input (X and Y) along with a push button. It uses two potentiometers internally to detect direction and position.The output is analog voltage for movement and digital for the button press. It is widely used for navigation, robotics control, and gaming interfaces.

alt text A PIR sensor detects motion using infrared radiation changes.It senses heat differences from moving objects (like humans).Outputs a digital HIGH signal when motion is detected.Does not emit energy, only detects passive IR radiation.Used in security systems and automatic lighting. Has adjustable sensitivity and delay.

alt text A gas sensor is an input device used to detect the presence and concentration of gases in the environment. It works by sensing changes in electrical properties (like resistance or voltage) when gas molecules interact with the sensor material. Common types such as MQ-series sensors can detect gases like LPG, methane, carbon monoxide, and smoke. The sensor outputs an analog or digital signal that can be read by a microcontroller (like Arduino or ESP32) for further processing. These sensors are widely used in safety systems, air quality monitoring, and smart alert devices to prevent hazards.

alt text This is an advanced LDR module with built-in signal conditioning.It includes a potentiometer to adjust sensitivity threshold.Provides a clean digital output using comparator (LM393).Also supports analog output for raw light values.Useful when precise triggering is needed based on light level. Common in automation and smart lighting systems.

alt text

The MQ series sensors are gas detection modules that work on changes in resistance when exposed to different gases.Each variant is tuned for specific gases like LPG, methane, alcohol, carbon monoxide, hydrogen, or air quality compounds.They contain a heated sensing element (SnO₂) which reacts with gases and alters conductivity.Output can be both analog (concentration level) and digital (threshold detection).They require a warm-up time (typically 20–60 seconds or more) for stable readings.These sensors are widely used in safety systems, air quality monitoring, and leak detection.