Professional Documents
Culture Documents
Arduino Project
Arduino Project
Arduino Project
ATmel AVR Micro Controller Open Source Hardware Open Source Software The board can be build by hand http://arduino.cc
Wednesday, July 21, 2010 2
Why Arduino
Inexpensive Cross Platform Simple and Clear Programming Environment Open Source and Extensible Software Open Source and Extensible Hardware
Licensing
Physically embedding an Arduino board inside a commercial product does not require you to disclose or open-source any information about its design. Deriving the design of a commercial product from the Eagle files for an Arduino board requires you to release the modified files under the same Creative Commons Attribution Share-Alike license. You may manufacture and sell the resulting product. Using the Arduino core and libraries for the firmware of a commercial product does not require you to release the source code for the firmware. The LGPL does, however, require you to make available object files that allow for the relinking of the firmware against updated versions of the Arduino core and libraries. Any modifications to the core and libraries must be released under the LGPL. The source code for the Arduino environment is covered by the GPL, which requires any modifications to be open-sourced under the same license. It does not prevent the sale of derivative software or its inclusion in commercial products.
ATMEL AVR
Wednesday, July 21, 2010
8 bit AVR RISC Processor up to 20MIPS 4/8/16/32KB Flash Memory 256/512/1024 Bytes EEPROM 512/1024/2048 Byte SRAM 6 PWM/10bit ADC/USART/SPI/I2C 1.8V to 5.5V Internal OSC (0 to 20MHz) 23 I/O Lines
5
ATMEL AVR
Hardware
Serial Board
LilyPad
Pro
Mini
Mega
Diecimila
Wednesday, July 21, 2010 7
Microcontroller : ATmega168/ATmega368/ATmega1280 Operating Voltage : 5V Input Voltage (recommended) : 7-12V Input Voltage (limits) : 6-20V Digital I/O Pins : 14 (of which 6 provide PWM output) Analog Input Pins : 6 DC Current per I/O Pin : 40 mA DC Current for 3.3V Pin : 50 mA Flash Memory : 16 KB (ATmega168) : 32 KB (ATmega328) : 2 KB used by bootloader SRAM : 1 KB (ATmega168) : 2 KB (ATmega328) EEPROM : 512 bytes (ATmega168) : 1 KB (ATmega328) Clock Speed : 16 MHz
Wednesday, July 21, 2010 8
Hardware
AVR
AVRTools (Free Open Source) 8 Bit 20MHz Clock 16KB/32KB Flash 1024/2048 Byte SRAM 512/1024 Byte EEPROM SUART SPI I2C 10 Bit A/D Atmega328 ($8.17)
10
11
Plug-in Shields
Ethernet Shield
Motor Controller
Video Shield
Simple IDE via Java Easy to development without MICE Work with/without Bootloader
Wednesday, July 21, 2010 13
Work Flow
14
Software IDE
15
// The setup() method runs once, when the sketch starts void setup() { // initialize the digital pin as an output: pinMode(ledPin, OUTPUT); } // the loop() method runs over and over again, // as long as the Arduino has power void loop() { digitalWrite(ledPin, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(ledPin, LOW); // set the LED off delay(1000); // wait for a second }
16
/* * Web Server * * A simple web server that shows the value of the analog input pins. */ #include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; byte ip[] = { 10, 0, 0, 177 }; Server server(80); void setup() { Ethernet.begin(mac, ip); server.begin(); } void loop() { Client client = server.available(); if (client) { // an http request ends with a blank line boolean current_line_is_blank = true; while (client.connected()) { if (client.available()) { char c = client.read(); // if we've gotten to the end of the line (received a newline // character) and the line is blank, the http request has ended, // so we can send a reply if (c == '\n' && current_line_is_blank) { // send a standard http response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println();
Wednesday, July 21, 2010
} // give the web browser time to receive the data delay(1); client.stop();
17
Ethernet.h
#ifndef Ethernet_h #define Ethernet_h #include <inttypes.h> #include "Client.h" #include "Server.h" class EthernetClass { private: public: static uint8_t _state[MAX_SOCK_NUM]; static uint16_t _server_port[MAX_SOCK_NUM]; void begin(uint8_t *, uint8_t *); void begin(uint8_t *, uint8_t *, uint8_t *); void begin(uint8_t *, uint8_t *, uint8_t *, uint8_t *); friend class Client; friend class Server; }; extern EthernetClass Ethernet; #endif
18
Ethernet.cpp
extern "C" { #include "types.h" #include "w5100.h" } #include "Ethernet.h" // XXX: don't make assumptions about the value of MAX_SOCK_NUM. uint8_t EthernetClass::_state[MAX_SOCK_NUM] = { 0, 0, 0, 0 }; uint16_t EthernetClass::_server_port[MAX_SOCK_NUM] = { 0, 0, 0, 0 }; void EthernetClass::begin(uint8_t *mac, uint8_t *ip) { uint8_t gateway[4]; gateway[0] = ip[0]; void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway) gateway[1] = ip[1]; { gateway[2] = ip[2]; uint8_t subnet[] = { 255, 255, 255, 0 }; gateway[3] = 1; begin(mac, ip, gateway, subnet); begin(mac, ip, gateway); } } void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway, uint8_t *subnet) { ! iinchip_init(); ! sysinit(0x55, 0x55); ! setSHAR(mac); ! setSIPR(ip); setGAR(gateway); setSUBR(subnet); } EthernetClass Ethernet;
19
C/C++
The Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs supported by avr-g++ should work in Arduino.
20
Software Libraries
EEPROM Ethernet Firmata LiguidCrystal Servo Software Serial
Wednesday, July 21, 2010
Programmer ISP
ICSP (In-Ciruit Serial Programming) USB/Serial with USBTiny ISP Parallel Arduino Bit Bang mode
Wednesday, July 21, 2010 22
Parallel Programmer
23
TinyUSB ISP
http://www.ladyada.net/make/usbtinyisp/
24
25
Mac OS X : Arduino icon, Click with CTRL key Press, select Show Package Content. Goto Contents/Resources/Java/Hardware Linux: cd arduino/lib Windows: Goto arduino directory, cd arduino/hardware
Wednesday, July 21, 2010 26
Mac OS X : Arduino icon, Click with CTRL key Press, select Show Package Content. Goto Contents/Resources/Java/Hardware Linux: cd arduino/lib Windows: Goto arduino directory, cd arduino/hardware
Wednesday, July 21, 2010 27
MultiCode Arduino
29
Software Simulator
VirtualBoard http://www.virtualbreadboard.net/
Wednesday, July 21, 2010 30
Arduino Projects
Telly Mate - TV Out http://www.batsocks.co.uk/products/Shields/TellyMate%20Shield.htm Critical Velocity LCD http://www.criticalvelocity.com/item.php?itemid=shield9 Servo/Motor/Stepper http://www.ladyada.net/make/mshield/ Touch Screen http://www.liquidware.com/shop/show/TSL/TouchShield+Slide Micro SD http://www.sensor-networks.org/index.php?page=0827727742 GPS Datalog http://www.ladyada.net/make/gpsshield/ AutoPilot http://diydrones.com/notes/ArduPilot Humane Reader a 8bit low cost PC for TVs http://humaneinfo.com/
31
References
Geting Start with Arduino Book http://oreilly.com/catalog/9780596155513/ Arduino Course http://sheepdogguides.com/arduino/FA1main.htm Designers Guide to getting started with elevtronic sketching http://ahmedriaz.com/mind/projects/esketching4designers/ Arduino Forum http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl Arduino Blog http://arduino.cc/blog/ Arduino Manual in PDF http://www.arduino.cc/playground/Main/ ManualsAndCurriculum PIC v.s. AVR http://www.ladyada.net/library/picvsavr.html MultiCore Arduino - Humane Reader - a 8bit PC for TVs http://www.engadget.com/2010/07/20/humane-reader-is-a-20-8-bit-pc-for-tvs/
32
Enjoy it!
33