SlideShare a Scribd company logo
1 of 36
Download to read offline
   
Microcontroller
Programming Beginning
with Arduino
Charlie Mooney
   
Microcontrollers
 Tiny, self­contained computers in an IC
 Often contain peripherals
 Different packages availible
 Vast array of size and power availible
   
   
   
   
Sensory Input
 Robots need to be able to recieve input from the 
world in the form of sensory input.
 Microcontrollers handle this input.
 Thousands of sophisticated sensors availiable
   
Pressure/Force Sensors
   
GPS Locators
   
Gyroscopes
   
Wheel Encoders
   
Infared Proximity Detectors
   
Accelerometers
   
Ultrasonic Rangefinders
   
Alcohol Vapor Density
Detectors
   
Arduino
 Development board for the ATMega328
 Inludes
 Programmer,
 Voltage Regulators
 Seral to USB Converter
 CHEAP ­­ $30! Has everything you need!
   
Arduino C Template
void setup() {
  // Setup stuff to only run once at the beginning   
}
void loop()
{
  // This function gets called indefinatly
}
   
Peripherals
 Analog to Digital Converters (ADC)
 Counters/Timers (TMRx)
 PWM Modules (CCP/PWM)
 Serial Ports (UART)
 Many, many more....
   
Digital I/O
 Only HIGH and LOW values
 Each pin configurable to do input or output
 pinMode(pinNumber, pinState)
 pinMode(13, INPUT)
 pinMode(13, OUTPUT)
   
Digital I/O (Part II)
 Output
 digitalWrite(pinNumber, HIGH/LOW)
 Input
 int val = digitalRead(pinNumber)
   
Arduino Digital I/O Example
int ledPin =  13;
void setup() {
  // Set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}
void loop()
{
  // Bring the pin high (1)
  digitalWrite(ledPin, HIGH);
}
   
Serial Interface (UART)
 Communicate with other microcontrollers or PC's
 Asynch. communication
 Arduino libraries make it extremely easy
 Serial.begin(baudRate)
 Serial.println(”String To Send”)
 int bytesWaiting = Serial.Availible()
 Char incomingData = Serial.read()
   
Arduino Serial Example
void setup() {
Serial.begin(9600);  // Setup baud rate
}
void loop() {
Serial.println(”Give me input”);  // output data
while(Serial.availible() < 1) {     // if there's data waiting
char input = Serial.read();     // get a byte of data
}
}
   
Analog to Digital Converter
(ADC)
 Take analog voltage as input on one of the pins
 Return digital representation to program
 Different numbers of bits change precision.
   
   
   
Light Sensors
 Photoresistors
 Extremely Simple to Use
 Resistance changes with light
 Measure voltage over the sensor with
an ADC, and you're done
 Many more complicated sensors
simulate this behavior for simplicity
   
Arduino ADC Example
int sensorPin = 0;
void setup() {
  Serial.begin(9600); // Turn on Serial Connection
}
void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  
  // Print sensor value to the Serial
  Serial.println(sensorValue);
}
   
PWM Modules (CCP)
 Create PWM signals on output pins
 Measure PWM signals on input pins
 CCP stands for Capture/Compare
 What is PWM, anyway?
   
Pulse Width Modulation
(PWM)
 Transmit analog values using a single digital input/
output pin through careful timing.
 A PWM signal consists of two values
 Period: how long before the signal repeats
 Pulse Width: how long the signal is HIGH before it 
goes LOW.
 Duty Cycle: % of time the signal is HIGH, or
(Pulse Width / Period)
   
   
PWM In Robotics
 The average voltage (Duty Cycle * Voltage) can be 
used to control the speed of DC motors.
 Innaccurate, poor strength, braking, and other 
problems exist.
 Servo Motors and Speed Controllers.
   
Servo Motors
 DC Motor with gears allow for high torque
 Embedded microcontroller monitors PWM input 
and motor position.
 Vary pulse width to change position of motor
   
Speed Controllers
 Embedded microcontroller varies voltage on output 
lines based on PWM input.
 Results in constant voltage to motors rather than 
intermittent.
 Allow a second, more powerful, power supply to 
drive large motors.
 Alter pusle width to change the speed of the motor
   
Arduino PWM Command
 AnalogWrite(Pin, DutyCycle)
 DutyCycle = 0   0%, 127   50%, 255   100%→ → →
 Pin can be 3, 5, 6, 9, 10, or 11
 Frequency of about 490Htz
 Other periods are possible, but not with AnalogWrite
   
