Embedded System Unit 3
Embedded System Unit 3
Applications
There are hundreds of applications for ATMEGA328P:
The program or code written in the Arduino IDE is often called as sketching. We need to connect the
Genuino and Arduino board with the IDE to upload the sketch written in the Arduino IDE software. The
sketch is saved with the extension '.ino.
Toolbar Button
The icons displayed on the toolbar are New, Open, Save, Upload, and Verify
It is shown below:
Upload
The Upload button compiles and runs our code written on the screen. It further uploads the code to the
connected board. Before uploading the sketch, we need to make sure that the correct board and ports are
selected.
We also need a USB connection to connect the board and the computer. Once all the above measures
are done, click on the Upload button present on the toolbar.
Open
The Open button is used to open the already created file. The selected file will be opened in the current
window.
Save
The save button is used to save the current sketch or code.
New
It is used to create a new sketch or opens a new window
Verify
The Verify button is used to check the compilation error of the sketch or the written code.
Serial Monitor
The serial monitor button is present on the right corner of the toolbar. It opens the serial monitor.
Arduino Functions
The functions allow a programmer to divide a specific code into various sections, and each section
performs a particular task. The functions are created to perform a task multiple times in a program.
The function is a type of procedure that returns the area of code from which it is called.
For example, to repeat a task multiple times in code, we can use the same set of statements every time
the task is performed.
Advantages of using Functions
Let's discuss some advantages of using functions in programming, which are listed below:
It increases the readability of the code.
It conceives and organizes the program.
It reduces the chances of errors.
It makes the program compact and small.
It avoids the repetition of the set of statements or codes.
It allows us to divide a complex code or program into a simpler one.
The modification becomes easier with the help of functions in a program.
BUILT IN FUNCTIONS
The Arduino programming language comes with a huge array of built in functions that are useful for all
of our projects. These built in functions allow us to save time on the programming side of our builds.
We don't have to spend time developing our own functions, we can just use the ones that are
provided.The Arduino has two common functions setup() and loop(), which are called automatically in
the background. The code to be executed is written inside the curly braces within these functions. The
Arduino void setup and void loop functions are mandatory.
Void setup ()
void setup() - It includes the initial part of the code, which is executed only once. It is called as
the preparation block.
As the void setup function is called only once at the very beginning of the program, this will be the
place to:
Q5 Draw the pin Diagram of L293D motor Drive IC and explain function of each
pin?
Ans
Introduction: L293D Dual H-Bridge Motor Driver IC
L293D motor Driver IC is an integrated circuit that can drive two motors simultaneously and is usually
used to control the motors in an autonomous system. This motor driver IC enables us to drive a DC motor
in either direction and also control the speed of the motor.
L293D is a dual H-bridge motor driver IC. H-bridge is the simplest circuit for controlling a low current-
rated motor. One H-bridge is capable to drive a DC motor bidirectional. L293D is a current enhancing IC.
It can also act as a switching device.
The L293D is a 16-pin Integrated circuit, with eight pins, on each side, dedicated to the controlling of a
motor. There are 2 input pins, 2 output pins and 1 enable pin for each motor. The L293D IC is designed
to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. It is designed to
drive inductive loads such as relays, solenoids, DC & bipolar stepping motors, as well as other high-
current/high-voltage loads in positive-supply applications.
L293D motor Driver IC is one of the most popular drivers in the market. Because of several reasons such
as cheap price (compared to other drivers), easy control, proper shape and size, no need for protective
circuit and diodes, no need for heat sinks, and good resistance to temperature and high-speed variations,
L293D motor driver is mostly preferred driver to the user.
Features and Characteristics of L293D IC
The followings are the main features and specifications of the L293D Motor Driver IC.
Wide supply voltage range: 4.5V to 36V
Output current 600mA per channel
Peak Output Current 1.2A per channel
High-Noise-Immunity Inputs
Separate Input-Logic Supply
Internal Electrostatic Discharge (ESD) Protection
Pin 1 ( Enable1,2): When this pin is given High or Logic 1, the left part of the IC will work and
when it is low, the left part doesn’t work. So, this pin is the Master Control pin for the left part of
the IC
Pin 2 (Input 1): When this pin is High or Logic 1, output 1 becomes High. i.e. the current will
flow through output 1
Pin 3 (Output 1): This pin is connected to one of the terminal of motor 1
Pin 4, Pin 5 ( GND): These pins should be connected to the circuit’s ground
Pin 6 (Output 2): This pin is connected to one of the terminal of motor 1
Pin 7 (Input 2): When this pin is given High or Logic 1, output 2 becomes high i.e. the current
will flow through output 2
Pin 8 (VCC2): This is the voltage required to run the motor. It can be greater than IC voltage Vcc
1. If we are driving 12 V DC motors then make sure that this pin is supplied with 12 V
Pin 9 (Enable 3,4): When this pin is given High or logic 1, the right part of the IC will work, and
when it is low the right part doesn’t work. So, this pin is the Master Control pin for the right part
of the IC
Pin 10 (Input 3): When this pin is given High or Logic 1, output 3 becomes high i.e the current
will flow through output 3
Pin 11 (Output 3): This pin is connected to one of the terminal of motor 2
Pin 12,13 (GND): These pins should be connected to the circuit’s ground
Pin 14 (Output 4): This pin is connected to one of the terminals of motor 2
Pin 15 (Input 4): When this pin is given High or Logical 1, output 4 becomes High i.e. the
current will flow through output 4
Pin 16 (VCC1): This pin provides power to the IC. So, this pin should be supplied with a 5V
Logical Diagram
The logic diagram of L293D IC which presents an internal logic followed by an IC is shown in the figure
below.