Embedded System
Embedded System
Introduction:
These systems use microcontrollers or microprocessors, which are small computers on a chip,
to carry out their tasks. They have limited resources, such as memory and processing power,
and the software that runs them is typically written in C or C++.
You can find embedded systems in many everyday items. For example, they control the engine
in your car, manage your smartphone, operate washing machines, and run industrial robots.
They are also crucial in medical devices like pacemakers and diagnostic equipment.
The Internet of Things (IoT) connects everyday devices to the internet, allowing them
to collect and share data. These devices, equipped with sensors and software, can communicate
with each other and perform tasks automatically.
Key Points:
Applications:
Components:
Future Trends:
1. IR SENSOR
2. FLAME SENSOR
3. MOISTURE SENSOR
4. RAIN SENSOR
5. GAS SENSOR
6. ULTRASONIC SENSOR
7. VOLTAGE SENSOR
8. DHT11 SENSOR
9. GYRO SENSOR
10. 10.GPS
Controllers:
1. Arduino(atmega832p)
2. Nodemcu(esp8266)
ARDUINO(ATMEGA832P):
Key Features:
Arduino Boards:
Arduino IDE:
The Arduino IDE allows users to write code (called "sketches") and upload it to the Arduino
board. It supports various libraries that simplify coding for specific sensors and components.
Getting Started:
Applications:
NodeMCU is an open-source firmware and development kit that allows you to create
IoT (Internet of Things) applications. It’s based on the ESP8266 Wi-Fi module, which provides
an easy way to connect to the internet.
Key Features:
Hardware Overview:
ESP8266 Chip: The heart of NodeMCU, featuring a powerful microcontroller with Wi-
Fi capabilities.
GPIO Pins: Multiple General Purpose Input/Output pins for connecting sensors and
devices.
USB Interface: Typically has a micro USB port for easy power supply and
programming.
Getting Started:
Download the IDE: You can use the Arduino IDE or the NodeMCU firmware.
Connect the Board: Use a USB cable to connect NodeMCU to your computer.
Install Drivers: Ensure you have the necessary USB drivers installed.
Write Your Code: Use the IDE to write your program.
Upload: Upload your code to the NodeMCU board.
Applications:
An IR (Infrared) sensor is a device that detects infrared radiation, often used to measure
distance or proximity without physical contact.
Working Principle:
IR sensors work based on the principle that objects emit infrared radiation as heat. The
sensor detects this radiation and converts it into an electrical signal, which can be interpreted
to measure distance or presence.
Types of IR Sensors:
Detect changes in infrared radiation when an object passes in front of the sensor,
commonly used in motion detection systems.
Emit infrared radiation and then detect any reflection off an object to determine its
presence or distance.
Applications:
Proximity Sensing: Used in mobile phones and robotics for obstacle detection.
Motion Detection: Security systems, automatic doors, and lighting control.
Object Counting: In industrial applications to count objects passing through a point.
Advantages:
Limitations:
A flame sensor is a device that detects the presence of a flame. It's used to ensure safety
and proper operation in various applications. Here’s a simplified overview:
Common Uses:
Benefits:
Limitations:
Soil moisture sensors measure the water content in soil. They are crucial in
agriculture, landscaping, and environmental science for monitoring and managing soil health
and irrigation.
Principle: Measures the soil's dielectric permittivity, which varies with moisture content.
Principle: Measures electrical resistance between two probes inserted into the soil.
Principle: Measures the time it takes for an electromagnetic pulse to travel through the soil.
Advantages: Highly accurate and can measure over a range of soil types.
Applications:
Agriculture:
Irrigation Management: Helps farmers optimize watering schedules, reducing water usage
and improving crop yield.
Soil Health Monitoring: Ensures optimal moisture levels for different crops.
Gardening and Landscaping:
Environmental Monitoring:
Drought Prediction: Helps in assessing drought conditions and planning for water resources.
Research:
Soil Studies: Used in scientific research to study soil properties and behavior under different
moisture conditions.
Advantages:
Limitations:
A gas sensor detects the presence and concentration of gases in the air. These sensors
are vital for safety, environmental monitoring, and various industrial processes.
Principle: Uses a chemical reaction to produce an electrical signal proportional to the gas
concentration.
Principle: Uses ultraviolet light to ionize gas molecules, producing an electrical current
proportional to the concentration.
Applications:
1. Safety Systems:
2. Environmental Monitoring:
3. Industrial Processes:
4. Edical Applications:
Function: Monitor respiratory gases and detect specific gases for diagnosis.
Advantages:
An ultrasonic sensor measures distance using sound waves, commonly used for
obstacle detection, level sensing, and distance measurement in various applications.
Principle:
Sound Waves: Emits high-frequency sound waves (ultrasound) that are beyond the range of
human hearing (typically 20 kHz to 200 kHz).
Echo: The sensor sends out a sound wave and listens for the echo that bounces back from an
object.
Distance Calculation: The time taken for the echo to return is used to calculate the distance
to the object using the speed of sound (approximately 343 meters per second in air at room
temperature).
Components:
Transmitter: Emits the ultrasonic sound waves.
Transmitter: Emits the ultrasonic sound waves.
Control Circuit: Calculates the time interval between the emission and reception of the
sound wave to determine the distance.
Applications:
Level Sensing:
Water Tanks: Monitoring liquid levels.
Silos: Measuring levels of solids like grains.
Object Detection and Counting:
Conveyor Belts: Detecting and counting objects.
Advantages:
Limitations:
Principle:
Direct Measurement: Measures the voltage directly across two points in a circuit.
Indirect Measurement: Uses a transducer to convert voltage into a readable signal (e.g.,
voltage-to-frequency or voltage-to-current conversion).
Components:
Applications:
1. Power Systems:
2. Battery Management:
3. Industrial Automation:
4. Consumer Electronics:
5. Automotive Systems:
Advantages:
Limitations:
The DHT11 sensor is a popular, low-cost sensor used to measure temperature and
humidity. It is widely used in hobbyist projects, weather stations, home automation systems,
and various environmental monitoring applications due to its simplicity and ease of use.
Temperature Measurement:
Range: 0 to 50°C (32 to 122°F)
Accuracy: ±2°C
Humidity Measurement:
Range: 20% to 90% Relative Humidity (RH)
Accuracy: ±5% RH
Operating Voltage: 3.5V to 5.5V
Output: Digital signal via a single data pin
Sampling Rate: Approximately 1 reading per second (1 Hz)
Components:
1. Humidity Measurement: The DHT11 uses a capacitive humidity sensor to measure the
moisture in the air. The sensor contains a pair of electrodes with a moisture-holding substrate
between them. The capacitance changes with the humidity level, which the sensor converts into
a digital signal.
2. Temperature Measurement: The sensor uses a thermistor to measure the temperature.
The resistance of the thermistor changes with temperature, and this change is converted into a
digital signal.
3. Data Transmission: The DHT11 sensor uses a proprietary 1-wire protocol to transmit
the temperature and humidity data to a microcontroller or other receiving device.
Applications:
Advantages:
Limitations:
A gyroscope sensor (gyro sensor) measures the rate of rotation around an axis. It is
widely used in applications requiring precise motion sensing and control, such as in
smartphones, drones, gaming controllers, and robotics.
Principle:
Gyro sensors use the Coriolis effect to measure rotational movement. When the sensor is
rotated, the Coriolis force causes a displacement in the vibrating structure within the sensor,
which is detected and converted into a measurable signal.
Components:
Applications:
Function: Detects orientation and motion for screen rotation, gaming, and augmented reality
applications.
Benefit: Enhances user experience with intuitive motion controls.
Benefit: Ensures smooth and controlled flight for various aerial maneuvers.
3. Gaming Controllers:
4. Automotive Systems:
5. Robotics:
6. Wearable Devices:
Function: Tracks movement and orientation for fitness and health monitoring.
Benefit: Provides accurate motion tracking for health and fitness applications.
Advantages:
Limitations:
An LCD (Liquid Crystal Display) 16x2 module is a type of electronic display used frequently
in various applications, including embedded systems, for displaying alphanumeric characters.
The "16x2" specifies that the display has 16 columns and 2 rows, which means it can show 32
characters at a time. These modules are popular because they are relatively easy to interface
with microcontrollers and other digital electronics.
Character Display: Each character is displayed within a 5x8 or 5x10 pixel matrix.
Controller IC: Typically, they use a Hitachi HD44780 or a compatible controller.
Backlight: Many models come with a backlight for better visibility in low-light
conditions.
Interface: They can be interfaced using either 4-bit or 8-bit parallel communication.
Customization: Allows for the creation of custom characters.
Pin Configuration:
A typical 16x2 LCD module has 16 pins, with the following functions:
VSS: Ground
VDD: +5V Power Supply
V0: Contrast Adjustment
RS: Register Select (0 = Instruction Register; 1 = Data Register)
RW: Read/Write (0 = Write; 1 = Read)
E: Enable Signal
7-14. D0-D7: Data Pins
A: LED+ (Backlight Anode)
K: LED- (Backlight Cathode)
Interfacing with a Microcontroller (e.g., Arduino):
Here's an example of how to connect and use a 16x2 LCD with an Arduino:
Wiring:
VSS to GND
VDD to 5V
V0 to a 10k potentiometer (for contrast adjustment)
RS to Arduino Pin 12
RW to GND
E to Arduino Pin 11
D4-D7 to Arduino Pins 5, 4, 3, 2 respectively
A to 5V (with a current-limiting resistor)
K to GND
Applications:
IRSENSOR:
const int ledPin = 13; // Built-in LED pin (you can connect an external LED to another pin
if you prefer)
void setup() {
void loop() {
if (sensorValue == LOW) { // When the sensor detects an object (most IR sensors output LOW
when an object is detected)
} else {
}
FLAME SENSOR:
const int ledPin = 13; // Built-in LED pin (you can connect an external LED to another pin
if you prefer)
void setup() {
void loop() {
int sensorValue = digitalRead(flameSensorPin); // Read the value from the flame sensor
if (sensorValue == LOW) { // When the sensor detects a flame (most flame sensors output
LOW when a flame is detected)
} else {
}
MOISTURE SENSOR:
const int ledPin = 13; // Built-in LED pin (you can connect an external LED to another
pin if you prefer)
void setup() {
void loop() {
int sensorValue = analogRead(moistureSensorPin); // Read the value from the moisture sensor
// Assume a threshold value of 300 for dry soil, adjust according to your sensor
Serial.println("Soil is dry!");
} else {
Serial.println("Soil is moist.");
}
RAIN SENSOR :
const int ledPin = 13; // Built-in LED pin (you can connect an external LED to another pin
if you prefer)
void setup() {
void loop() {
int sensorValue = digitalRead(rainSensorPin); // Read the value from the rain sensor
if (sensorValue == LOW) { // When the sensor detects rain (most rain sensors output LOW
when rain is detected)
} else {
}
GAS SENSOR :
const int ledPin = 13; // Built-in LED pin (you can connect an external LED to another pin
if you prefer)
void setup() {
void loop() {
int sensorValue = digitalRead(gasSensorPin); // Read the value from the gas sensor
if (sensorValue == LOW) { // When the sensor detects gas (most gas sensors output LOW
when gas is detected)
} else {
}
ULTRASONIC SENSOR
int sensorValue = 0;
void setup() {
Serial.begin(9600);
pinMode(irSensorPin, INPUT);
pinMode(ledPin, OUTPUT);
void loop() {
sensorValue = digitalRead(irSensorPin);
// Print the sensor value to the serial monitor
Serial.println(sensorValue);
if (sensorValue == HIGH) {
} else {
delay(100);
}
VOLTAGE SENSOR;
#define VOLTAGE_SENSOR_PIN A0
void setup() {
Serial.begin(9600);
void loop() {
Serial.print("Voltage: ");
Serial.print(actualVoltage);
Serial.println(" V");
}
DHT11 SENSOR
#include "DHT.h"
void setup() {
Serial.begin(9600);
dht.begin();
void loop() {
delay(2000);
return;
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.print(" °C ");
Serial.print(temperatureF);
Serial.print(" °F\t");
Serial.print(heatIndex);
Serial.print(" °F ");
Serial.print(heatIndexC);
Serial.println(" °C");
}
GYRO SENSOR
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup() {
Serial.begin(9600);
// Initialize MPU-6050
Serial.println("Initializing MPU-6050...");
mpu.initialize();
if (mpu.testConnection()) {
} else {
void loop() {
delay(500);
}
LCD
#include <LiquidCrystal.h>
void setup() {
lcd.begin(16, 2);
lcd.print("Hello, World!");
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis() / 1000);