Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Mini PCs para inventores e hackers

Mini PCs para inventores e hackers

Raspberry Pi, pcDuino e BeagleBone Black

Luciano Ramalho

July 22, 2013
Tweet

More Decks by Luciano Ramalho

Other Decks in Technology

Transcript

  1. Mini PC: MK802 • Rikomagic MK802 Android 4.0 Mini PC

    • media player • internet • game • uso geral (GNU/Linux) $ 40
  2. Mini PC: MK802 • Allwinner A10 ARM Cortex-A8 1 GHz

    • 1 GB RAM, 4 GB Flash microSD • HDMI, 2×USB, Wifi 8.5cm
  3. O “segredo” da ARM • Arquitetura de baixo consumo de

    energia, ideal para dispositivos móveis • 1.8 bilhões de CPUs ARM foram produzidas só nos últimos 3 meses de 2010 • A empresa ARM Holdings fabricou 0 • eles não fabricam chips, mas licenciam o projeto para fabricantes de chips como Samsung, Texas Instruments, Atmel, Intel, Nvidia, Qualcomm, Freescale, Allwinner...
  4. Arquitetura • SoC: System on a Chip • CPU •

    GPU • I/O • USB, Ethernet, armazenagem, RF... Isto é um SoC!
  5. @ramalhoorg blink.py import time GPIO_PATH = '/sys/devices/virtual/misc/gpio/' OUTPUT_MODE = "1"

    ON = "1" OFF = "0" DEBUG = True def pin_mode(pin, mode): with open(GPIO_PATH+'mode/gpio%s' % pin, 'w') as f: f.write(str(mode)) def digital_write(pin, value): with open(GPIO_PATH+'pin/gpio%s' % pin, 'w') as f: f.write(str(value)) def setup(): pin_mode(3, OUTPUT_MODE) setup() while True: digital_write(3, ON) time.sleep(1) digital_write(3, OFF) time.sleep(1)
  6. @ramalhoorg dojo7.py import time, os GPIO_PATH = os.path.normpath('/sys/devices/virtual/misc/gpio/') ADC_PATH =

    os.path.normpath('/proc/') INPUT = "0" OUTPUT = "1" HIGH = "1" LOW = "0" def pin_mode(pin, mode): with open(GPIO_PATH+'mode/gpio%s' % pin, 'w') as f: f.write(str(mode)) def digital_write(pin, value): with open(GPIO_PATH+'pin/gpio%s' % pin, 'w') as f: f.write(str(value)) def analog_read(pin): with open(ADC_PATH+'adc%d' % pin) as f: f.seek(0) return int(f.read(16).split(':')[1]) def setup(): for i in range(18): pin_mode(i, OUTPUT) digital_write(i, LOW) setup() while True: for i in [0, 1, 7, 5, 4, 2]: digital_write(i, 1) delay = analog_read(5)/4096.0 time.sleep(delay) digital_write(i, 0)
  7. @ramalhoorg Raspberry Pi model B Raspberry Pi mod. B SoC

    CPU GPU clock SO RAM Flash onboard SD card GPIO PWM ADC USB client USB host Ethernet Wifi HDMI video composto audio preço USD Arduinos open hardware Broadcom BCM2835 ARM11 (ARMv6) VideoCore IV 700 MHz GNU/Linux (vários) 512 MB ✘ SD 17 (+4 no P5) 1 ✘ ✘ 2 10/100 ✘ HDMI RCA HDMI + plug 3.5mm 35 1.0 ✘
  8. @ramalhoorg dojo8.py import atexit import time import RPi.GPIO as GPIO

    import spi atexit.register(GPIO.cleanup) # chamar ao sair GPIO.setmode(GPIO.BCM) DISPLAY = [17, 4, 9, 11, 7, 27, 22, 10] SPI_CLK = 18 SPI_MISO = 23 SPI_MOSI = 24 SPI_CS = 25 conversor_ad = spi.Mcp3008(SPI_CLK, SPI_MISO, SPI_MOSI, SPI_CS) CANAL_POT = 1 for led in DISPLAY[:6]: GPIO.setup(led, GPIO.OUT) GPIO.output(led, 0) while True: for led in DISPLAY[:6]: GPIO.output(led, 1) atraso = conversor_ad.read(CANAL_POT)/1000.0 time.sleep(atraso) GPIO.output(led, 0)
  9. @ramalhoorg pcDuino pcDuino SoC CPU GPU clock SO RAM Flash

    onboard SD card GPIO PWM ADC USB client USB host Ethernet Wifi HDMI video composto audio preço USD Arduinos open hardware Allwinner A10 ARM Cortex A8 (ARMv7 + NEON SIMD) Mali 400 1 GHz GNU/Linux (vários) Android 1 GB 2 GB micro-SD 14 6 6 1 1 10/100 ✘ HDMI ✘ via HDMI 59 1.7 ?
  10. @ramalhoorg BeagleBone Black Beaglebone Black SoC CPU GPU clock SO

    RAM Flash onboard SD card GPIO PWM ADC USB client USB host Ethernet Wifi HDMI video composto audio preço USD Arduinos open hardware Texas Instruments Sitara AM335x ARM Cortex A8 (ARMv7 + NEON SIMD) PowerVR SGX 530 1 GHz GNU/Linux (vários) Android 512 MB 2 GB micro-SD 66 8 7 1 1 10/100 ✘ micro-HDMI ✘ via HDMI 45 1.3 ✔
  11. @ramalhoorg anima.js var b = require('bonescript'); var tempo = 0;

    var i_pino = 0; var pinos = [16, 21, 22, 13, 12, 11]; /* setup */ for (var i=0; i<pinos.length; i++ ) { var p = pinos[i]; var pin = "P9_" + p; b.pinMode(pin, b.OUTPUT); b.digitalWrite(pin, 0); } function desligar() { b.digitalWrite("P9_" + pinos[i_pino], 0); i_pino++; if (i_pino == pinos.length) { i_pino = 0; } setTimeout(ligar, 0); }; function ligar() { console.log(i_pino); b.digitalWrite("P9_" + pinos[i_pino], 1); setTimeout(desligar, tempo); } function ler() { b.analogRead('P9_39', function (p) { tempo = p.value * 1000; }); } ligar(); setInterval(ler, 100);
  12. @ramalhoorg Conclusão • Raspberry Pi • > comunidade (blogs, acessórios

    etc.) • melhor GPU • pcDuino e BeagleBone Black: • + entradas analógicas (Raspberry Pi = 0) • ARM Cortex A8 (≈ dobro de MIPS por MHz)