O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012...

25
OUTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE http://www.irit.fr/~Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a very persistent one. Albert Einstein

Transcript of O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012...

Page 1: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

OUTILLAGE !OUTILS MATÉRIELS

DE PROTOTYPAGE RAPIDE

http://www.irit.fr/~Philippe.Truilletv.1.0 – octobre 2012

Reality is merely an illusion, albeit a very persistent one.Albert Einstein

Page 2: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PRÉSENTATION• Phidgets

• Arduino & co …

Page 3: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PHIDGETS• “User-friendly system available for controlling and

sensing the environment from your computer. No hardware knowledge needed, just a matter of plugging into the USB port on your computer and use Phidgets software libraries to access these devices.”

Phidget = physical widget

Page 4: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PHIDGETS : HOW-TO?Installation :

• aller à http://www.phidgets.com/docs/Operating_System_Support

• Télécharger le driver associé à votre OS

• Installer le driver

Page 5: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PHIDGETS : HOW-TO?Programmation :

• http://www.phidgets.com/docs/Programming_Resources• Sous différents langages donc C/C++/C#, Java, Python,

• Avec des API simples …private RFIDPhidget rfid;private InterfaceKitPhidget ik;…try { rfid = new RFIDPhidget(); ik = new InterfaceKitPhidget(); // ajout des listener rfid.addAttachListener(new AttachListener() {

public void attached(AttachEvent ae){

try…

Page 6: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PHIDGETS : HOW-TO?• Simuler les entrées/sorties

Page 7: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

ARDUINO

Page 8: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

ARDUINO : HOW-TO?• Installation

• Aller http://arduino.cc/en/Main/Software• Installer l’IDE et le driver laison série

Page 9: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

ARDUINO : HOW-TO?

Page 10: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

MATÉRIEL• Plusieurs versions

• Diecimila / ATmega 168 / 16 Ko• 2009 (Duemilanove) / ATmega 328 / 32 Ko• Mega / ATmega1280 / 128 Ko• D’autres …

Sous licence (cc) Attribution-Share Alike 2.5

Page 11: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER …• Un environnement intégré

multi OS basé sur java(v. 0018 – 29/01/2010)

Page 12: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

ALIMENTATION• Soit par USB (5 V jusqu’à 500 mA)• Ou alimentation externe (piles ou accus) [plage

idéale entre 7 et 12 V]

Page 13: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

BROCHES• Numériques (14 broches – de 0 à 13)5V / 40 mA et résistance interne de 20-50 kOhms déconnectée par défaut)

• Communication série : Broches 0 (RX) et 1 (TX)• Interruptions externes : broches 2 et 3• Impulsions PWM : broches 3, 5, 6, 9, 10 et 11• Interface Série Périphérique : Broches 10, 11, 12 et 13• I2C : Broches 4 et 5 • LED : broche 13

Page 14: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

BROCHES• AREF : Tension de référence

• Reset : la mettre au niveau LOW entraîne la réinitialisation du microcontrôleur

Page 15: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

BROCHES• Analogiques (6 broches – de 0 à 5) sur 10 bits

entre 0V (0) et 5V (1023). Possibilité de modifier la plage en utilisant la broche AREF

• Ces broches peuvent être utilisées en tant que broches numériques (entre 14 et 19)

Page 16: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• 2 fonctions essentielles pour un « sketch »

• setup() : initialisation, des variables, sens des broches, librairies … lancée au démarrage du programme

• loop() : boucle sans fin qui exécute le programme (lecture, écriture, traitement des données, …)

Page 17: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• Utilisation des entrées/sorties – configurer les

broches• pinMode(broche, mode)

Broche : numéro de la brocheMode : INPUT ou OUTPUT

Ex : int ledPin = 13; // led sur le pin 13

void setup(){

pinMode(ledPin, OUTPUT); // LED en sortie}

Page 18: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• Utilisation des entrées/sorties – écrire l’état d’une

broche digitale• digitalWrite(broche, valeur)

Broche : numéro de la brocheValeur : HIGH (1) ou LOW (0)

Page 19: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• Utilisation des entrées/sorties – lire l’état d’une

broche digitale• digitalRead(broche)

Broche : numéro de la broche

Renvoie la valeur HIGH ou LOW

Page 20: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• Utilisation des entrées/sorties – lire l’état d’une

broche analogique• analogRead(broche)

Broche : numéro de la broche analogique

Renvoie une valeur entière (0 à 1023)

Page 21: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• Utilisation des entrées/sorties – écrire l’état d’une

broche analogique / générer une onde PLW• analogWrite(broche, valeur)

Broche : numéro de la broche analogiqueValeur : largeur du cycle de l’onde carré entre 0 et 255)

Ne fonctionne que sur les broches 3, 5, 6, 9, 10 et 11

Page 22: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• Utilisation des entrées/sorties - pause

• delay(ms)

ms : durée en millisecondes de la pause

Page 23: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

PROGRAMMER• Syntaxe proche du langage C

• Référence : http://arduino.cc/fr/Main/Reference

Page 24: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

ARDUINO : LA FAMILLE …• D’autres projets compatibles : Teensy, Makey-

Makey, …

Page 25: O UTILLAGE ! OUTILS MATÉRIELS DE PROTOTYPAGE RAPIDE Philippe.Truillet v.1.0 – octobre 2012 Reality is merely an illusion, albeit a.

RÉFÉRENCES

• Phidgets :

• Arduino :

• Teensy :

• makey-makey :