Arduino PWM Example
int Pin = 9;
void setup()
{
  pinMode(Pin, OUTPUT);
}
void loop()
{
  analogWrite(Pin, 127);  // Generate 50% duty cycle on ”Pin”
}
   
Useful Resources
 Robot Parts and Excellent Forums
www.TrossenRobotics.com
 Electrical parts, sensors, and microcontrollers
www.Sparkfun.com
 Arduino Development Platform
www.ardiono.cc

More Related Content

What's hot

Embedded systems الانظمة المدمجة
Embedded systems  الانظمة المدمجة Embedded systems  الانظمة المدمجة
Embedded systems الانظمة المدمجة salih mahmod
 
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...Faqih Fadhila Ardiansyah
 
Arduino presentation by_warishusain
Arduino presentation by_warishusainArduino presentation by_warishusain
Arduino presentation by_warishusainstudent
 
Arduino Microcontroller
Arduino MicrocontrollerArduino Microcontroller
Arduino MicrocontrollerShyam Mohan
 
Getting started with arduino workshop
Getting started with arduino workshopGetting started with arduino workshop
Getting started with arduino workshopSudar Muthu
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينوsalih mahmod
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (Dhruwank Vankawala
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerMujahid Hussain
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-pptjhcid
 
Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Sudar Muthu
 
What are the different types of arduino boards
What are the different types of arduino boardsWhat are the different types of arduino boards
What are the different types of arduino boardselprocus
 

What's hot (20)

Embedded systems الانظمة المدمجة
Embedded systems  الانظمة المدمجة Embedded systems  الانظمة المدمجة
Embedded systems الانظمة المدمجة
 
Arduino Uno Pin Description
Arduino Uno Pin DescriptionArduino Uno Pin Description
Arduino Uno Pin Description
 
Arduino uno
Arduino unoArduino uno
Arduino uno
 
PPT ON Arduino
PPT ON Arduino PPT ON Arduino
PPT ON Arduino
 
Robotics with arduino
Robotics  with arduinoRobotics  with arduino
Robotics with arduino
 
Different Arduino Boards
Different Arduino BoardsDifferent Arduino Boards
Different Arduino Boards
 
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors  B...
Smart Safety Door with Servo Motors as Actuators, Passcode and DHT Sensors B...
 
Arduino presentation by_warishusain
Arduino presentation by_warishusainArduino presentation by_warishusain
Arduino presentation by_warishusain
 
Presentation S4A
Presentation S4A Presentation S4A
Presentation S4A
 
Arduino Microcontroller
Arduino MicrocontrollerArduino Microcontroller
Arduino Microcontroller
 
Getting started with arduino workshop
Getting started with arduino workshopGetting started with arduino workshop
Getting started with arduino workshop
 
Lcd with arduino uno
Lcd with arduino unoLcd with arduino uno
Lcd with arduino uno
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Basics of open source embedded development board (
Basics of open source embedded development board (Basics of open source embedded development board (
Basics of open source embedded development board (
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-ppt
 
Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Arduino Robotics workshop Day1
Arduino Robotics workshop Day1
 
What are the different types of arduino boards
What are the different types of arduino boardsWhat are the different types of arduino boards
What are the different types of arduino boards
 
Report on arduino
Report on arduinoReport on arduino
Report on arduino
 

Similar to 2009 11-17-arduino-basics

Embedded systems optimization memory requirments.pptx
Embedded systems optimization memory requirments.pptxEmbedded systems optimization memory requirments.pptx
Embedded systems optimization memory requirments.pptxsatheeshKumar750
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxethannguyen1618
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfssusere5db05
 
introduction of arduino and node mcu
introduction of arduino and node mcuintroduction of arduino and node mcu
introduction of arduino and node mcu6305HASANBASARI
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixelssdcharle
 
Arduino_Beginner.pptx
Arduino_Beginner.pptxArduino_Beginner.pptx
Arduino_Beginner.pptxshivagoud45
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorssaritasapkal
 
Introduction to programming AVR microcontrollers
Introduction to programming AVR microcontrollersIntroduction to programming AVR microcontrollers
Introduction to programming AVR microcontrollersTristan Roddis
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slidesmkarlin14
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming FamiliarizationAmit Kumer Podder
 
Microcontroller from basic_to_advanced
Microcontroller from basic_to_advancedMicrocontroller from basic_to_advanced
Microcontroller from basic_to_advancedImran Sheikh
 

Similar to 2009 11-17-arduino-basics (20)

Embedded systems optimization memory requirments.pptx
Embedded systems optimization memory requirments.pptxEmbedded systems optimization memory requirments.pptx
Embedded systems optimization memory requirments.pptx
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 
Arduino course
Arduino courseArduino course
Arduino course
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
introduction of arduino and node mcu
introduction of arduino and node mcuintroduction of arduino and node mcu
introduction of arduino and node mcu
 
ARDUINO Presentation1.pptx
ARDUINO Presentation1.pptxARDUINO Presentation1.pptx
ARDUINO Presentation1.pptx
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
Arduino_Beginner.pptx
Arduino_Beginner.pptxArduino_Beginner.pptx
Arduino_Beginner.pptx
 
Iot Workshop NITT 2015
Iot Workshop NITT 2015Iot Workshop NITT 2015
Iot Workshop NITT 2015
 
IoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensorsIoT Basics with few Embedded System Connections for sensors
IoT Basics with few Embedded System Connections for sensors
 
Arduino
ArduinoArduino
Arduino
 
AVR arduino dasar
AVR arduino dasarAVR arduino dasar
AVR arduino dasar
 
Introduction to programming AVR microcontrollers
Introduction to programming AVR microcontrollersIntroduction to programming AVR microcontrollers
Introduction to programming AVR microcontrollers
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
 
Microcontroller from basic_to_advanced
Microcontroller from basic_to_advancedMicrocontroller from basic_to_advanced
Microcontroller from basic_to_advanced
 

More from Jhonny Wladimir Peñaloza Cabello

Electronica analogica junio 2002(problemas, amplificadores operacionales)
Electronica analogica junio 2002(problemas, amplificadores operacionales)Electronica analogica junio 2002(problemas, amplificadores operacionales)
Electronica analogica junio 2002(problemas, amplificadores operacionales)Jhonny Wladimir Peñaloza Cabello
 

More from Jhonny Wladimir Peñaloza Cabello (20)

Iec 2
Iec 2Iec 2
Iec 2
 
Compresores2016
Compresores2016Compresores2016
Compresores2016
 
37895105 tablas-termodinamica
37895105 tablas-termodinamica37895105 tablas-termodinamica
37895105 tablas-termodinamica
 
Electronica analogica junio 2002(problemas, amplificadores operacionales)
Electronica analogica junio 2002(problemas, amplificadores operacionales)Electronica analogica junio 2002(problemas, amplificadores operacionales)
Electronica analogica junio 2002(problemas, amplificadores operacionales)
 
H1011v2
H1011v2H1011v2
H1011v2
 
Ardx experimenters-guide-web
Ardx experimenters-guide-webArdx experimenters-guide-web
Ardx experimenters-guide-web
 
Self sufficient arduino1_2
Self sufficient arduino1_2Self sufficient arduino1_2
Self sufficient arduino1_2
 
Intro to-the-arduino
Intro to-the-arduinoIntro to-the-arduino
Intro to-the-arduino
 
Arduino workshop sensors
Arduino workshop sensorsArduino workshop sensors
Arduino workshop sensors
 
503
503503
503
 
Control on off (1)
Control on off (1)Control on off (1)
Control on off (1)
 
Comparacion entre millis y micros
Comparacion entre millis y microsComparacion entre millis y micros
Comparacion entre millis y micros
 
Funcion matematica
Funcion matematicaFuncion matematica
Funcion matematica
 
Informe del sumo ktm arduim
Informe del sumo ktm arduimInforme del sumo ktm arduim
Informe del sumo ktm arduim
 
117325039 planta-procesadora-de-jugos-de-frutas
117325039 planta-procesadora-de-jugos-de-frutas117325039 planta-procesadora-de-jugos-de-frutas
117325039 planta-procesadora-de-jugos-de-frutas
 
Apuntes transformada de_laplace
Apuntes transformada de_laplaceApuntes transformada de_laplace
Apuntes transformada de_laplace
 
3053
30533053
3053
 
13 mantenimiento de tuberia
13 mantenimiento de tuberia13 mantenimiento de tuberia
13 mantenimiento de tuberia
 
User guide __instruction_book_all_2097082507
User guide __instruction_book_all_2097082507User guide __instruction_book_all_2097082507
User guide __instruction_book_all_2097082507
 
Pfc3446
Pfc3446Pfc3446
Pfc3446
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

2009 11-17-arduino-basics

  • 2.     Microcontrollers  Tiny, self­contained computers in an IC  Often contain peripherals  Different packages availible  Vast array of size and power availible
  • 6.     Sensory Input  Robots need to be able to recieve input from the  world in the form of sensory input.  Microcontrollers handle this input.  Thousands of sophisticated sensors availiable
  • 14.     Alcohol Vapor Density Detectors
  • 15.     Arduino  Development board for the ATMega328  Inludes  Programmer,  Voltage Regulators  Seral to USB Converter  CHEAP ­­ $30! Has everything you need!
  • 16.     Arduino C Template void setup() {   // Setup stuff to only run once at the beginning    } void loop() {   // This function gets called indefinatly }
  • 17.     Peripherals  Analog to Digital Converters (ADC)  Counters/Timers (TMRx)  PWM Modules (CCP/PWM)  Serial Ports (UART)  Many, many more....
  • 18.     Digital I/O  Only HIGH and LOW values  Each pin configurable to do input or output  pinMode(pinNumber, pinState)  pinMode(13, INPUT)  pinMode(13, OUTPUT)
  • 19.     Digital I/O (Part II)  Output  digitalWrite(pinNumber, HIGH/LOW)  Input  int val = digitalRead(pinNumber)
  • 20.     Arduino Digital I/O Example int ledPin =  13; void setup() {   // Set the digital pin as output:   pinMode(ledPin, OUTPUT);       } void loop() {   // Bring the pin high (1)   digitalWrite(ledPin, HIGH); }
  • 21.     Serial Interface (UART)  Communicate with other microcontrollers or PC's  Asynch. communication  Arduino libraries make it extremely easy  Serial.begin(baudRate)  Serial.println(”String To Send”)  int bytesWaiting = Serial.Availible()  Char incomingData = Serial.read()
  • 22.     Arduino Serial Example void setup() { Serial.begin(9600);  // Setup baud rate } void loop() { Serial.println(”Give me input”);  // output data while(Serial.availible() < 1) {     // if there's data waiting char input = Serial.read();     // get a byte of data } }
  • 23.     Analog to Digital Converter (ADC)  Take analog voltage as input on one of the pins  Return digital representation to program  Different numbers of bits change precision.
  • 24.    
  • 25.    
  • 26.     Light Sensors  Photoresistors  Extremely Simple to Use  Resistance changes with light  Measure voltage over the sensor with an ADC, and you're done  Many more complicated sensors simulate this behavior for simplicity
  • 27.     Arduino ADC Example int sensorPin = 0; void setup() {   Serial.begin(9600); // Turn on Serial Connection } void loop() {   // read the value from the sensor:   sensorValue = analogRead(sensorPin);      // Print sensor value to the Serial   Serial.println(sensorValue); }
  • 28.     PWM Modules (CCP)  Create PWM signals on output pins  Measure PWM signals on input pins  CCP stands for Capture/Compare  What is PWM, anyway?
  • 29.     Pulse Width Modulation (PWM)  Transmit analog values using a single digital input/ output pin through careful timing.  A PWM signal consists of two values  Period: how long before the signal repeats  Pulse Width: how long the signal is HIGH before it  goes LOW.  Duty Cycle: % of time the signal is HIGH, or (Pulse Width / Period)
  • 30.    
  • 31.     PWM In Robotics  The average voltage (Duty Cycle * Voltage) can be  used to control the speed of DC motors.  Innaccurate, poor strength, braking, and other  problems exist.  Servo Motors and Speed Controllers.
  • 32.     Servo Motors  DC Motor with gears allow for high torque  Embedded microcontroller monitors PWM input  and motor position.  Vary pulse width to change position of motor
  • 33.     Speed Controllers  Embedded microcontroller varies voltage on output  lines based on PWM input.  Results in constant voltage to motors rather than  intermittent.  Allow a second, more powerful, power supply to  drive large motors.  Alter pusle width to change the speed of the motor
  • 34.     Arduino PWM Command  AnalogWrite(Pin, DutyCycle)  DutyCycle = 0   0%, 127   50%, 255   100%→ → →  Pin can be 3, 5, 6, 9, 10, or 11  Frequency of about 490Htz  Other periods are possible, but not with AnalogWrite
  • 35.     Arduino PWM Example int Pin = 9; void setup() {   pinMode(Pin, OUTPUT); } void loop() {   analogWrite(Pin, 127);  // Generate 50% duty cycle on ”Pin” }
  • 36.     Useful Resources  Robot Parts and Excellent Forums www.TrossenRobotics.com  Electrical parts, sensors, and microcontrollers www.Sparkfun.com  Arduino Development Platform www.ardiono.cc