Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
27 views

Lecture 5 Course Project. Arduino Basics.: IAT267 Introduc:on To Technological Systems

The document discusses a lecture about the course project and Arduino basics. It provides an overview of the course assignments, the course project requirements and resources, and introduces some key concepts about Arduino including what it is, its components, capabilities, and how it can be used to create interactive projects. The lecture focuses on teaching students the fundamentals of using Arduino for prototyping systems that can sense environmental inputs and control physical outputs.

Uploaded by

Donald Adaba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Lecture 5 Course Project. Arduino Basics.: IAT267 Introduc:on To Technological Systems

The document discusses a lecture about the course project and Arduino basics. It provides an overview of the course assignments, the course project requirements and resources, and introduces some key concepts about Arduino including what it is, its components, capabilities, and how it can be used to create interactive projects. The lecture focuses on teaching students the fundamentals of using Arduino for prototyping systems that can sense environmental inputs and control physical outputs.

Uploaded by

Donald Adaba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Lecture

 5    
Course  project.    
Arduino  basics.  
IAT267  Introduc:on  to  Technological  
Systems  

1  
Assignments    
•  Assignment  1:  due  today    
–  Answers  to  the  ques:ons  will  be  posted  by  the  
end  of  the  week  

•  Assignment  2:  Sensor  research  assignment    


–  Available  on  webct  
–  Due:  October  20,  2011  

2  
Course  Project  
•  See  the  ‘Course  Project’  folder  on  webct  

–  Project  descrip:on  
–  Project  teams  –  sign-­‐up  
–  Resources  
–  Sample  student  projects  from  past  years  
–  Milestones  –  each  milestone  has  a  small  
deliverable  

3  
Lecture  Topics  for  Today  

•  Arduino  basics  
–  What  is  Arduino  
–  Arduino  family  of  tools  
–  How  to  use  Arduino    
•  Workshop  this  week:  hands-­‐on  ac:vity  using  Arduino  

4  
Arduino  Basics  

5  
What  is  Arduino?    

6  
Arduino:  3  Separate  Tools  
•  1.  Arduino  controller  
–  The  hardware  

•  2.  Arduino  working  environment  


–  Simple  open  source  IDE  built  in  Java  

•  3.  Language  and  compiler  


–  Create  code  for  the  microcontroller  
7  
Arduino:  Extends  the  Computer  System  
•  Arduino  is  a  tool:  for  enabling  computers  to  
sense  and  control  more  of  the  physical  world  

•  Prototyping  pla\orm  

8  
Arduino:  Microcontroller  Board    
•  What  is  a  microcontroller:  Small,  inexpensive  
compu&ng  device  

•  Usually  employed  for  sensing  input  from  the  


real  world  and  controlling  devices  based  on  
that  input  

•  Easy  to  use  with  simple  sensors  and  output  


devices    
9  
10  
How  can  we  use  Arduino  
•  Arduino  can  be  used  to  develop  interac:ve  objects    

•  Taking  inputs  from  a  variety  of  switches  or  sensors  

•  Controlling  a  variety  of  lights,  motors,  and  other  


physical  outputs.    

11  
Arduino  Projects  
•  Arduino  projects  can  be  stand-­‐alone.  

•  Or  they  can  communicate  with  so`ware  running  on  


your  computer  (e.g.  Flash,  Processing,  MaxMSP).    

•  The  boards  can  be  assembled  by  hand  or  purchased  


preassembled.  

•  The  open-­‐source  IDE  can  be  downloaded  for  free.    

12  
Why  Use  Arduino?  (1)  
•  Inexpensive  

•  Cross-­‐pla\orm  -­‐  The  Arduino  so`ware  runs  on  


Windows,  Macintosh  OSX,  and  Linux  opera:ng  
systems.  Most  microcontroller  systems  are  
limited  to  Windows.    

•  Simple,  clear  programming  environment    

13  
Why  Use  Arduino?  (2)  
•  Programming  is  very  easy  /  quick  
–  Programmed  via  a  USB  cable,  not  serial  port.    

•  Ac:ve  community  of  users  online,  so  there  are  


lots  of  resources  available.  

