arduino project
TRANSCRIPT
Arduino Project A Open Source Hardware and Software Project
1Wednesday, July 21, 2010
Arduino Project
• ATmel AVR Micro Controller
• Open Source Hardware
• Open Source Software
• The board can be build by hand
• http://arduino.cc
2Wednesday, July 21, 2010
Why Arduino• Inexpensive
• Cross Platform
• Simple and Clear Programming Environment
• Open Source and Extensible Software
• Open Source and Extensible Hardware
3Wednesday, July 21, 2010
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.
4Wednesday, July 21, 2010
ATMEL AVR
• 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 Lines5Wednesday, July 21, 2010
ATMEL AVR
6Wednesday, July 21, 2010
Hardware
LilyPad
Pro
Serial Board
Mega
Diecimila
Mini
7Wednesday, July 21, 2010
HardwareMicrocontroller : ATmega168/ATmega368/ATmega1280Operating Voltage : 5VInput Voltage (recommended) : 7-12VInput Voltage (limits) : 6-20VDigital I/O Pins : 14 (of which 6 provide PWM output)Analog Input Pins : 6DC Current per I/O Pin : 40 mADC Current for 3.3V Pin : 50 mAFlash Memory : 16 KB (ATmega168) : 32 KB (ATmega328) : 2 KB used by bootloaderSRAM : 1 KB (ATmega168) : 2 KB (ATmega328)EEPROM : 512 bytes (ATmega168) : 1 KB (ATmega328)Clock Speed : 16 MHz
8Wednesday, July 21, 2010
PIC v.s. AVRPIC AVRPIC18F452 ($10.35) AVRTools (Free Open Source)8/16/32 Bit 8 Bit40MHz Clock 20MHz Clock16KB/32KB Flash 16KB/32KB Flash768/1536 Byte SRAM 1024/2048 Byte SRAM256 Byte EEPROM 512/1024 Byte EEPROMESUART SUARTSPI SPII2C I2C10 bit A/D 10 Bit A/DMPLAB/CCS ($450)/ SDCC (Free) Atmega328 ($8.17)
9Wednesday, July 21, 2010
Hardware Open Source
10Wednesday, July 21, 2010
Hardware Open Source
11Wednesday, July 21, 2010
Plug-in Shields
Ethernet Shield Motor ControllerVideo Shield
Touch Shield
Xport Ethernet Shield
GPS Dataloger Shield
12Wednesday, July 21, 2010
Open Source Software
• IDE and compiler for Windows/Linux/OS X cross platform
• Simple IDE via Java
• Easy to development without MICE
• Work with/without Bootloader
13Wednesday, July 21, 2010
Work Flow
14Wednesday, July 21, 2010
Software IDE
15Wednesday, July 21, 2010
Blink LED Source
/* Blink Turns on an LED on for one second, then off for one second, repeatedly. The circuit: * LED connected from digital pin 13 to ground. */
int ledPin = 13; // LED connected to digital pin 13
// 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}
16Wednesday, July 21, 2010
Web Server Code/* * 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();
// output the value of each analog input pin for (int i = 0; i < 6; i++) { client.print("analog input "); client.print(i); client.print(" is "); client.print(analogRead(i)); client.println("<br />"); } break; } if (c == '\n') { // we're starting a new line current_line_is_blank = true; } else if (c != '\r') { // we've gotten a character on the current line current_line_is_blank = false; } } } // give the web browser time to receive the data delay(1); client.stop(); }}
17Wednesday, July 21, 2010
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
18Wednesday, July 21, 2010
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]; gateway[1] = ip[1]; gateway[2] = ip[2]; gateway[3] = 1; begin(mac, ip, gateway);}
void EthernetClass::begin(uint8_t *mac, uint8_t *ip, uint8_t *gateway){ uint8_t subnet[] = { 255, 255, 255, 0 }; begin(mac, ip, gateway, subnet);}
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;
19Wednesday, July 21, 2010
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.
20Wednesday, July 21, 2010
Software Libraries
• EEPROM
• Ethernet
• Firmata
• LiguidCrystal
• Servo
• Software Serial
• Stepper
• Wire
• Matrix
• Sprite
• X10
• XBee
• LEDControl
• Tone
• Streaming
• LCD
• MUX
• Webduino
21Wednesday, July 21, 2010
Programmer ISP
• ICSP (In-Ciruit Serial Programming)
• USB/Serial with USBTiny ISP
• Parallel
• Arduino Bit Bang mode
22Wednesday, July 21, 2010
Parallel Programmer
23Wednesday, July 21, 2010
TinyUSB ISP
• http://www.ladyada.net/make/usbtinyisp/
24Wednesday, July 21, 2010
Arduino Bitbang Mode
25Wednesday, July 21, 2010
Write without Bootloader
##############################################################nobootloader328.name=Write without Arduino Bootloadernobootloader328.upload.protocol=stk500nobootloader328.upload.maximum_size=30720nobootloader328.upload.speed=57600nobootloader328.upload.using=usbtinyispnobootloader328.build.mcu=atmega328pnobootloader328.build.f_cpu=16000000Lnobootloader328.build.core=arduino
Add to board.txt
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
26Wednesday, July 21, 2010
Arduino BitBang Mode
bitbang.name=FTDI Bitbangbitbang.protocol=diecimila -Pft0 -B4800
Add to programmers.txt
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
27Wednesday, July 21, 2010
Add new Libraries
Mac OS X : Arduino icon, Click with CTRL key Press, select “Show Package Content”.Goto Contents/Resources/Java/Hardware/Libraries
Linux: cd arduino/libraries
Windows:Goto arduino directory, cd arduino/hardware/libraries
Download library from net, unarchived, copy the directory to “libraries” directoryAfter close and start Arduino IDE,Check the example tag, if the library provide a example.
28Wednesday, July 21, 2010
MultiCode Arduino
29Wednesday, July 21, 2010
Software Simulator
VirtualBoard http://www.virtualbreadboard.net/30Wednesday, July 21, 2010
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/
31Wednesday, July 21, 2010
References• Geting Start with Arduino Book http://oreilly.com/catalog/9780596155513/
• Arduino Course http://sheepdogguides.com/arduino/FA1main.htm
• Designer’s 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/
32Wednesday, July 21, 2010
Enjoy it!
33Wednesday, July 21, 2010