TPISLAM
TPISLAM
REPORT ABOUT :
EMBEDDED SYSTEMS
Réalisé Par :
BOUBEKER ISLAM
Encadré Par :
Dr. HASSINI
The LM35 is a simple yet highly accurate temperature sensor, resembling a basic transistor
in appearance. Known for its reliability and cost-effectiveness, it performs well even in
extreme temperature ranges. Its analog voltage output makes it ideal for integration into
analog circuits and embedded systems. In this simulation, we leverage the readily available
LM35 model in Proteus to demonstrate its functionality and versatility.
Components Required:
Arduino UNO: A microcontroller board used to read the LM35 sensor’s data and process it.
LM35 Temperature Sensor Module: A precise sensor that converts temperature into an
analog voltage.
2
Virtual Terminal: A tool in Proteus used to simulate a display for serial communication
output.
Power Supply: Supplies the necessary voltage (5V) to power the Arduino and LM35 sensor.
Connections Required:
LM35 Sensor to Arduino:
The middle pin of the LM35 is its output pin, which provides an analog voltage proportional
to the sensed temperature. Connect this pin to A1 (an analog input pin) on the Arduino to
read the sensor's output.
One side pin of the LM35 is the GND pin, which should be connected to the GND of the
Arduino to complete the circuit.
The other side pin is the VCC pin, which needs to be connected to the 5V pin of the Arduino
to power the sensor.
Virtual Terminal to Arduino:
In Proteus, the virtual terminal simulates a serial monitor for displaying data output.
Connect the TXD pin of the Arduino (transmit pin) to the RXD pin of the virtual terminal
(receive pin) to send data from the Arduino to the terminal.
Similarly, connect the RXD pin of the Arduino (receive pin) to the TXD pin of the virtual
terminal, enabling bidirectional communication if needed.
Purpose of Connections:
The LM35 provides temperature data as an analog voltage to the Arduino.
The Arduino processes this data, converts it into readable temperature values, and
transmits it to the virtual terminal for display.
The virtual terminal acts as an output interface, simulating the serial monitor typically used
during real-world Arduino programming.
3
How the code Works :
The code utilizes serial communication at a baud rate of 9600 to send temperature readings
from the LM35 sensor to the serial monitor. In the loop() function, the Arduino reads the
analog voltage from the LM35, converts it into Celsius and Fahrenheit, and transmits the
results via serial communication. To run this code in Proteus, first compile the Arduino code
in the Arduino IDE to generate a hex file. Open Proteus, double-click the “ARDUINO UNO
R3” component, and select “Edit Component.” In the program file section, browse to the
location of the hex file and load it. Click “OK” to complete the setup. This process integrates
the compiled code into the Proteus simulation, allowing the Arduino to function as
programmed in the virtual environment.
Introduction
This project demonstrates how to interface two types of sensors, the IR (Infrared) Sensor
and the PIR (Passive Infrared) Sensor, with a single Arduino Uno board. The objective is to
simulate a multi-sensor system capable of detecting motion and proximity, displaying
sensor states on a 16x2 LCD, and providing feedback via LEDs. This simulation is valuable for
understanding how to manage multiple inputs and outputs in an embedded system.
Components Required:
Arduino Uno: Central microcontroller for processing sensor inputs and controlling outputs.
PIR Sensor Module: Detects motion by sensing infrared radiation from moving objects.
IR Sensor: Detects proximity or obstacle presence based on reflected infrared light.
16x2 LCD Module: Displays sensor status messages.
LEDs: Visual indicators for sensor activation.
LED Indicator: Used for additional output feedback.
System Design
4
PIR Sensor Functionality: Detects motion and triggers an LED to indicate activity.
Displays "Motion detected!" or "Motion ended!" on the LCD based on sensor state.
IR Sensor Functionality: Detects obstacles or proximity.
Updates the LCD with the current IR sensor status (1 for detected, 0 for not detected).
Controls an LED to indicate the sensor's state.
LCD Display: Initialized with a welcome message.
Continuously updates to display the status of both sensors.
Connections:
PIR Sensor: Output Pin connected to Pin 10 of the Arduino.
VCC connected to Arduino's 5V pin.
GND connected to Arduino's GND pin.
IR Sensor: Output Pin connected to Pin 8 of the Arduino.
VCC connected to Arduino's 5V pin.
GND connected to Arduino's GND pin.
LEDs: One LED connected to Pin 7 (PIR status).
Another LED connected to Pin 2 (IR status).
16x2 LCD: Pins 12, 11, 6, 5, 4, 3 connected to corresponding Arduino pins for control.
Arduino Code:
The provided code integrates the functionality of both the PIR and IR sensors, updating the
LCD and controlling LEDs based on sensor outputs. Key features include:
Separate functions for reading the PIR (pirSensor()) and IR (irSensor()) sensors.
Real-time updates to the LCD for motion and proximity status.
Visual feedback using LEDs.
5
Working Mechanism:
Initialization
The Arduino initializes the sensors, LCD, and LEDs.
Displays a welcome message on the LCD.
Sensor Data Processing:
The loop() function alternates between reading the PIR and IR sensors.
Each sensor's data is processed independently to ensure real-time response.
Output Control
PIR sensor: Detects motion and activates an LED while displaying the motion state on the
LCD.
IR sensor: Detects obstacles and activates an LED while displaying the sensor status on the
LCD.
Feedback:
LEDs provide immediate visual cues.
The LCD provides detailed feedback for both sensors.
Observations:
The system accurately detects motion and proximity.
The PIR sensor is responsive to movement, and the IR sensor effectively detects obstacles
within its range.
The 16x2 LCD provides real-time updates for both sensors, ensuring clear monitoring.
Applications:
Security Systems: Motion and obstacle detection for homes or offices.
Automation: Proximity-based controls for doors, lights, or appliances.
Robotics: Obstacle avoidance and environmental sensing.
6
CONCLUSION