0% found this document useful (0 votes)
16 views80 pages

Micro Controller

More notes

Uploaded by

millionmaver
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)
16 views80 pages

Micro Controller

More notes

Uploaded by

millionmaver
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/ 80

MICROCONTROLLER

Microcontrollers are a tiny, self-contained


computers but does not include any “human
interface” devices like keyboard or mouse. They
are often called as “computer on a chip” but
unlike general purpose computer, a
microcontroller is designed for control and
measurement applications. Another term for
microcontroller is “embedded chip”, because a
microcontroller are often built into, or embedded
to the device they control.
The control system is the brain of the
Mechatronic system. It gathers
information from its inputs (sensors
and switches) interprets that
information to control output devices
in the form of motors or displays based
on a user designed program. One type
of control system is the
Any device that controls, measures, stores,
calculates in digital form, chances are, it has
a microcontroller embedded inside.
Consumer products that use microcontrollers
includes cellular phones, cameras,
microwave oven, automobiles, video
recorders, television remote, washing
machines, are only just a few examples.
ARDUINO PLATFORM
BOARD
Arduino is an open-source prototyping
platform that gives you the ability to
design/develop interactive projects.
Projects like robots, clocks, custom
blinking lights, home automation and
digital display are just some of the
examples of what you can do with the
Arduino platform board.
There are variety of Arduino microcontroller
boards available in the market, this course will
be focusing on Arduino Uno. This is the most
popular Arduino board for students, hobbyists,
artist, designers, and anyone interested in
microcontrollers. It is designed to be simple
and easy to use. Arduino Uno can be operated
by anyone, from students, teachers, hobbyist
to the experts.
The Arduino Uno is based on an ATMega328
microcontroller. It has 14 digital input/output
pins (often called GPIO - General purpose
Input Output Pins) and 6 analog input pins.
The clock speed is 16 MHz. The RAM is at 2
kb and the flash memory used for storing
programs is at 32 kb. The Arduino Uno can
be connected via USB, battery or an AC-DC
adapter.
1.USB port – Provides
power to your Arduino
Board and communication
with your PC.
2.Reset button –
Restart stored program
in the memory.
3.RX and TX LEDs – LED
indicators for receiving and
transmitting data to your
computer. RX is for receiving
while TX is for transmitting.
4.Digital pins – These are all labelled 0 to
13. These are all digital input and output
pins, meaning they are only capable of
outputting digital two states (HIGH and
LOW) or sensing voltage of 5 volts. six of
these pins are capable of doing Pulse Width
Modulation (PWM). Pin 13 has a built-in LED.
this is for Convenience and testing purposes
5.Analog in – These are input
pins that can detect voltages
between 0 to 5 volts. They can
also have an output value of
between 0 to 1023.
6.ATmega
microcontroller
7.5V and ground pins
– Provide power at 5V
and ground
8.External power supply – Can
be used to power the board
with a 7-12 V power supply or
battery (For standalone
applications without PC USB
ARDUINO IDE
The Arduino Integrated
Development Environment (IDE)
is simply a free software(open
source) developed by Arduino to
program microcontroller.
Interface of the
Arduino software.
A sketch is the name that
Arduino uses for a program. It
is the unit of code, that is
uploaded to and run on an
Arduino board.
Verify - Before sketch can be sent to
the prototyping board, it needs to
be converted into set of instructions
that the board understands. This
process is called verifying
New Sketch - opens new
window to create new
sketch.
Open - Opening existing
sketch. This loads a
sketch from a save file
on your computer.
Save - saves changes on
your sketch.
Upload - This compiles
and sends sketch to your
board.
Serial Monitor - A
monitor used for serial
communication.
Tab menu - Lets you
create multiple sketch in
IDE. Usually used in
advance programming.
Sketch Editor - This is
where you write/ edit
sketches.
Text Console - Shows you the
status of sketch after
verifying. This is also where
error message is displayed.
Line number - Shows
you what line number
your cursor is on.
PROGRAMMING
The Arduino’s IDE programs are
similar to the C language. Many C
principles are used in programming
the Arduino, if you have no
background in C programming
language you don’t need to worry
that much as the proficiency levels
COMMENT
Comments are how you explain or
inform people reading your sketch
on what it does. It is a good practice
to put comment on your sketches,
in case you forgot how the sketch
functions.
For single line comments, just add
two forward slashes(//)and this
line will be ignored by the
compiler. For more than one line
comment use /* at the start of the
comment and end it with */.
VARIABLES
Variables are used to
label and store a piece of
data.
This provides us simple way to access, save
and change information. You can declare a
variable in different parts of the sketch
depending on where
do you want to use it, but often it is placed
at the first few lines. Names of variables
must be starting with a character (does not
matter if it is in Capital letters or small
letters) and not with an integer.
Types Variable
int: a 16-bit integer. Storing integer
means storing whole numbers. It
can hold positive and negative
whole numbers ranging from -32768
to 32767.
char: an 8-bit variable. Storing
char means storing letters.
Interprets as a character like
‘a’ or ‘!’.
byte: an 8-bit variable
representing a number
between 0 and 255.
boolean: also 8 - bit
variable that can only
hold the values High or
Low.
long: a 32-bit integer. Allows
us to store values between -
2,147,483,648 to
2,147,483,648.
float: also a 32- bit variable, that
is used in complicated math since
it can store numbers with decimal
places. Once the variable is
initialized , you won’t need to
refer to it using int, just its name.
FUNCTIONS
A function text changes to color
orange(if your IDE version is 1.6.0 and
below) or blue ( IDE version 1.6.3)
when typed correctly, It is then
followed by a bracket or semi colon.
Almost all functions needed user input
to have the desired outcome of the
functions, so it is must placed within
MATERIALS:
Arduino IDE
Arduino Board
A-to-B USB cable
Breadboard
LED
220 ohms resistor
Jumping wire
Windows will attempt to install drivers for
Arduino but it will fail.

Click on Start ► Control Panel ► Systems and


Security ► Device Manager

For windows 8 and 10: swipe in the right edge


of the screen and then tap Search then search
for Device Manager
Look for the Port where the Arduino is
plug.

In Device Manager, look under Ports


(COM & LPT) ► Communication Ports
►“right click” Update Driver software
Update Arduino software

Choose the “browse my computer for driver


software” option.

Browse to where you extracted the


downloaded files of Arduino IDE ► click next
and close.
Open Arduino IDE located in your
desktop and choose your
microcontroller platform.

Upon Opening the Arduino IDE


click on Tools ► Board ► Arduino
Uno
Choose Serial Port

Tools ► Serial Port ► COM PORT where


your Arduino is located.

Note: you can check it in the device


manager
Connecting Wires
Unplug the Arduino from the computer
and wire the following materials like what
you see the picture. Connect the positive
end of LED (longer leg) to a 220 ohm
resistor then to Pin 13 and the ground
( shorter) to GND of the Arduino board.
Materials Needed:
LED
BREADBOARD
220 ohm resistor
Jumper wires
Open Sketch

Plug the Arduino board to the computer.

From the Arduino IDE, open the blink sketch


sample.

File ► Examples ► Basics ► Blink


Verify and Compile the
Verify the sketch
sketchby clicking the
verify icon at the Tab.
Once you have completed the code,
click the upload icon to send the
program to the Arduino board for
implementation.
Congratulations!
You have successfully built
and implemented your first
Arduino system and
program.

You might also like