Transcript Slide 1

EMS1EP Lecture 1
Intro to Arduino
Dr. Robert Ross
Overview
(what you should learn today)
• What this subject is all about (assessment,
labs, passing)
• Electronic components:
– Switches, LEDs, Resistors, Capacitors, Voltage
Regulators, Microcontrollers,
• The LArduino Development Board
Lecturer Details
Dr. Robert Ross
B.CS(Hons)/B.EE(Hons), PhD Robotics Field (La Trobe)
Email: [email protected]
Office: BG441
Phone: 9479 1593
Mr. Tommy Huynh (Lab demonstrator)
B.EE(Hons), Currently doing a PhD in Robotics
Email: [email protected]
Office: BG417
Phone: 9479 1898
Lectures Outline
• The project section of the subject has 6
lectures:
1.
2.
3.
4.
5.
6.
Intro
Digital Inputs
Digital Outputs
Program Flow + Serial Comms
Pulse Width Modulation (PWM)
Analog to Digital Conversion (ADC)
Laboratories Outline
• The project section of this subject has 11
laboratory classes (starting week 2):
1. Solder LArduino PCB
2. Digital Outputs
3. Digital Inputs
4. Debouncing Switches
5. PWM
6. ADC
7-8. Minor Project
9-11. Major Project
Calendar of classes
• Lectures for project section of course:
– Monday 11-12 (week 1,3,4,5,6,7)
• Labs for project
– Monday 3-5, Wed 11-1 (Every week starting week
2)
Assessment Outline
• Assessment for EMS1EP:
– 35% Laboratory
– 15% Oral Presentation
– 50% In-class test and report
• Of the 35%:
– Labs 1-6 are worth 8.3% each
– Minor project is worth 15%
– Major project is worth 35% (robot)
• A section of the in-class test will be related to the
project section
Video of final project
Multi-disciplined approach
• Australian Council of Engineering Deans report:
– Recommendation 3: Engineering schools must develop
best-practice engineering education, promote student
learning and deliver intended graduate outcomes.
Curriculum will be based on sound pedagogy, embrace
concepts of inclusivity and be adaptable to new
technologies and inter-disciplinary areas.
• Valuable to have skills outside your discipline
– Project application areas often involve other
disciplines
Questions on Assessment?
Electronic Components
• Electronic components:
– Switches
– LEDs
– Resistors
– Capacitors
– Voltage Regulators
– Microcontrollers
Switches and Buttons
• Switches and buttons allow
users to interact with
electronic systems
• Terms commonly used in place
of each other or sometimes
together (i.e. push button
switch)
• Purpose is to make and break
electrical circuits (shorts out
connection)
Switches and Buttons
Typically:
• Button:
– Button makes the electrical circuit only when pressed (e.g.
keyboard)
• Switch:
– Switch allows the making of the circuit to be toggled
(on/off) (or from one circuit to another) (e.g. light switch
LEDs (Light Emitting Diodes)
• LEDs are semiconductor light sources
• They are diodes (can only be used in one
direction)
• Require 1.6V – 3V to turn on
• Very bright LEDs are starting to be used
for room lighting
• 2 Legs:
– Longer leg goes to positive
– Shorter leg goes to ground
– At the base of the LED the shorter leg side is
flat not round
Resistors
• Has a specified value of
electrical resistance to
resist current flow
• Colour codes used to
decode the value of the
resistor
Capacitors
• Stores electrical energy
electrostatically in an electric
field
• Lots of different types of
capacitors
• Sometimes polarised (must be
connected the correct way
around) sometimes not
• Multiple uses:
– Blocking DC voltages
– Tuning radio frequencies
– Smoothing out power supplies
Voltage Regulators
• Maintain a constant voltage level
• Input voltage may vary but
output voltage should remain
constant (provided input is in
correct range)
• Fixed v’s Adjustable
• Linear v’s Switched
Microcontrollers
• Programmable devices which include a CPU (Central
Processing Unit) and some other devices (ADC,
Timers, ect.)
• Looks like a silicon chip with lots of pins
• Microcontrollers often sense data, process the data
and then control something using their pins to
connect to the outside world
What is an Arduino?
• Open-source electronics prototyping platform
• Simple to use software and hardware
• Software has useful, easy libraries which can
be used
• Hardware based on AVR
microcontroller with a bootloader
Why use Arduino?
•
•
•
•
Good libraries – quick to prototype
Easy to learn
Good for general purpose applications
Comparatively cheap prototype
Some Arduino References
• “Arduino Cookbook”. Michael Margolis,
O’Reilly, 2011
• http://www.arduino.cc/
• http://www.ladyada.net/learn/arduino/
SOME ARDUINO
PROJECTS
So why doesn‘t everyone use Arduinos?
• Price
• Performance
• Not cross-platform
$100+
$40
$1+
LArduino Board
• Ardunio is open source – anyone is free to create and
publish their own hardware versions
• La Trobe Uni have created the LArduino
• Specs:
–
–
–
–
AT-Mega168 Microcontroller
16MHz Crystal
4 ADC Pins
7 Digital Pins (with 5 having PWM options for analog
output)
– Bootloader: Uno
– Program via USB Port
– Selectable USB/External power (external 6V)
LArduino Board
• Microcontroller specs:
– 16KB Flash Memory
– 1KB RAM
– Frequency: 20MHz max
– 8-bit CPU
– 8 channel, 10bit ADC
• Around the power of a 286 desktop computer
(circa. 1982)
Arduino IDE - Terminology
• Sketch – A program that you
write
• setup() – Function run once
when device started – used
for initialisations
• loop() – Infinite loop
function – runs forever
Verify (compile code)
Program device
Serial monitor
Arduino IDE – Setting up
• Before code is run a few things need to be setup
– Tools->Board->”Arduino Uno”
– Tools->Serial Port-> What is the Arduino plugged into?
• Easiest way to determine this is to unplug the arduino and check
the available ports
• Then plug the Arduino in and choose the new port that has
appeared
Free to download: http://arduino.cc/en/Main/Software
Summary
(What you learnt in this session)
• Where your marks will all come from
• Different electronic components
• Microcontrollers are small programmable
devices we write code for to control things
• Arduinos are microcontrollers with lots of
simple to use high level instructions
• With microcontrollers we are often controlling
the voltage levels on the actual pins between
high and low or reading these values