Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB...
Transcript of Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB...
![Page 1: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/1.jpg)
Introduction to
Arduino/Processing
ANDERS J JOHANSSON
![Page 2: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/2.jpg)
Examples of projects
using Arduino
![Page 3: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/3.jpg)
Wearable
Electronics
Flora, Lilypad, Gemma
![Page 4: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/4.jpg)
Microcontroller - Embedded systems
– Usable for quick prototypes.
![Page 5: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/5.jpg)
Arduino
Hardware Software + IDE
(Integrated Development
Environment)
![Page 6: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/6.jpg)
Processing
![Page 7: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/7.jpg)
Open source
Mjukvara
Java-environment
• GPL
C/C++ bibliotek
• LGPL
Hårdvara
• Kretsscheman
• CAD-filer (Eagle-cad)
Creative Commons Licens
• Share alike
• Attribution
![Page 8: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/8.jpg)
How to make something simple
complicated…
![Page 9: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/9.jpg)
Arduino.org
![Page 10: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/10.jpg)
Arduino.cc
![Page 11: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/11.jpg)
Arduino hardware
![Page 12: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/12.jpg)
Arduino UNO
Microcontroller
USB
Vin
USB
I/O
I/O
Serial
Prog.
USB
Reset
Xtal
LED13
TX/RX
LEDs
LED ON
Ceramic
resonator
![Page 13: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/13.jpg)
ATMEGA 328P USB
![Page 14: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/14.jpg)
Arduino pins vs. Atmega 328
![Page 15: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/15.jpg)
Inside the microcontroller
![Page 16: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/16.jpg)
Inside the CPU
![Page 17: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/17.jpg)
Arduino: The programming language
Structure
setup()
loop()
Digital I/O
pinMode()
digitalWrite()
digitalRead()
Analog I/O
analogReferenc
e()
analogRead()
analogWrite()
Control Structures
if
if...else
for
switch case
while
do... while
break
continue
return
goto
![Page 18: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/18.jpg)
Variables
Data Types
void (0)
boolean (1B)
char (1B)
unsigned char
(1B)
byte (1B)
int (2B)
unsigned int (2B)
word (2B)
long (4B)
unsigned long (4B)
short (2B)
float (4B)
double (4B)
string - char array
String – object array
![Page 19: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/19.jpg)
What you don’t get:
• Momory to spare
• Multi-threading
![Page 20: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/20.jpg)
I/O portar
• 6 Analog inouts
• 14 digital I/O
– 6 with PWM output
(3,5,6,9,10,11)
• Bus-support
– I2C/TWI (A4, A5)
– SPI (10,11,12,13)
– TTL serial (USB och 0,1)
• External interrupts (2,3)
• LED (13)
![Page 21: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/21.jpg)
PWM
• Pulse Width Modulation
• Demands low pass filtering to
be a continous signal
– Low-pass filter (R-C)
– Eye
– Motor
– etc
![Page 22: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/22.jpg)
Motors
• Use PWM
• Add diod as
protection from
induced current
• Use a transistor to
control the current.
(Imax = 20mA)
![Page 23: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/23.jpg)
Servo electrical interface
• 1-2 ms pulse width
• 50 Hz pulse frequency
• 1.5 ms is middle
Adafruit.com
![Page 24: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/24.jpg)
10-bit successive approximation ADC
Features
• 10-bit Resolution
• 0.5 LSB Integral Non-
linearity
• ± 2 LSB Absolute Accuracy
• 13 - 260μs Conversion Time
• Up to 76.9kSPS (Up to
15kSPS at Maximum
Resolution)
![Page 25: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/25.jpg)
Shields
• “shields” are
daughterboards to
Arduino.
• Uses the connections
along the edge
• Exists in hundreds of
variants
![Page 26: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/26.jpg)
Shields
![Page 27: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/27.jpg)
Motors and control
• Multiple variants
available
• DC motors
• Servos
• Stepper motors
![Page 28: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/28.jpg)
Fritzing
![Page 29: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/29.jpg)
Arduino simulator: 123d.circuits.io
![Page 30: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/30.jpg)
Raspberry Pi
Simple, cheap Linuxd computer (159:- , 329:- , 499:- )
More powerful than Arduino, and thus more complicated.
Typically programmed in Python.
Video and HDMI-utgång.
Possibility to easily connect electronics and camera
![Page 31: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/31.jpg)
Webb-adresses
Most important:
• arduino.cc
Webb-learning:
• learn.adafruit.com
• learn.sparkfun.com
Development environments:
• processing.org
• fritzing.org
• 123d.circuits.io
Inspiration:
• Google.com
• adafruit.com
• sparkfun.com
Swedish resellers:
• electrokit.se
• lawicel.se
• elfa.se
• farnell.se
![Page 32: Introduction to Arduino/Processing ANDERS J JOHANSSON · Arduino UNO Microcontroller USB Vin USB I/O I/O Serial Prog. USB Reset Xtal LED13 TX/RX LEDs LED ON Ceramic resonator . USB](https://reader030.fdocuments.in/reader030/viewer/2022040123/5e10966ab89fd0795c590853/html5/thumbnails/32.jpg)