Unit 5
Unit 5
Definition: A system designed with the embedding of hardware and software together for a
specific function with a larger area is embedded system design. In embedded system design, a
microcontroller plays a vital role.
Embedded Design
•  Processor
•  Microprocessor
•  Microcontroller
•  Digital signal processor.
Steps in the Embedded System Design Process
The different steps in the embedded system design flow/flow diagram include the following.
Embedded design – process – steps
Abstraction
Proper knowledge of hardware and software to be known before starting any design process.
Extra functions to be implemented are to be understood completely from the main design.
System Related Family of Design
When designing a system, one should refer to a previous system-related family of design.
Modular Design
Separate module designs must be made so that they can be used later on when required.
Mapping
Based on software mapping is done. For example, data flow and program flow are mapped into
one.
In user interface design it depends on user requirements, environment analysis and function of
the system. For example, on a mobile phone if we want to reduce the power consumption of
mobile phones we take care of other parameters, so that power consumption can be reduced.
Refinement
Every component and module must be refined appropriately so that the software team can
understand.
• Control Hierarchy
• Partition of structure
• Data structure and hierarchy
• Software Procedure.
Embedded System Design Software Development Process Activities
There are various design metric required to design any system to function properly, they are
Specifications
Proper specifications are to be made so that the customer who uses the product can go through
the specification of the product and use it without any confusion. Designers mainly focus on
specifications like hardware, design constraints, life cycle period, resultant system behavior.
Architecture
In this layer, components design is done. Components like single process processor, memories-
RAM/ROM, peripheral devices, buses..etc.
System Integration
In this layer, all the components are integrated into the system and tested whether its meeting
designers, expectations.
While designing any embedded system, designers face lots of challenges like as follows,
• Environment adaptability
• Power consumption
• Area occupied
• Packaging and integration
• Updating in hardware and software
• Security
• There are various challenges the designers face while testing the design like Embedded
  hardware testing, Verification stage, Validation Maintainability.
Embedded System Design Examples
The design function of ACVM is to provide chocolate to the child whenever the child inserts a
coin into ACVM.
Design Steps
1. Requirements
2. Specifications
3. Hardware and software functioning.
Requirements
When a child inserts a coin into the machine and selects the particular chocolate that he wants to
purchase.
Inputs
•     Chocolate
•     Refund
•     A message is displayed on LCD like date, time, welcome message.
    System Function
•  Using a graphical user interface, the child commands to the system which chocolate the child
   wants to purchase.
• Where the graphical user interface has an LCD, keypad, touch screen.
• The machine delivers the chocolate when the child inserts the coin if the coins inserted are
   excess than the actual cost of selected chocolate. The ACVM machine refunds the money
   back.
• Using a Universal synchronous bus, the owner of the ACVM can keep track of client location.
 Design Metrics
Power Dissipation
The design should be made as per display size and mechanical components.
Process Deadline
Timmer must be set, so that whenever the child inserts the coin the ACVM must respond within
few seconds in delivering the chocolates and refunding if excess.
For example, if the response time is 10seconds, the ACVM should deliver the chocolate and
refund the money if excess within 10 seconds as soon as the child inserts the coin and place a
request for chocolate.
Specifications
From the below ACVM system, when the child inserts the coin. The coins get segregated
according to the ports presented, Port1, Port2, Port5. On receiving coin an interrupt is generated
by the port, this interrupt is sent to reading the amount value and increasing.
Automatic – chocolate – vending – machine
An LCD present here displays the messages like cost, time, welcome..etc. A port delivery exists
where the chocolates are collected.
Hardware
•   Microcontroller 8051
•   64 KB RAM and 8MB ROM
•   64 KB Flash memory
•   Keypad
•   Mechanical coin sorter
•   Chocolate channel
•   Coin channel
•   USB wireless modem
•   Power supply
    Software of ACVM
 Many programs have to be written so that they can be reprogrammed when required in RAM
/ROM like,
                                                                              hardware-