14  
Arduino:  Open  Source  
•  Open  source  and  extensible  so+ware:  The  Arduino  so`ware  is  
published  as  an  open  source  tool,  available  for  extension  by  
experienced  programmers.    

•  Open  source  and  extensible  hardware  -­‐  The  Arduino  is  based  
on  Atmel's  ATMEGA8  and  ATMEGA168  microcontrollers.  The  
plans  for  the  modules  are  published  under  a  Crea:ve  
Commons  license,  so  experienced  circuit  designers  can  make  
their  own  version  of  the  module,  extending  it  and  improving  
it.  

15  
Open  Source  
•  Open  source  hardware  and  so+ware:    
–  if  you  wish  you  can  download  the  circuit  diagram,  
buy  all  the  components  and  make  your  own  board  
without  paying  anything  to  the  makers  of  Arduino  

16  
1.  Arduino  Board  

17  
To  Get  Started:    

18  
Hardware  

Arduino  Serial  
Arduino  BT  

Arduino  Mega  

19  
Arduino  Mini  

Arduino  Nano  

Arduino  Lilypad   20  
Source:  hip://todbot.com/  

21  
Diagram  of  the  Arduino  Board  

22  
Components  of  the  Arduino  Board  
•  Digital  inputs:  2  to  13  

•  Analog  inputs:  0  to  5  

•  Arduino  uses  the  Atmel  ATMega  microcontroller  


•  Has  a  USB  port  to  communicate  with  a  computer  
•  Reset  buion  
•  TX/RX  LEDs  
•  Connec:on  for  external  power  supply  (9-­‐12V  DC)  
23  
Capabili:es  of  Arduino  –  Arduino  UNO  

24  
What  is  a  pin?    
•  A  pin  provides  an  input  or  output  through  
which  the  controller  can  communicate  with  
components.    

•  Small  wires  can  be  inserted  into  the  pin  


connectors  

25  
LED  Connected  to  Pin  13  and  GND  

26  
Digital  vs.  analog  pins  
•  Digital  pins:    
–  Have  two  values  that  can  be  read  or  wriien  to  
them:  high  and  low  
•  High:  means  that  5  V  (Volts)  is  being  sent  either  from  
the  controller  or  from  a  component  
•  Low:  means  that  the  pin  is  at  0  Volts.  

–  Any  kind  of  binary  informa:on  can  be  read  or  


wriien  to  a  digital  pin.  

27  
Analog  Pins  
•  Can  have  a  wide  range  of  informa:on  sent  to  
them  (analog  pins  are  inputs)  
•  These  pins  are  what  we  use  to  input  
informa:on  that  has  a  range  of  values,  e.g.:    
–  The  posi:on  of  a  dial  
–  The  distance  of  an  object  from  an  infrared  sensor  

28  
2.  Arduino  programming  
environment  

29  
How  is  Arduino  programmed?    
•  Write  programs  on  your  PC  

•  Download  them  into  the  Arduino  board  

•  Arduino  board  can  then  be  used  by  itself  

30  
The  Arduino  IDE  

31  
Arduino  IDE  Menu  Op:ons  

32  
Development  Cycle  
•  Edit  code  

•  Compile  

•  Reset  board  

•  Upload  

33  
•  Run  buion:  does  not  in  fact  run  the  code;  it  
checks  for  errors  and  compiles  the  code  

•  Stop  buion:  stops  the  IDE  from  listening  on  


the  serial  port  

•  New  buion:  creates  a  new  applica:on  

•  Save:  saves  your  project  

34  
•  Upload  to  board:  actually  uploads  the  code  to  
the  board,  assuming  that  the  board  is  properly  
connected  and  all  the  drivers  are  properly  
installed  

•  Serial  communica&on:  opens  the  Serial  


Monitor  window  –  used  in  cases  when  we  
want  feedback  from  the  board  (data  sent  
serially  to  computer)  

35  
‘Sketch’  menu  of  the  toolbar  

36  
‘Sketch’  menu  of  the  toolbar  
•  Import  Library:  allows  you  to  import  
func:onality  from  a  library  created  for  a  
specific  purpose  
–  E.g.,  sound,  working  with  motors,  communica:on  
–  Can  be  either  the  default  libraries  that  come  with  
Arduino  or  a  library  that  you  have  created  yourself  
–  Line  that  appears  in  the  code  window:    
•   #include  <Stepper.h>  

37  
‘Sketch’  menu  of  the  toolbar  
•  Show  Sketch  Folder:  brings  up  the  folder  
where  all  your  applica:on  files  are  stored  
–  Helpful  if  you  want  to  check  if  a  certain  file  is  
present  (e.g.,  image  file)    
•  Add  File:  allows  you  to  select  a  file  from  
anywhere  in  your  opera:ng  system  and  save  it  
to  the  folder  where  your  applica:on  is  located  

38  
‘Tools’  menu  of  the  toolbar  

39  
‘Tools’  menu  of  the  toolbar  

•  Contains  menu  buions  for  selec:ng  the  


controller  and  port  on  which  the  board  is  
connected  to  the  computer  

•  Auto  Format:  formats  all  your  code  to  


standardize  the  indenta:ons  and  spacing  

40  
‘Tools’  menu  of  the  toolbar  
•  Copy  for  Forum:  copies  all  the  code  in  an  
applica:on  to  the  system  clipboard  if  your  
computer  in  an  HTML  format  so  that  it  can  be  
pasted  into  a  web  page  without  losing  
formaqng.  
•  Archive  Sketch:  .zip  file  for  your  applica:on  
•  Burn  Bootloader:  needed  only  if  you  are  
building  your  own  board.  

41  
Arduino  So`ware  

42  
43  
3.  The  Arduino  language  

(Wiring)  

44  
Example  Program:  Blink  
•  LED  connected  to  digital  pin  13  (we  choose  pin  
13  because  depending  on  your  Arduino  board,  
it  has  either  a  built-­‐in  LED  or  a  built-­‐in  resistor  
so  that  you  need  only  an  LED).    

•  LEDs  have  polarity,  which  means  they  will  only  


light  up  if  you  orient  the  legs  properly.  

45  
Circuit  

46  
The  code  

47  
Minimal  Code  

48  
setup()  
•  The  setup()  func:on  is  called  when  a  sketch  
starts.    
–  Use  it  to  ini:alize  variables,  pin  modes,  start  using  
libraries,  etc.    
–  The  setup  func:on  will  only  run  once,  a`er  each  
powerup  or  reset  of  the  Arduino  board.  

49  
loop()  
•  Loops  consecu:vely,  allowing  your  program  to  
change  and  respond.    

•  Use  it  to  ac:vely  control  the  Arduino  board.  

50  
Thank  you  

Ques:ons?  

51  

You might also like