Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Hardware Open Source

on

  • 2,393 views

Slides da palestra Hardware Open Source feita no Encontro Mineiro de Software Livre na Universidade Federal de Itajuba. Trata-se de uma conversa sobre a utilizaçao de hardware open source e uma ...

Slides da palestra Hardware Open Source feita no Encontro Mineiro de Software Livre na Universidade Federal de Itajuba. Trata-se de uma conversa sobre a utilizaçao de hardware open source e uma apresentaçao de projetos com o Arduino.

Statistics

Views

Total Views
2,393
Views on SlideShare
2,373
Embed Views
20

Actions

Likes
0
Downloads
23
Comments
0

3 Embeds 20

http://www.slideshare.net 10
http://www.techgig.com 9
http://www.linkedin.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Hardware Open Source Hardware Open Source Presentation Transcript

  • Hardware Open Source Tiago Maluta 16 de outubro de 2009 Tiago Maluta Hardware Open Source
  • Hardware Open Source Desenvolvido no mesmo modelo do FOSS1 Refere-se a informa¸˜o sobre o design ca Esquemas Lista de Materiais (BOM) PCB layout Hardware Description Language (HDL) FPGA (Xilinx, Altera, ...) Comum entre hobistas (DIY) 1 Free and Open Source Software Tiago Maluta Hardware Open Source
  • Colabora¸~o ca "Hardware engineers do the same thing as software engineers: they use high-level design patterns. They memorize circuits for accomplishing certain things and then plug them together." Tiago Maluta Hardware Open Source
  • Como um hardware pode ser ”open”? 1 Acesso a informa¸˜o sobre como hardware funciona, para ser ca usado livremente. 2 O design deve ser p´blico, para que outros implementem e u aprendam a partir do projeto. 3 As ferramentas utilizadas na constru¸˜o do hardware devem ca ser dispon´ ıveis, para outros desenvolverem e alterarem o design. Tiago Maluta Hardware Open Source
  • Casos de sucesso Arduino www.arduinio.cc BeagleBoard www.beagleboard.org Gumstix www.gumstix.com Tiago Maluta Hardware Open Source
  • Prot´tipo o http://www.flickr.com/photos/justinmclean/3846230883/in/set-72157622114963090/ Tiago Maluta Hardware Open Source
  • Design Software Electronic Design Automation (EDA) Esquematico, PCB, simula¸˜o ca Exemplos: Eagle http://www.cadsoft.de/ gEDA http://www.gpleda.org/ Fritzing http://fritzing.org/ KiCad http://kicad.sf.net Tiago Maluta Hardware Open Source
  • Printed Circuit Board (PCB) Tiago Maluta Hardware Open Source
  • Como facilitar? 1 Prototipagem r´pida a 2 Hardware em camadas 3 Desenvolvimento acess´ ıvel 4 Bibliotecas de Software Tiago Maluta Hardware Open Source
  • Arduino Plataforma open-source flex´ ıvel As vers˜es mais populares utilizam microcontrolador de 8-bits da ATMEL (ATMega) o Focado na cria¸˜o de objetos interativos ca Bem documentado http://www.arduino.cc/ Aprox. US$ 35.00 Hardware em camadas (Wiishield, Ethernet, Bluetooth, GPS, etc) Alimenta¸˜o pela USB (5V) ca Tiago Maluta Hardware Open Source
  • Compilador: AVR toolchain /usr/i686-pc-linux-gnu/avr/gcc-bin/4.4.1/avr-gccbug /usr/i686-pc-linux-gnu/avr/gcc-bin/4.4.1/avr-gcov /usr/i686-pc-linux-gnu/avr/gcc-bin/4.4.1/avr-gcc-4.4.1 /usr/i686-pc-linux-gnu/avr/gcc-bin/4.4.1/avr-c++ /usr/i686-pc-linux-gnu/avr/gcc-bin/4.4.1/avr-g++ /usr/i686-pc-linux-gnu/avr/gcc-bin/4.4.1/avr-cpp Tiago Maluta Hardware Open Source
  • Programa¸˜o ca Ambiente de desenvolvimento integrado (IDE) (Windows/Linux/OSX) Processing Arduino Programming Language Baseado na linguagem C/C++ Sketch ´ o nome dado a um programa no Arduino e Grava¸˜o pela USB2 ca 2 N˜o s˜o todos os modelos a a Tiago Maluta Hardware Open Source
  • Arduino Programming Language Dividido em trˆs partes principais. e Estrutural Valores Fun¸˜es co Tiago Maluta Hardware Open Source
  • Estrutural void setup() if Executado apenas uma vez if...else Inicializa¸˜o ca for void loop() Executada repetida vezes switch case ”Cora¸˜o”do scketch ca while do...while break continue return Tiago Maluta Hardware Open Source
  • Valores Tipos: Convers˜o: a Integer constants boolean (true ou false) char() decimal (11) char (8 bits) byte() bin´rio (B1011) a byte (8 bits) int() hex (0xB) int (2 bytes) long() octal (013) unsigned int (2 bytes) float() Floating point constants long (4 bytes) 3.14E5 unsigned long (4 Constantes (3.14 x 10∧5) 25e-6 bytes) (0.000025) HIGH | LOW float (4 bytes) INPUT | OUTPUT Formatadores U & L double (=float) true | false long 1000l array ([]) unsigned 1000u string (array + ’0’) unsigned long void (somente na 1000ul declara¸˜o de fun¸˜es) ca co Tiago Maluta Hardware Open Source
  • Fun¸oes c˜ Digital I/O Math Trigonometry pinMode(pin,mode) min(x,y) sin(rad) digitalWrite(pin, value) max(x,y) cos(rad) int digitalRead(pin) abs(x) tan(rad) Analog I/O constrain(x,a,b) Random Numbers map(value, fromLow, int analogRead(pin) randomSeed(seed) fromHigh, toLow, toHigh) analogWrite(pin,value) long random(max) pow(base, exponent) Time sq(x) random(min,max) unsigned long millis() sqrt(x) Communication unsigned long micros() Serial delay(ms) delayMicroseconds(us) Tiago Maluta Hardware Open Source
  • Hello World void setup(){ pinMode(13, OUTPUT); } void loop(){ digitalWrite(13, HIGH); delay(500); digitalWrite(13, LOW); delay(500); } Tiago Maluta Hardware Open Source
  • Cora¸˜o do Arduino: Arquitetura AVR ca I/O Memory Adderess Data Direction Register (DDRx) Data (PORTx) Port Input Pins (PINx) Harvard architecture Tiago Maluta Hardware Open Source
  • Projetos Conhecer os protocolos de comunica¸˜o. ca I2C, SPI, UART (RS232) Acesso a documenta¸˜o to microcontrolador ca ATMega168 ou ATMega328 http://www.msarnoff.org/chipdb/ATmega168 Tiago Maluta Hardware Open Source
  • Projeto #1: LCD Display http://www.flickr.com/photos/maluta/3804133584/in/set-72157621867976757/ Tiago Maluta Hardware Open Source
  • Projeto #1: LCD Display 2x16 LCD (Hitachi HD44780) Register Select (RS) Read/Write (R/W) Enable 8x Data Display Constrast Power supply Backlight Tiago Maluta Hardware Open Source
  • LCD pin Arduino RS → digital pin 12 Enable → digital pin 11 D4 → digital pin 5 D5 → digital pin 4 D6 → digital pin 3 D7 → digital pin 2 Tiago Maluta Hardware Open Source
  • #include <LiquidCrystal.h> // initialize the library with the numbers of the interface pins LiquidCrystal lcd(12, 11, 5, 4, 3, 2); void setup() { // set up the LCD’s number of rows and columns: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("hello, world!"); } void loop() { // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print(millis()/1000); } Tiago Maluta Hardware Open Source
  • Projeto #2: Webserver http://www.flickr.com/photos/maluta/4015803466/in/set-72157621867976757/ Tiago Maluta Hardware Open Source
  • Projeto #2: Webserver Ethershield Utiliza um chip dedicado da Microchip (ENC28J60) Stand-Alone Ethernet Controller with SPI Interface http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en022889 O modelo ”oficial”utiliza o chip da Wiznet (W5100) http://www.wiznet.co.kr/en/pro02.php?&ss%5B2%5D=1&page=1&num=25 Tiago Maluta Hardware Open Source
  • #include "etherShield.h" static uint8 t mymac[6] = { 0x54,0x55,0x58,0x10,0x00,0x24}; static uint8 t myip[4] = { 10,0,0,25}; #define MYWWWPORT 80 #define BUFFER SIZE 550 static uint8 t buf[BUFFER SIZE+1]; EtherShield es = EtherShield(); Tiago Maluta Hardware Open Source
  • uint16 t http200ok(void) { return(es.ES fill tcp data p(buf,0,PSTR("HTTP/1.0 200 OKrnContent-Type: text/htmlrnPragma: no-cachernrn"))); } // prepare the webpage by writing the data to the tcp send buffer uint16 t print webpage(uint8 t ∗buf) { uint16 t plen; plen=http200ok(); plen=es.ES fill tcp data p(buf,plen,PSTR("<html><head><title>Arduino ENC28J60 Ethernet Shield V1.0</title></head><body>")); plen=es.ES fill tcp data p(buf,plen,PSTR("<center><h1>Hardware Open Source</h1>")); plen=es.ES fill tcp data p(buf,plen,PSTR("<hr><br><h2><font color=’’blue’’>-- EMSL’09 -- <br>Encontro Mineiro de Software Livre")); plen=es.ES fill tcp data p(buf,plen,PSTR("<br> ")); plen=es.ES fill tcp data p(buf,plen,PSTR("<br> ")); plen=es.ES fill tcp data p(buf,plen,PSTR("<br></font></h2>") ); plen=es.ES fill tcp data p(buf,plen,PSTR("</center><hr>")); plen=es.ES fill tcp data p(buf,plen,PSTR("Tiago Maluta maluta@unifei.edu.br ")); plen=es.ES fill tcp data p(buf,plen,PSTR("<a href=’’http://www.coding.com.br’’>www.coding.com.br</a>" )); plen=es.ES fill tcp data p(buf,plen,PSTR("</body></html>")); return(plen); } Tiago Maluta Hardware Open Source
  • void setup(){ // initialize enc28j60 es.ES enc28j60Init(mymac); // init the ethernet/ip layer: es.ES init ip arp udp tcp(mymac,myip, MYWWWPORT); } Tiago Maluta Hardware Open Source
  • void loop(){ uint16 t plen, dat p; while(1) { // read packet, handle ping and wait for a tcp packet: dat p=es.ES packetloop icmp tcp(buf,es.ES enc28j60PacketReceive(BUFFER SIZE, buf)); /∗ dat p will be unequal to zero if there is a valid ∗ http get ∗/ if(dat p==0){ // no http request continue; } // tcp port 80 begin if (strncmp("GET ",(char ∗)&(buf[dat p]),4)!=0){ // head, post and other methods: dat p=http200ok(); dat p=es.ES fill tcp data p(buf,dat p,PSTR("<h1>200 OK</h1>")); goto SENDTCP; } // just one web page in the "root directory" of the web server if (strncmp("/ ",(char ∗)&(buf[dat p+4]),2)==0){ dat p=print webpage(buf); goto SENDTCP; } else{ dat p=es.ES fill tcp data p(buf,0,PSTR("HTTP/1.0 401 UnauthorizedrnContent-Type: text/htmlrnrn<h1>401 Unauthorized</h1>")); goto SENDTCP; } SENDTCP: es.ES www server reply(buf,dat p); // send web page data } Tiago Maluta Hardware Open Source
  • Outros projetos Twitter Pain´is Solares e Sintetizador de som GPS Sensores (Umidade, Luz, etc) Compartilhamento atrav´s do Pachube e (http://community.pachube.com/) Tiago Maluta Hardware Open Source
  • Considera¸oes c˜ Consumo el´trico e Custo (R$) Documenta¸˜o ca Esquem´tico a BOM PCB Propriedade Intelectual Licen¸a Compat´ c ıvel Sugest˜o: Creative Commons a Comunidade de Usu´rios a Tiago Maluta Hardware Open Source
  • Referˆncias e http://del.icio.us.com/maluta/arduino http://www.coding.com.br Tiago Maluta Hardware Open Source