[go: up one dir, main page]

0% found this document useful (0 votes)
156 views62 pages

Microcontrollers

The document provides information about microcontrollers and Arduino boards. It discusses the key differences between microcontrollers and microprocessors, as well as the advantages of microcontrollers. It then describes what Arduino is and lists some common Arduino board types. It also explains how to program Arduino boards and covers some frequently used components and functions.

Uploaded by

pahul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
156 views62 pages

Microcontrollers

The document provides information about microcontrollers and Arduino boards. It discusses the key differences between microcontrollers and microprocessors, as well as the advantages of microcontrollers. It then describes what Arduino is and lists some common Arduino board types. It also explains how to program Arduino boards and covers some frequently used components and functions.

Uploaded by

pahul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62

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

Microprocessor is an IC which has only the CPU


inside it.

These microprocessors don't have RAM, ROM and


other peripheral on the chip. A system designer has to
add them externally to make them functional.
MicroProcessor vs MicroController


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:

The MEGA 2560 is designed for more complex


projects. It has more number of pins as compared to
Arduino UNO.
3.Arduino Mega ADK:
The Arduino Mega ADK has the same features as the
Arduino Mega board but it is specially designed to
work with Android.
4.Lily Pad Arduino:

The Lily Pad Arduino board is


a wearable e-textile
technology.
Each board was imaginatively
designed with huge
connecting pads & a smooth
back to let them to be sewn
into clothing using conductive
thread.
5.Arduino Nano:

The Arduino Nano is a compact board similar to the


UNO.It has relatively lesser number of pins .


12
6.Red board Arduino:

This type6 of Arduino has a special USB


port and a mobile’s USB cable can be used
for transferring the code.
Why Arduino?
● Easy to learn
● Wide array of sensors
● A large amount of projects
and resources that exist for
free (online)
● Easy to code as it uses C/ C++
language
● Arduino boards are
cheaper
Arduino UNO


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:

● MISO (Master In Slave Out) - The Slave line for sending


data to the master,
● MOSI (Master Out Slave In) - The Master line for sending


data to the peripherals,
● SCK (Serial Clock) - The clock pulses which synchronize
data transmission generated by the master

and one line specific for every device:

● SS (Slave Select) -When a device's Slave Select pin is low, it


communicates with the master. When it's high, it ignores
the master.
24
25
PWM:

PWM Pins (3,5,6,9,10,11)


● 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

◆ L298 Motor Driver


◆ Servo Motor


◆ Ultrasonic Sensor
◆ IR Sensor
◆ PIR Sensor

41
Motor Driver

The L298N - motor driver allows speed and


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

Input 1 and Input 2 pins are used for controlling


the rotation direction of the motor A

Input 3 and Input 4 pins are used for controlling


the rotation direction of the motor B

The Enable A and Enable B pins are used for


enabling and controlling the speed of the motor.

44
Servo Motor

A servo motor is an electrical


device which can push or rotate


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

An ultrasonic sensor is a device To measure the distance we


use to measure the distance from use the following formula
the object using sound waves. Distance = Speed*Time/2


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

A passive infrared sensor (PIR


sensor) is an electronic sensor that
measures infrared (IR) light


radiating from objects in its field of
view.They are most often used in
PIR based motion detectors.

48

49
Line Following Bot

Concept of working of line follower is related to light. We


use here the behavior of light at black and white surface.


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

“ Behind Advanced Composite Laboratory,


Dept. of Industrial Engineering,
Opp. Ravindra Bhawan

60 Mayur Lila (9602448000) Shubham Bihani (9079043528)


Useful Links
◇ https://circuitdigest.com/microcontroller-projects
/line-follower-robot-using-arduino
◇ https://howtomechatronics.com/tutorials/arduino
/arduino-dc-motor-control-tutorial-l298n-pwm-h-
bridge/
◇ https://tronixlabs.com.au/news/tutorial-l298n-du
al-motor-controller-module-2a-and-arduino/
◇ https://www.arduino.cc/reference/en/

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

You might also like