2. Today’s schedule
• Lecture 1: Arduino
• Install Arduino driver
• Lab 1: use Arduino UNO to control LED.
• Lecture 2: Sensor and Feedback
• Lab 2: use Arduino UNO and ultrasonic distance
sensor to measure distance
• Lecture 3: Minimum system
• Lab 3: Building minimum system using AVR chip.
3. What is Arduino?
• Official definition: A combination of hardware,
software, development team, design philosophy.
• From Ivrea, Italy.(意大利的艾维里)
• Hardware include Arduino UNO and Arduino Mega,
Software include Arduino IDE.
• Arduino UNO: Development board of AVR chips.
• Arduino UNO is announced in 2011.
• UNO Punto Zero (1.0)
8. Install Arduino driver
Refer to the PDF file from the announcement on SAKAI.
For Windows 7 Operating Systen:
• Step 1: Download Arduino IDE and unzip it.
• http://arduino.googlecode.com/files/arduino-1.0.5-r2-
windows.zip
• Step 2: Plug in Arduino UNO board.
• Step 3: Right-click This PC Manage Other
device Right-click Unknown deviceUpdate
driver Scan the driver folder in Arduino IDE.
For Windows 8/8.1, please refer to PDF file.
For Mac OS/Linux, Skip this slides.
10. Arduino IDE
• An integrated development environment designed
for Arduino hardware.
• The language is C++ - like.
• Process of doing Arduino Project:
• Connect hardware with Arduino UNO
• Write program on Arduino IDE.
• Download it onto Arduino UNO.
• Power Arduino UNO on and enjoy it.
11. Arduino IDE
• Structure: two necessary functions:
1. void setup(){}
2. void loop(){}
• The relationship between Arduino Language and
C++ Language.
• Important sentence:
pinMode (PinNumber,Mode); (general in setup(){};)
digitalWrite (PinNumber, DigitalVoltage);
delay (MiliSeconds);
12. Lab #1: Light up LED
• Requirement:
• Light up LED and keep 3 seconds, than power it off and
keep 3 seconds.
• Repeat the procedure.
• DIY
14. Quick Review
• You have controlled the On and Off of LED by
control the output voltage of a certain port.
• The voltage on pin 13 is called digital signal, which
can be either 1 (logical-high voltage) or 0 (logical-
low voltage).
• Actually, Arduino UNO can output/input
digital/analog signals.
15. Sensor(传感器)
• Arduino is like a brain. It also needs ears, eyes, nose,
etc. to measure quantities in outside environment.
• Sensor serves as the connection between Arduino
and the outside environment.
• So called Feed back control
Temp. Sound
Light …
Environment
16. Velocity Sensor -- Tachometer
Velocity sensor –
Tachometers
Where K is the back EMF
constant.
Every car has a tachometer
so as to measurer to measure
speed.
(t) K (t)t vwV
17. Temperature Sensor
• Three classes f temperature sensors:
• Thermometers and bimetallic strips ---- Sensors which
change physical dimension as a function of temperature.
• RTDs and thermistors ----Sensors which change
resistance as a function of temperature.
• RTD:
• Thermistor:
• Thermocouples ----Sensors which work based on
thermoelectric phenomena
0 0(1 (T T ))R R
0
1 1
( )
0
T T
R R e
18. Ultrasonic sensor
• Ultrasonic sensors are used to measure distance.
• An impulse of ultrasonic wave is emitted from the
sensor. The wave will reflect when reaches some
obstacles. The time between emission and
receiving will be calculated.
• Use formula to calculate the
distance.
/ 2L Vt
19. HC-SR04 ultrasonic sensor
• Four pins (GND, VCC, Trig, Echo)
• GND and VCC is the power supply to this module.
• Arduino UNO send message to Trig, and read
message from Echo.
20. Serial Ports (COM,串口)
Communication
• Serial is one way in which information is transferred
between computer & Arduino.
• Information can also be transferred using Parallel
Ports.(并口)
• Two important sentence of serial communication.
• Serial.begin(BaudRate); (must be in setup())
• Serial.write(message);
21. Lab 2: Use ultrasonic sensor to
measure distance
Electronic components Number Note
Arduino UNO 1 With USB wire
HC-SR04 Sensor 1
Wires 4
Arduino UNO HC-SR04 Note
GND GND
VCC VCC
A1 (Pin 15) Trig
A0(Pin 14) Echo
Lab equipment:
Wire connection
23. Quick Review
• Sensor: connection between Arduino and outside
environment.
• Serial: one way in which information is transferred.
24. AVR
• AVR is a family of MCU chips which are produced
by ATMEL Company.
• The AVR chip on Arduino UNO is Atmega328.
• The AVR chip on Arduino MEGA is Atmega2560
• Working environment:
• Stable 5V power supply
• Time reference input
• (RESET)
25. Atmega328P-PU
• Pin number and
counting order.
• Significant pin for
working.
• Power supply: PIN7,
PIN8, PIN20, PIN22.
• RESET: PIN1
• Timing: PIN9,
PIN10
• Serial Ports: PIN2,
PIN3
26. Min. Sys. Of Atmega328P-PU
• Minimum system: MCU chip with simplest
peripheral circuit. (外围电路).
• Below is the circuit for min. sys. of Atmega328P.
27. Lab 3: Min. Sys. Of Atmega328P
• Step 1 Remove the MCU chip on Arduino.
29. Step 3 Connect LED and
download program
• Connect the series of LED and resistor to pin GND
and pin 19.
• Connect the Arduino PCB and your computer as is
done in Lab 1.
• Write exactly the same program as in Lab 1 without
any change.
• Click the Download button.
• See what happen~~^_^
30. Step 3 Connect LED and
download program
• When the download process has been down, you
can remove the RESET line and RX TX line, just
leaving the VCC and GND so as to give power to the
Atmega328.
31. A Quick Review
• In the lab 3, we connect the LED to pin GND and Pin
19, but actually in the program we define the Port
13, why?
32.
33. Reference
• [1] Arduino Internal, Wheat, Dale.
• [2] Slides of Dr. Huang Peisen.
• [3] www.arduino.cc