Arduino: Introduction To Microcontrollers

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 32

INTRODUCTION TO

ARDUINO
MICROCONTROLLERS

…………………………………………………..
Overview
 Background
 Microcontroller definition/Why ARDUINO's?
 Types of ARDUINO microcontrollers
 What To Get (Hardware and Software)
 ARDUINO C
 Electronic Circuits
 Projects
 Blinking light(s)
 Reading inputs (variable resistors)
MICROCONTROLLER
 A microcontroller is basically a small-scale
computer with generalized (and programmable)
inputs and outputs.
 The inputs and outputs can be manipulated by and
can manipulate the physical world.
History Of ARDUINO
 ARDUINO started in 2005 as a project for students at
the Interaction Design Institute Ivrea in Ivrea, Italy.
At that time program students used a "BASIC Stamp"
at a cost of $100, considered expensive for students.
Massimo Banzi, one of the founders, taught at Ivrea.
 A hardware thesis was contributed for a wiring design
by Colombian student Hernando Barragan. After
the Wiring platform was complete, researchers
worked to make it lighter, less expensive, and
available to the open source community.
WHAT IS ARDUINO?
 ARDUINO is an open-source electronics prototyping
platform based on flexible, easy-to-use hardware and
software. It's intended for artists, designers, hobbyists,
and anyone interested in creating interactive objects or
environments.(OFFICIAL DEFINITION)
 ARDUINO is a tool for making computers that can sense
and control more of the physical world than your desktop
computer. It's an open-source physical computing
platform based on a simple microcontroller board, and a
development environment for writing software for the
board.
WHY ARDUINO?
 Inexpensive - ARDUINO boards are relatively inexpensive
compared to other microcontroller platforms.
 Cross-platform - The ARDUINO software runs on Windows,
Macintosh OSX, and Linux operating systems. Most
microcontroller systems are limited to Windows.
 Simple, clear programming environment - The ARDUINO
programming environment is easy-to-use for beginners, yet
flexible enough for advanced users to take advantage of as well.
For teachers, it's conveniently based on the Processing
programming environment, so students learning to program in that
environment will be familiar with the look and feel of ARDUINO.
……………CONTINOUE
 Open source and extensible software- The
ARDUINO software is published as open source
tools, available for extension by experienced
programmers. The language can be expanded
through C++ libraries, and people wanting to
understand the technical details can make the leap
from ARDUINO to the AVR C programming
language on which it's based. Similarly, you can add
AVR-C code directly into your ARDUINO
programs if you want to.
ARDUINO Types
 Leonardo
 Due
 Micro
 LilyPad
 Esplora
 Uno
 NG
Leonardo
 Compared to the Uno, a slight upgrade.
 Built in USB compatibility
Presents to PC as a mouse or keyboard
 Bugs?
Due
 Much faster processor, many more pins
 Operates on 3.3 volts
 Similar to the Mega
Micro
 When size matters: Micro, Nano, Mini
 Includes all functionality of the Leonardo
 Easily usable on a breadboard
LilyPad
 LilyPad is popular for clothing-based projects.
Esplora
 Game controller
 Includes joystick, four buttons, linear potentiometer
(slider), microphone, light sensor, temperature
sensor, three-axis accelerometer.
 Not the standard set of IO pins.
Mega
 Compared to the Uno, the Mega:
 Many more communication pins
 More memory
 Some interface hardware doesn't work
ARDUINO Uno
 The pins are in three groups:
 Invented in 2010
 14 digital pins
 6 analog pins
 power
ARDUINO UNO
 Use For Auto-Reset Function
Where to Start
 Get an ARDUINO (starter kit)
 Download the compiler
 Connect the controller
 Configure the compiler
 Connect the circuit
 Write the program
 Get frustrated/Debug/Get it to work
 Get excited and immediately start next project
(sleep is for wimps)
What to Get – My Recommendation

 Required: Good Idea:


 ARDUINO (such as NG) Capacitors
Transistors
 USB A-B (printer) cable DC motor/servo
 Breadboard Relay
 Hookup wire
 LED's  Advanced:
 Resistors  Soldering iron & solder
 Sensors  Heat shrink tubing
 Switches  9V battery adapter
 Bench power supply
What We Need?
 ARDUINO(Starter kit)
• Hardware
• Software(ARDUINO IDE)
Configuring the ARDUINO
Compiler
 Defaults to COM1, will probably need to change
the COM port setting (my work PC ).
 Appears in Device Manager under Ports as a
Comm port.
ARDUINO Program Development
 Based on C++ without 80% of the instructions.
 A handful of new commands.
 Programs are called 'sketches'.
 Sketches need two functions:
 void setup( )
 void loop( )
 setup( ) runs first and once.
 loop( ) runs over and over, until power is lost or a
new sketch is loaded.
ARDUINO C
 ARDUINO sketches are centered around the pins
on an ARDUINO board.
 ARDUINO sketches always loop.
 void loop( ) {} is equivalent to while(1) { }
 The pins can be thought of as global variables.
ARDUINO C Specific Functions
 pinMode(pin, mode)
Designates the specified pin for input or output
 digitalWrite(pin, value)
Sends a voltage level to the designated pin
 digitalRead(pin)
Reads the current voltage level from the designated pin
 analog versions of above
 analogRead's range is 0 to 1023
 serial commands
 print, println, write
Compiler Features

 Numerous sample
sketches are included in
the compiler
 Located under File,

Examples
 Once a sketch is written,

it is uploaded by clicking
on File, Upload, or by
pressing <Ctrl> U
ARDUINO C is Derived from C++

These programs blink an LED on pin 13


 avr-libc  ARDUINO C
#include <avr/io.h> void setup( ) {
#include <util/delay.h>
pinMode(13, OUTPUT);
int main(void) { }
while (1) {
PORTB = 0x20; void loop( ) {
_delay_ms(1000); digitalWrite(13, HIGH);
PORTB = 0x00;
delay(1000);
_delay_ms(1000);
}
digitalWrite(13, LOW);
return 1; delay(1000);
} }
Basic Electric Circuit
 Every circuit (electric or electronic) must have at
least a power source and a load.
 The simplest circuit is a light.
 Plug in the light, and it lights up.
 Unplug it, the light goes out.
 Electricity flows from the power source, through
the load (the light) and then back to the power
source.
Basic LED Circuit
 Connect the positive (+) lead of a power
source to the long leg of an LED.
 Connect other leg of the LED to a resistor.
 High resistance means a darker light.
 Low resistance means brighter light.
 No resistance means a burned out LED.
 Connect other leg of the resistor to the
negative lead of the power source.
void setup( ) {
Connected to one Connected to other
pinMode(13, OUTPUT); end of the circuit end of the circuit
}
void loop( ) {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Shields
 Shields are circuit boards that plug into the top of
an ARDUINO.
 They extend the capabilities of an ARDUINO.
 Examples:
 Ethernet
 GPS
 Motor
 Prototype
 shieldlist.org
Conclusion
 The ARDUINO microcontroller is a low cost way
to enter into the hobby of robotics.
 The ARDUINO has two plusses over any other:
 The user community
 Extensive online library of code and projects
 Viewed as the "base" system, upon which all other
microcontrollers are built. Compatibility.
 So get a kit, and start ushering in the inevitable
takeover of our robotic overlords!
Projects:

 LED Interfacing
 Counters
 Distance measurement
 LCD displays
 Serial Communication
 Motor Interfacing
IN G
PAY
FO R
T O U
A N K N
TH T I O
E N
ATT

You might also like