Microcontrollers
Microcontrollers
MICROCONTROLLERS
2
Microcontrollers
Microcontroller has a CPU, in addition with a fixed
amount of RAM, ROM and other peripherals all
embedded on a single chip.
It is also termed as a mini computer or a computer on
a single chip.
Microcontrollers are designed to perform specific
tasks.
3
Microprocessors
“
5
Why Microcontroller ?
◇ Compact- A microcontroller product has many
components on one chip and so is more compact.
◇ Speed - It has faster processing speed as all the
peripherals are there n a single chip.
◇ Cheaper - All the components on a microcontroller is
manufactured on a single chip and so is much
cheaper than having to manufacture several chips as
is the case for a microprocessor system.
6
What is Arduino?
It is a microcontroller. It is an open source
platform used for building electronics projects. It
consists of both a physical programmable circuit
board and a piece of software or IDE(Integrated
Development Environment) that runs on your
computer, used to write and upload code to the
physical board.
7
Different Types of Arduino Boards
1.Arduino UNO:
The UNO is the best board to get started with electronics and
coding. UNO is the most robust board you can start playing with.
“
The UNO is the most used and documented board of the whole
Arduino family.
8
2.Arduino Mega:
“
12
6.Red board Arduino:
“
15
“
16
“
17
“
18
“
19
“
20
“
21
“
22
SPI Communication
● SPI(10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK)) : These
pins support SPI (Serial Peripheral Interface)
communication using the SPI library.
Communicating with other peripheral devices
“
over short distances
23
Continued
Typically there are three lines common to all the devices:
“
data to the peripherals,
● SCK (Serial Clock) - The clock pulses which synchronize
data transmission generated by the master
“
● Technique of getting analog results with a digital means
● Signal switched between on and off
● Simulate voltage between 0 and 5 volts by
changing portion of time signal spends on versus
time signal spend off
● Duration of on time called pulse width
26
“
27
PWM signals of varying pulse width
“
28
PWM
“
29
Programming in Arduino IDE
“
30
“
31
“
32
“
33
“
34
“
35
Standard Functions
“
●Void setup
●Void loop
●Comments
36
Serial.println()
Serial.begin()
delay()
digitalWrite()
digitalWrite will set the specified pin to one of two states - HIGH/LOW,
analogWrite()
analogWrite() is used to write analog value to a pin.It does not take
negative values and its range is from 0 to 255.
Frequently Used Components
“
◆ Ultrasonic Sensor
◆ IR Sensor
◆ PIR Sensor
41
Motor Driver
“
direction control of two DC motors at the same time.
The module can drive DC motors that have voltages
between 5 and 35V, with a peak current up to 2A.
42
L298N
Pins
44
Servo Motor
“
an object with great precision.It is
used for rotating objects by small
angles.It uses feedback
mechanism and corrects the error
automatically, which is not the
case with other motors like the
DC motor.
45
Ultrasonic Sensor
“
46
Infrared(IR) Sensor
An infrared sensor is an
electronic device, that emits in
order to sense some aspects of
“
the surroundings.
47
PIR Sensor
“
radiating from objects in its field of
view.They are most often used in
PIR based motion detectors.
48
“
49
Line Following Bot
“
When light fall on a white surface it is almost full reflected
and in case of black surface light is completely absorbed.
This behavior of light is used in building a line follower
robot.
50
“
51
Working of Line Follower
52
53
54
55
“
56
Defining Inputs & Outputs
“
57
58
59
You Can Reach Out To Us At
/asmeiitr
asme.iitr.ac.in
61
ASSIGNMENT:
Write an arduino code for a bot that moves
between two walls maintaining equal distance
from each wall. Also enhance the code so that the
bot does not collide with the front wall.
62