28
EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Embed Size (px)

Citation preview

Page 1: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

EMS1EP Lecture 1Intro to Arduino

Dr. Robert Ross

Page 2: 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

Page 3: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Lecturer Details

Dr. Robert RossB.CS(Hons)/B.EE(Hons), PhD Robotics Field (La Trobe)Email: [email protected]: BG441Phone: 9479 1593

Mr. Tommy Huynh (Lab demonstrator)

B.EE(Hons), Currently doing a PhD in RoboticsEmail: [email protected]: BG417Phone: 9479 1898

Page 4: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Lectures Outline

• The project section of the subject has 6 lectures:1. Intro2. Digital Inputs3. Digital Outputs4. Program Flow + Serial Comms5. Pulse Width Modulation (PWM)6. Analog to Digital Conversion (ADC)

Page 5: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Laboratories Outline

• The project section of this subject has 11 laboratory classes (starting week 2):1. Solder LArduino PCB2. Digital Outputs3. Digital Inputs4. Debouncing Switches5. PWM6. ADC7-8. Minor Project9-11. Major Project

Page 6: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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)

Page 7: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 8: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Video of final project

Page 9: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 10: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Questions on Assessment?

Page 11: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Electronic Components

• Electronic components:– Switches– LEDs– Resistors– Capacitors– Voltage Regulators– Microcontrollers

Page 12: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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)

Page 13: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Switches and Buttons

Page 14: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 15: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Resistors

• Has a specified value of electrical resistance to resist current flow

• Colour codes used to decode the value of the resistor

Page 16: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 17: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 18: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 19: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 20: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Why use Arduino?

• Good libraries – quick to prototype• Easy to learn• Good for general purpose applications• Comparatively cheap prototype

Page 21: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

Some Arduino References

• “Arduino Cookbook”. Michael Margolis, O’Reilly, 2011

• http://www.arduino.cc/• http://www.ladyada.net/learn/arduino/

Page 23: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

So why doesn‘t everyone use Arduinos?

• Price• Performance• Not cross-platform

$40

$100+

$1+

Page 24: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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)

Page 25: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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)

Page 26: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Serial monitorProgram device

Verify (compile code)

Page 27: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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

Page 28: EMS1EP Lecture 1 Intro to Arduino Dr. Robert Ross

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