architecture-block-diagram-of-active
IoT applications enable the exchange of information between interconnected devices through the
internet, without any human intervention involved. These cloud-based software as a service
(SaaS) apps serve as a bridge between IoT devices and the internet, facilitating the gathering,
analysis, and interpretation of data generated by the hardware.
Engineering apps for IoT devices is called IoT application development, or machine-to-machine
(M2M) application development.
This depends upon the target audience of your IoT software and devices. These platforms offer
APIs which allow app developers to interface with the hardware. Some examples of IoT
platforms are IBM’s Watson IoT, AWS IoT, and Cisco IoT Cloud Connect.
02 Selecting the hardware
This step necessitates selecting the hardware which will form the backbone of your IoT system.
You’ll have to choose the embedded sensors, actuators, processors, and transceivers.
03 Factoring in scalability
You need to ensure that the IoT apps you engineer scale automatically with the number of users
upon deployment. Scalability can be auto-accomplished by building your IoT apps on a cloud
platform like Zoho Creator, which scales automatically.
The hardware and software of your IoT network should function at low latency, to offer optimal
responsiveness and performance. High-speed connections are of the essence here.
As information processed over IoT networks is highly confidential and sent and accessed
through the public internet, security is a crucial factor. IoT apps need to be developed with
adherence to stringent security standards and protocols.
IoT application development is best accomplished when a cloud app development platform like
Zoho Creator is harnessed. This is because the cloud platform abstracts away the hardware
infrastructure, scalability, latency, and security from the developers.
Universal communication
IoT apps enable seamless communication between people, processes, and a wide varieties of
things which can connect and exchange data over the internet.
Access your information anywhere, at any time
IoT apps enable you to remotely access the information of your IoT devices whenever you need,
as they’re connected via the cloud.
Augmented automation
Rapid feedback
IoT apps and systems enable rapid fabrication and optimization of new products, due to the
continuous feedback received from their devices. This allows manufacturers to provide
immediate responses to constantly changing product demand.
Software developed for the Internet of Things have wide applications across a multitude of
industries. IoT apps can be deployed in sectors such as:
    Government
    Governments can deploy IoT apps in energy and resource networks, like power and water
    supplies. The feedback provided by deployed IoT apps can assist in quickly resolving any
    service outages.
    IoT apps can be of immense use in ensuring supply chain efficiency and logistics sustainability.
    Telematics provided by IoT apps can aid in the tracking of vehicles, and carrier routing can be
    accomplished by IoT sensors. Warehouses fitted with IoT sensors can also aid in monitoring
    storage conditions.
Healthcare
    This is a major industry benefited by IoT apps. Wearable smart IoT devices can assist people
    with monitoring their vital statistics, and healthcare professionals can assess the data gathered by
    wearables to ensure the well-being of their patients.
Automotive industry
    IoT devices can help in streamlining the manufacturing processes in automotive factories. IoT
    sensors can assist in foreseeing and preempting spare part failure, in real time, in vehicles. Self-
    driving technology in cars is also enhanced by IoT feedback.
•   Dashboard - This feature of the IoT system helps present some significant data, like your
    apartment's temperature or the availability of parking spaces.
•   User Account - Personalization is vital, so if you opt for custom app development (mobile or
    web apps), you can tailor the IoT systems according to your goals and preferences.
•   Notifications - This IoT app development feature helps provide the relevant info to the users
    keeping them up to date.
•   Onboarding - It helps users get familiar with the app’s user interface (UI) and important
    functionalities through a series of interactive displays.
•   Safety - It helps IoT solutions to be secure need as they're warehouses of a lot of sensitive
    information.
•   Customization - By creating device lists, templates, bookmarks, and templates, you can
    customize multiple things and personalize them while.
                                    Home Automation
