기초공학설계 - GitHub Pages

기초공학설계 - GitHub Pages

Arduino Environment - Arduino platform Arduino board Direct programming Arduino schematics Arduino IDE Compiling code Arduino shields libraries

Arduino basic setup Arduino simulators 1 Arduino platform 2 Arduino

3 Arduino applications 4 Arduino applications 5

Arduino applications 6 Arduino environment A development board

8-bit microcontroller Programming hardware USC programming interface I/O pins 7 Arduino environment A software environment

Cross-compiler Debugger Simulator Programmer

8 Arduino environment Special-purpose shields Daughter boards

Unique functionalities Easy to attach Good libraries provided 9 Arduino board 10

The Arduino development board Has a microcontroller and USB interface to a PC Large open source community 11 Power/Reset Reset button

USB connector Power connector 12 Input/Output pins Digital I/O Power/reset pins

Digital I/O pins Analog input pins Power/reset pins Analog inputs 13 Microcontrollers ATmega16U2

Main processor ATmega328 processor programmed by the user USB com. processor ATmega16U2 handles USB communication ATmega328

14 Microcontroller Microcontroller Operating voltage Input voltage (recommended) Input voltage (limits) Digital I/O pins Analog input pins DC current per I/O pin

DC current for 3.3V pin Flash memory SRAM EEPROM Clock speed ATmega328 5V 7-12V 6-20V

14 (of which 6 provide PWM output) 6 40mA 50mA 32KB (ATmega328) (of which 0.5KB used by bootloader) 2KB (ATmega328) 1KB (ATmega328) 16MHz 15

Firmware Two types of code executing on a simple microcontroller Application code Executes the systems main functionality We write this code Firmware Low-level code: supports the main function USB interface, power modes, reset, etc.

The distinction is a matter of perspective Arduino-firmware is pre-programmed 16 Direct programming 17

Bootloader Firmware on a microcontroller Allows the Flash and EEPROM to be programmed Manages USB communication since application programming is via USB 18 In-Circuit Serial Programming (ICSP) A special programming

method to program the firmware Needed because the bootloader cannot reprogram itself One ICSP header for each processor 19

Arduino schematics 20 Arduino UNO schematic Arduino designs are open source Design is available You can build your own

21 Microcontrollers and I/O Power pins Analog in Digital I/O ATmega16U2

ATmega328 22 USB, Power, ICSP Power connector ICSP2 ICSP 1 USB connector

ATmega16U2 ATmega328 23 Arduino IDE 24 Arduino IDE

Arduino IDE (Integrated Development Environment) Menus with all commands Buttons with common commands

Text editor for writing code Message area 25 Arduino IDE Button

Function Verify Compiles code, checks for errors Upload Compiles code, checks for errors, uploads to board

New Creates a new sketch Open Opens an existing sketch Save

Saves your sketch to a file Serial Monitor Opens a window to communicate with the board 26 Compiling code

27 Compiling code Verify and Upload both compile Messages window will show either completion message or error messages Error messages will show line numbers

28 Serial monitor Displays serial data sent from the Arduino Allows serial data to be sent to the Arduino from the keyboard Library functions in the serial library

29 Arduino shields and libraries 30 Arduino shields Add-on boards that interface with another device/IC

Can be stacked directly on top of the Arduino Libraries exist to make interfacing simple Open source hardware, but most can be purchased Large variety of shields available Big advantage of the Arduino platform Fairly complete list is at http://shieldlist.org 31 Some Arduino shields

IMU shields: Measures 6DOF motion (acceleration and rotation) Synthesizer shields: Generates music Connects to speaker Ethernet shields:

Interfaces to Ethernet controllers Builds web servers/clients 32 Arduino basic setup 33 Set up the Arduino IDE Download the IDE

Easiest to run Windows Installer (http://www.arduino.cc) Also installs USB and other drivers Connect the board to your computer Use USB cable Launch the Arduino application Starts the IDE 34

Launch the Arduino IDE Open the Blink example FileExamplesBasicsBlink 35 Run a program Select your Arduino ToolsBoard menu

Select your serial port ToolsPort menu There should be only one selection (COM3, etc.) Upload the program with the upload button This writes the program onto the Flash of the Arduino The LED near pin 13 of the Arduino should blink

36 Arduino simulators 37 Tinkercad: Circuits Tinkercad http://tinkercad.com A free online collection of software tools that help people create and make

Simulates Arduino circuits and programs with a bunch of electronic components, sensors and actuators A good way to test your idea before you actually build 38 Tinkercad: Circuits 39

Lab 40 Blink example Set up the Arduino development environment Load the Blink example. Compile, download, and run. Modify blink intervals and check if it really works.

41 Tinkercad Go to http://tinkercad.com Register for your own account. Try several Arduino starter examples. Modify some codes, and check if it works. 42

Recently Viewed Presentations