dpnm lab., postech 1/29 cs490k - internet of things (iot) jonghwan hyun dpnm lab. department of...

29
NM Lab., POSTECH 1/2 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH [email protected] Oct. 14, 2014 Introduction to Arduino

Upload: donald-howard

Post on 11-Jan-2016

228 views

Category:

Documents


3 download

TRANSCRIPT

1

Jonghwan Hyun

DPNM Lab.Department of Computer Science and Engineering, POSTECH

[email protected]

Oct. 14, 2014Introduction to ArduinoDPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)1Microcontroller (mc, MCU)A small computer on a single chip Containing a processor, memory, and input/outputTypically "embedded" inside some device that they control Often small and low cost

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Microcontroller (mc, MCU)Computer on a single integrated chipProcessor (CPU)Memory (RAM / ROM / Flash)I/O ports (USB, I2C, SPI, ADC)Common microcontroller familiesIntel: 4004, 8008, etc.Atmel: AT and AVRMicrochip: PICARM: multiple manufacturersUsed inCellphonesToysHousehold appliancesCarsCameras

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)What is Arduino?Open-source hardware platformOpen source development environmentEasy-to learn language and libraries Integrated development environmentAvailable for Windows / Mac / LinuxA programmable micro controller for prototyping electromechanical devicesAble to connect Digital and Analog electronic signalsSensors (Gyroscopes, GPS Locators, accelerometers)Actuators (LEDS or electrical motors)

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)What is Arduino?Taken from the official web site (arduino.cc)Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Why use Arduino?Easy to use platformEase of programmingArduino C is a greatly simplified version of C++Simple USB interfaceSimple IDEMany shields availableInexpensive$35 retailDPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)

Arduino - UnoElectrical Inputs and OutputsInput voltage: 7-12 V (USB, DC plug, or Vin)Max output current per pin: 40 mAHardware I/O13 Digital I/O bits2 = serial TxD/RxD4 LEDs6 Analog outputsPulse-width modulatedChoose digital or PWM8-bit resolution6 Analog inputs10-bit resolution at bestDPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Arduino - UnoThe ATmega328P MicrocontrollerUsed by the Arduino UNOAVR 8-bit RISC architectureUp to 20 MHz clock32kB flash memory30 kB available for user code2 kB for bootloader2 kB RAMVolatile data memoryVariables + stack + heap + 23 programmable I/O channelsSix 10-bit ADC inputsThree timers/countersSix PWM outputs

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Many Flavors of ArduinoMany different versionNumber of I/O channelsForm factorProcessor

UnoLeonardoDueMicro / Mini / NanoLilyPadEsploraMega

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Many Flavors of ArduinoLeonardoCompared to the Uno, a slight upgradeBuilt in USB compatibilityPresents to PC as a mouse or keyboard

DueMuch faster processor, many more pinsOperates on 3.3 voltsSimilar to the Mega

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Many Flavors of ArduinoMicroWhen size matters: Micro, Nano, MiniIncludes all functionality of the LeonardoEasily usable on a breadboard

LilyPadPopular for clothing-based projects

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Many Flavors of ArduinoEsploraGame controllerIncludes joystick, four buttons, linear potentiometer (slider), microphone, light sensor, temperature sensor, three-axis accelerometerNot the standard set of IO pinsMegaCompared to the Uno:Many more communication pinsMore memory

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Arduino-like SystemsCortino (ARM)Xduino (ARM)LeafLabs Maple (ARM)BeagleBoard (Linux)Wiring Board (Arduino predecessor)

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Arduino Add-ons (Shields)

(Connects to a computer power supply)

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)

Arduino Add-ons (Shields)

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Arduino Add-ons (Shields)Communication Shields

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Modules send serial data strings to the ArduinoArduino Add-ons (Modules)

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Arduino Add-ons (Sensors)

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Arduino Add-ons (Sensors)Photoresistor, infrared, force sensitive resistor, Hall effect, Piezo, tilt sensor

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Setting up ArduinoDownload & install the Arduino environment (IDE)Connect the board to your computer via the USB cableIf needed, install the driversLaunch the Arduino IDESelect your boardSelect your serial portWrite codesUpload the program

Reference: http://arduino.cc/en/Guide/HomePage

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Getting to know the ArduinoArduino IDEYet Another IDEVery few featuresSimple programsExactly the use caseWritten in JavaClick to upload

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Getting to know the ArduinoProgramming ModelSmall projectsSingle-threaded loop()Plus IRQ handlers...Not much I/ONo BusSPI & I2C gadgetsNot much dataNot enough RAMDevelopment CycleWrite some codeCompile & upload itUSB/serial linkFind errorsWhere?How?IterateHidden errors...DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Getting to know the ArduinoProgramming LanguageC like syntax, but simplifiedAbstracts the pin naming to numbersTrades efficience for ease of useEasy to learn, yet powerfulLots of example code Easy to reuse C-code from other projectsLibraries can be written in C++Lots of libraries availableDPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Two methods of using the ArduinoWorking with the Arduino to solve a problemTemporary solutionOne time onlyPrototyping with the Arduino to solve a needPreparing a product for marketMass production

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)ProjectsOWI535 Robotic Arm To Rover Armhttp://sourceforge.net/projects/owi535roverarm/

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Projects

chlonosAn open source talking multimedia clock gadgetUsing a 126 LED display, temperature and light sensorshttps://code.google.com/p/chlonos/

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)ProjectsRearEye - A wearable additional eye Simple Lilypad project to get additional distance sensesBy putting it in pocket or backpack in order to sense someone / something approachingConsists of a Lilypad, a LilyPad Vibe Board and a SRF05 Ultrasonic Ranger

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)ProjectsLED Matrix from processinghttp://www.youtube.com/watch?v=kkJDWrM-K4UArduino Flash Controlhttp://www.youtube.com/watch?v=7T1jmj4KClAGoogle Earthwalkhttp://www.youtube.com/watch?v=zoNwJ931aqIUltrasonic grasshttp://www.youtube.com/watch?v=bZIKbuZaJSQPiezo ponghttp://www.youtube.com/watch?v=nXLDyBFsqdgAccelerometer and Flashhttp://www.youtube.com/watch?v=49WBPIIo3EE

Lots of interesting projects you can find in http://playground.arduino.cc/projects/arduinoUsersDPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)Referenceshttp://arduino.cc/Official homepage with Playground & forumshttp://ladyada.net/learn/arduino/Great Arduino tutorialshttp://todbot.com/blog/category/arduino/Various movies, hacks, tutorials on Arduinohttp://freeduino.org/Index of Arduino knowledgehttp://adafruit.com/Arduino starter kits, Boarduino Arduino clone, lots of cool kitshttp://sparkfun.com/Sells Arduino boards and lots of neat sensors & stuff

DPNM Lab., POSTECH #/29CS490K - Internet of Things (IoT)