Home automation is a technology that lets users create and trigger automatic functions for home
devices. That may be through schedules, rules, or scenes. With scheduled automations, for
example, you can make lights turn on at a certain time.
An advanced home automation project with Arduino Uno and Bluetooth sensor to control it,
anytime from anywhere.
LED (generic)
Arduino UNO
Temperature Sensor
Relay (generic)
Procedure
An Arduino UNO will control devices and reads sensor data. The figure "Room Architecture"
depicts how the Arduino UNO will connects with the devices and sensors. Room have multiple
controllable devices(i.e. Light(s), Fan, Wall Socket(s), etc.), one PassiveIR (to detect human
presence in the room), one temperature sensor (LM35 to collect room temperature) and LDR
(to detect light intensity near room window).
Servo Motors
Servo motors are geared DC motors with the closed-loop circuitry incorporated within them.
The basic configuration of a servo motor composed of a DC motor, gearbox, potentiometer and
control circuit.
DC motor is used to move a gearbox with a large reduction ratio. The final shaft imposes a
force on the external load and simultaneously acts on the axis of the feedback potentiometer.
So, the potentiometer senses the position of the axis and sends a corresponding voltage to an
operational amplifier. This voltage compared to the input voltage, that determines the desired
position of the shaft, producing a voltage in the output of the comparator. This voltage powers
the motor such that the shaft moves in the necessary direction to align with the angle that
corresponds to the voltage applied to the input.
                                    Servo motor configuration
LM35
A precision IC temperature sensor with its output proportional to the temperature (in oC). The
sensor circuitry is sealed and therefore it is not subjected to oxidation and other processes.
LM35 Configuration
PIR
The pin configuration of the PIR sensor is shown in the figure. PIR sensor consists of three
pins, ground, signal, and power at the side or bottom. Generally, the PIR sensor power is up to
5V, but, the large size PIR modules operate a relay instead of direct output.
                                        PIR Configuration
HC-05 (Bluetooth)
To make a link between your Arduino and bluetooth, do the following: 1) Go to the bluetooth
icon, right click and select Add a Device 2) Search for new device, Our bluetooth module will
appear as HC-05, and add it 3) The pairing code will be 1234. 4)after make a pairing, we can
now program the arduino and upload a sketch to send or receive data from Computer.
                                    HC-05 Configuration
