Maatschappelijke aspecten van de Informatica

Download Report

Transcript Maatschappelijke aspecten van de Informatica

"Arduino" workshop
Lennart
Herlaar
Domoticaforum
Robert
Hekkers1
Inhoud
• Het Arduino platform
• Varianten en shields
• Sensoren en actoren
• Coding en sketches
• Toepassingen
• Meet the JeeNode
• Workshop!
Physical Computing
Physical (or embedded) computing, in the broadest sense, means building
interactive physical systems by the use of software and hardware that can
sense and respond to the analog world. While this definition is broad
enough to encompass things such as smart automotive traffic control
systems or factory automation processes, it is not commonly used to
describe them. In the broad sense, physical computing is a creative
framework for understanding human beings' relationship to the digital
world. In practical use, the term most often describes handmade art, design
or DIY hobby projects that use sensors and microcontrollers to translate
analog input to a software system, and/or control electro-mechanical
devices such as motors, servos, lighting or other hardware. [Wikipedia]
Het Arduino platform
• Hardware
• Eenvoudig maar krachtig I/O board op basis van
een Atmel microcontroller (uC)
• Software
• Java-gebaseerde platform-onafhankelijke IDE
voor het ontwikkelen in een C-variant
• Community
• Veel sites en fora op Internet
• Actieve gebruikersgroepen
Waarom Arduino?
•
•
•
•
•
Krachtig en snel
Open source hardware en software
Goedkoop
€ 5,Goed gedocumenteerd
Eenvoudig
€ 60,-
• USB interface, bootloader, C-variant
€ 130,€ 0,-
€ 200,-
€ 27,-
Specificaties "basis" Arduino
• PCB van 6,9 x 5,3 cm
• ATmega328 microcontroller, 8-bits, 16 MHz klok
• 32 KB flash memory (program), 2 KB SRAM
(stack en heap), 1 KB EEPROM (non-volatile)
• 14 digitale I/O poorten, waarvan 6 met PWM
• 6 analoge inputs (eveneens digitale outputs)
• 2 externe interrupts
• USB interface, seriële TTL interface, SPI
interface, I2C interface
• Voeding via USB of extern
Arduino Duemilanove
USB-serieel
chip (FTDI)
Digitale I/O
Statusleds
Klokkristal
USB
connector
Voedingscircuit
Resetknop
In-circuit
programming
interface
Microcontroller
Voeding
Analoge inputs
Arduino Uno
8
Arduino varianten
Arduino Mega
Arduino Mini
Freeduino
Seeduino
Arduino Lilypad
Arduino varianten
BoArduino
BoArduino
RBBB
USB BUB
JeeLink
JeeNode
Arduino varianten
Roboduino
Ardupilot
Rainbowduino
LennArduino
Monochron
Shields
Ethernet shield
Motor shield
XBee shield
GPS shield
Prototype breadboard
Sensoren
Actoren
En verder...
Arduino IDE
• Integrated Development Environment
• Geschreven in Java
• Gebaseerd op
Processing
• Open source
• Zeer eenvoudig
• Write, verify, upload,
run
Serial monitor
Verify
Voorbeelden
Upload
Board en COM poort
Hello World! (Blink)
Declaratie variabelen
Initialisatie (eenmalig)
Hoofdloop (ad infinitum)
Arduino programmeertaal
•
•
•
•
C-variant, gebaseerd op Wiring
Sketches
“Kleine” taal
Complexere zaken zijn afgeschermd
• Maar wel te gebruiken
•
•
•
•
•
Gebruikelijke
Gebruikelijke
Gebruikelijke
Gebruikelijke
…
control structures
functies
operatoren
datatypes
Arduino programmeertaal
• Digitale I/O
• pinMode(pin, INPUT/OUTPUT)
• digitalWrite(pin, HIGH/LOW)
• digitalRead(pin)
• LOW <= 2 Volt, HIGH >= 3 Volt
• Analoge I/O
• analogRead(pin)
• 0 .. 5 Volt, weergegeven als 0 .. 1023 (10 bit resolutie
A/D converter)
• analogWrite(pin, 0 .. 255)
• Pulsbreedtemodulatie (PWM), 500 Hz
PWM
Arduino programmeertaal
• Onze Hello World applicatie heeft een probleem!
Hello World! revisited
Real Time Computing / uC prog.
• Structuur
• Setup, LoopLoopLoopLoopLoop...
• Controle op events en afhandeling!
• Gebruik geen delays maar intervallen of interrupts
• Houd rekening met debounce tijden
• Houd rekening met overflows
• Beperkte resources
• Geheugen (RAM, EEPROM, flash), timers, poorten
• Libraries kunnen een flinke aanslag plegen
• Programmeren voor een uC is niet eenvoudig!
Libraries
•
•
•
•
•
•
•
•
•
•
Serial
LiquidCrystal
Servo
Ethernet
EEPROM
DateTime
Webduino
X10
Twitter
...
Toepassingen
Meet the JeeNode
Meet the JeeNode
• 3.3V in plaats van 5V
• Veel sensoren en IC's alleen op 3.3V
• Draadloze RF module standaard aanwezig
• RFM12B, 868MHz, packet based, 66 bytes
• 4 poorten (ports) met identieke pin layout
• PWR, DIO, GND, 3.3, AIO, IRQ
• Aansluitpunten voor plugs en boards
• Overige poorten elders of voor de radio
• Power, Serial, I2C, Extended (PSIX), ISP/SPI
• Low power design
Plugs en Boards / Cards
• Plugs gebruiken 1 port
• Dedicated
• Op basis van I2C; dan daisy-chaining mogelijk
• Boards / Cards gebruiken vaak meerdere
ports of hebben een andere functie
• Voorbeelden
• Relay Plug, Thermo Plug, LCD Plug, MOSFET Plug
• Room Board, Graphics Board, AA Power Board
• Ondersteund door de Ports library
• Verder is de RF12 library essentieel
Workshop!
• Bouw een breadboard Arduino (Blink)
• Soldeer je USB BUB, LCD, Bridge Board, relais
• Soldeer je JeeNode
• Voer enkele breadboard experimenten uit
• Soldeer je Room Board
• Probeer RF12DEMO en de Room Board demo
• Homeseer integratie
• Tussendoor demo's van (SMD) solderen en
Mantis CNC
"Arduino" workshop
Vragen?
Lennart
Herlaar
Domoticaforum
Robert
31
Hekkers
"Arduino" workshop
www.arduino.cc
www.freeduino.org
www.jeelabs.org
www.circuitsonline.net
www.reprap.org
www.cadsoft.de
www.protospace.nl
www.shieldlist.org
www.awesomecopter.nl
www.freerouting.net
www.picbasic.nl/index_etsen.htm
www.sparkfun.com/commerce/tutorials.php
www.adafruit.com/index.php?main_page=tutorials
www.eevblog.com (episode 45)
blog.makezine.com/archive/arduino
hacknmod.com/hack/top-40-arduino-projects-of-the-web
www.aeroquad.info
Lennart
Herlaar
www.stephenhobley.com/blog/laser-harp-2009
Domoticaforum
Robert
32
Hekkers