ARDUINO Hardware : arduino UNO 8€ 2005, Atmel/ATmega, 32k, 16Mhz, http://arduino.cc/en/Main/Products Arduino IDE http://arduino.cc/en/main/software C++ BareMinimum void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: } Bread board Led blink (100 pour 2€) void setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(13, LOW); delay(1000); } // turn the LED off by making the voltage LOW // wait for a second Led Fade Pulse Width Modulation int led = 9; // the pin that the LED is attached to int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by // the setup routine runs once when you press reset: void setup() { // declare pin 9 to be an output: pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // set the brightness of pin 9: analogWrite(led, brightness); // change the brightness for next time through the loop: brightness = brightness + fadeAmount; // reverse the direction of the fading at the ends of the fade: if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount ; } // wait for 30 milliseconds to see the dimming effect delay(30); } Scratch with Arduino = S4A http://s4a.cat/ charger S4Afirmware16.uno sur l’arduino scratch prend le contrôle Température LM35 1€ void loop(){ int temp = analogRead(inputPin); float millivolts = (temp / 1024.0) * 500; int celsius = millivolts; // sensor output is 10mV per degree Celsius Serial.println(celsius); delay(delaySend); } Utilisation de données Python, Go, Java, C, ... Choix python librairie Pyserial la plus utilisée sudo easy_install -U pyserial http://playground.arduino.cc/Interfacing/Python Programme Python import sys import serial devArduino='/dev/tty.usbmodem1421' try: ser = serial.Serial(devArduino, 9600) except: print 'Arduino not found --> ', sys.exc_info()[1] exit(0) print ser while 1 : input=ser.readline() print input print 'serial closed' ser.close InfluxDB Time series database influxdb -config=/usr/local/etc/influxdb.conf http://localhost:8083/ (root/root) list series; select * from TEMP01; select * from TEMP01 where time > now() - 1h; Call rest python to influxDB https://github.com/influxdb/influxdb-python easy_install influxdb Ajout dans le programme host='localhost' port = 8086 user = "root" password = "root" db_name = "probes" db = influxdb.InfluxDBClient(host, port, user, password) db.switch_db(db_name) series = db.query("list series;") print "series: {0}".format(series) print 'Connection to InfluxDB\n' ------ json_body = [{ "points":[[value]], "name":key, "columns":["value"]}] db.write_points_with_precision(json_body, time_precision='u') UI Vocal Get last temperature from InfluxDB Javascript Gauge Text to command Google to speech Basic items Breadboard : 2€ Fils : 2€ Resistances 400 pour 3€ Input Joystick : x,y et push 2€ Keypad : clavier chiffres, lettres 0,5€ Boutons : 50 pour 3€ Telecommande : 2€ Potentiometre : 1€ Sensor Eau 1€ Feu 1€ CO 2€ Distance par ultrason 1€ Infrarouge RFID Ligth Tilt Temperature Humidité Pression Présence Contact Moteur Moteur pas à pas 1€ Moteur On/Off Moteur servo : x degrés Display Led one color : 100 pour 2 € Led RGB : 1€ Led strip RGB 5m 13€ LCD 3€ Led infrarouge : 10 pour 1€ Matrice Ciphers Relay 1 realy 220V 1€ Son Buzer Cartes Carte RJ45 + SD : 15€ Carte prototype : 3€ Communication Wireles 2€ Pas encore testé 433 Mhz (EU Ok) Pas cher 100m Télécommande Atmega microcontrolleur standalone