Program:
#include<Servo.h> //servo
0Servo my;       //servo
void setup() {
Serial.begin(9600);
 pinMode(2,INPUT); //IR GATE FIRST
 pinMode(3,INPUT);
  my.attach(11); //servo
 if(y>44)
 {
 digitalWrite(7,1);
 }
 else
 {
 digitalWrite(7,0);
 delay(500);
 }
                        //TEMP
if(digitalRead(8)==HIGH)             //pir
 {
  digitalWrite(9,HIGH);
  }
 else
{ digitalWrite(9,LOW);}
    digitalWrite(trigPin, HIGH);     //ULTRA
   delayMicroseconds(10);
   digitalWrite(trigPin, LOW);
   duration = pulseIn(echoPin, HIGH);
   distance = (duration/2) / 29.1;
 if (distance >= 10 || distance <= 0)
 {
  digitalWrite(ledPin,LOW);
  }
 else
 {
 Serial.println("object detected \
83");
 Serial.print("distance= ");
  Serial.print(distance);
   digitalWrite(ledPin,HIGH);
  }                           //ULTRA
if(digitalRead(2)==HIGH)       //gate first
 {
  my.write(0);        //servo
 }
else
{
 my.write(90);            //servo
}
analogRead(5);         //ldr
 float a = analogRead(5);
Serial.println(a);
if (a <=200) {
  digitalWrite(4,1);
  Serial.println("LDR is DARK, LED is ON");
 }
 else {
  digitalWrite(4,0);
   Serial.println("-----");
} //ldr
if (Serial.available())                       //bluetooth
{
  val = Serial.read();
  Serial.println(val);
 if(val == 'TV')
 digitalWrite(3,HIGH);
       else if(val == 'tv')
       digitalWrite(3,LOW);
} //bluetooth
Output:
                                             Smart Agriculture
        The term smart agriculture refers to the usage of technologies like Internet of Things, sensors,
        location systems, robots and artificial intelligence on your farm. The ultimate goal is increasing
        the quality and quantity of the crops while optimizing the human labor used.
        Smart agriculture, also known as precision farming or smart farming, utilizes technology like the
        Internet of Things (IoT), sensors, robots, and AI to optimize agricultural operations. This
        approach aims to improve crop quality and yield, minimize resource use, and reduce
        environmental impact. It's a key strategy for addressing challenges like food security and
        sustainable agriculture.
              •   Arduino * 1
              •   moisture sensor * 1
              •   5v relay module * 1
              •   6v Mini water pump with small pipe * 1
              •   Connecting wires
              •   5v battery * 1
Circuit Diagram of the Arduino Automatic irrigation system
The complete circuit diagram for the Arduino Automatic irrigation system is shown below:
 The Arduino UNO is the brain of this whole project. It controls the motor pump according to
the moisture in the soil which is given by the moisture sensor.
To power the circuit, I am using an external Battery. You can use any 9v or 12-volt battery. The
battery is connected to the Vin and ground pins of Arduino and we can also connect the motor to
this battery via a relay. Moisture sensor output is connected to the analog pin of Arduino.
Program:
void setup() {
pinMode(3,OUTPUT); //output pin for relay board, this will sent signal to the relay
}
void loop() {
water = digitalRead(6); // reading the coming signal from the soil sensor
else
delay(400);
}
                                         Smart Cities
A smart city is an urban area that utilizes digital technologies and data analysis to improve
infrastructure, enhance citizen services, and promote sustainability.
•      Data-Driven Decisions:
Smart cities leverage data from various sources (sensors, cameras, citizen interactions) to make
informed decisions about infrastructure, resource management, and public services.
•      Improved Infrastructure:
This includes smart transportation systems (e.g., optimized traffic flow, public transit),
efficient water and waste management, and energy-efficient building technologies.
•      Enhanced Citizen Services:
Smart cities offer better access to government services, information, and utilities through
online platforms and mobile applications.
•      Sustainability and Environmental Protection:
Smart cities focus on reducing pollution, improving energy efficiency, and managing resources
sustainably.
•      Increased Efficiency:
Smart technologies can streamline operations, reduce costs, and improve the overall efficiency
of city services.
•      Economic Development:
Smart city initiatives can attract investment, create jobs, and stimulate economic growth.
Examples of Smart City Technologies:
Procedure:
• Arduino UNO,
• Jumper Wires,
• Servo Motor,
• Ultrasonic Sensor
• Arduino IDE
Ultrasonic Sensor: These are the sensor that use ultrasonic waves to detect objects or to measure
the distance between themselves and the object
Servo Motor: This is an electrical device that can push or pull and also rotate an object with great
precision. if you want to rotate an object at some specific angles or distance, then you use servo
motor. It is made up of a simple motor that runs through a servo mechanism. We can get a very
high torque servo motor in a small and light weight packages.
Block Diagram
The working of this Arduino smart dustbin is very simple. The ultrasonic sensor acts as the input
and the servo motor acts as the output, the Arduino UNO microcontroller is the main brain
behind the project. The block diagram for Arduino smart dustbin is shown below
The Arduino microcontroller constantly monitors the values from the ultrasonic sensor which is
placed outside the dustbin. When a person comes near the dustbin the values from the sensor
change, this change is noticed by the microcontroller, and it then turns the servo motor to open
the dustbin. After some time the controller turns the servo again in the opposite direction to close
the dustbin, then the whole process is repeated again.
Circuit Diagram
The image below shows the Arduino circuit diagram for building a smart bin. As you can see it
is very simple, it just has an ultrasonic sensor and a servo motor connected to the Arduino UNO,
and the whole setup is powered by a 9V battery.
        1. Preparation:
    •   Download and Install the Arduino IDE: If you haven't already, download and install the Arduino
        IDE from the official Arduino website.
    •   Connect your Arduino board: Connect your Arduino board to your computer using a USB cable.
    •   Install drivers (if needed): In some cases, you may need to install the appropriate drivers for your
        Arduino board to be recognized by your computer.
        2. Setting up the Arduino IDE:
#include <Servo.h>
const int trigPin = 9;
const int echoPin = 8;
const int servoPin = 3;
Servo lidServo;
long duration;
int distance;
void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  lidServo.attach(servoPin);
  lidServo.write(0); // Lid closed position
  Serial.begin(9600);
}
void loop() {
 // Trigger the ultrasonic sensor
 digitalWrite(trigPin, LOW);
 delayMicroseconds(2);
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);
    Serial.print("Distance: ");
    Serial.println(distance);
•      Data-driven insights:
Utilizing data analytics to identify trends, predict outcomes, and personalize treatment plans.
•      Remote monitoring:
Employing wearable devices and IoT sensors to continuously track patient health data from
remote locations.
•      AI-powered tools:
Leveraging AI algorithms to assist in diagnosis, treatment planning, and drug discovery.
•      Improved access:
Enhancing access to healthcare services, particularly for underserved populations, through
telehealth and mobile applications.
•      Patient-centered care:
Focusing on the patient's individual needs and preferences to provide more tailored and
proactive care.
•      Streamlined operations:
Optimizing hospital workflows, reducing administrative burdens, and improving resource
allocation.
•       Enhanced safety and security:
Implementing robust cyber security measures to protect patient data and ensure the reliability
of healthcare systems.
Examples of smart healthcare applications:
•      Wearable devices:
Tracking vital signs, activity levels, and sleep patterns to monitor patient health.
•      Smart pills:
Incorporating sensors to monitor medication adherence and track physiological data.
•      AI-powered diagnostic tools:
Assisting in the early detection of diseases by analyzing medical images or patient data.
•      Telehealth platforms:
Providing remote consultations and monitoring for patients in need.
•      Robotic surgery systems:
Enabling surgeons to perform complex procedures with greater precision and efficiency.
Benefits of smart healthcare:
Project:
Heartbeat Sensor is an electronic device that is used to measure the heart rate i.e. speed of the
heartbeat. Monitoring body temperature, heart rate and blood pressure are the basic things that
we do in order to keep us healthy.
Heart Rate can be monitored in two ways: one way is to manually check the pulse either at wrists
or neck and the other way is to use a Heartbeat Sensor.
• 16 x 2 LCD Display
• 10KΩ Potentiometer
• Push Button
• Mini Breadboard
•   Connecting Wires
Step 2: Circuit Diagram:
The circuit design of the Arduino based Heart rate monitor system using the Heartbeat Sensor is
very simple. First, in order to display the heartbeat readings in bpm, we have to connect a 16×2
LCD Display to the Arduino UNO.
The 4 data pins of the LCD Module (D4, D5, D6 and D7) are connected to Pins 1, 1, 1 and 1 of
the Arduino UNO. Also, a 10KΩ Potentiometer is connected to Pin 3 of LCD (contrast adjust
pin). The RS and E (Pins 3 and 5) of the LCD are connected to Pins 1 and 1 of the Arduino
UNO. Next, connect the output of the Heartbeat Sensor Module to the Analog Input Pin (Pin 1)
of Arduino.
The sensor comes with a 24″ flat ribbon cable with three male header connectors. The pinout is
shown in the figure below.
Connecting the Pulse Sensor to an Arduino is a breeze. You only need to connect three wires:
two for power and one for reading the sensor value.
The module can be supplied with either 3.3V or 5V. Positive voltage is connected to ‘+,’ while
ground is connected to ‘-.’ The third ‘S’ wire is the analog signal output from the sensor, which
will be connected to the Arduino’s A0 analog input.
The following is the wiring diagram for the Pulse Sensor experiments:
Library Installation
To run the following sketches, you must first install the ‘PulseSensor Playground’ library.
To install the library, navigate to Sketch > Include Library > Manage Libraries… Wait for the
Library Manager to download the libraries index and update the list of installed libraries.
Filter your search by entering ‘pulsesensor’.There should only be a single entry. Click on that
and then choose Install.
Pulse Sensor Example Sketches
The Pulse Sensor library includes several example sketches. We’ll go over a few of them here,
but you can also experiment with the others.
To access the example sketches, navigate to File > Examples > Pulse Sensor Playground.
You will see a selection of example sketches. You can choose any of them to load the sketch into
your IDE. Let’s start off with the GettingStartedProject.
int Signal;
int Threshold = 550;
void setup() {
          pinMode(LED_BUILTIN,OUTPUT);
Serial.begin(9600);         }
void loop() {
          Signal = analogRead(PULSE_SENSOR_PIN);
          Serial.println(Signal);