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

Hardware Prototyping with Arduino

5b4c599a7720f8fa3d16370d630afddc?s=47 Taylan Pince
November 28, 2014

Hardware Prototyping with Arduino

These are the slides from my talk at Full Stack Toronto conference on November 23, 2014 in Toronto. I also blogged about the subject here: http://hipolabs.com/en/blog/hardware-prototyping-arduino/

5b4c599a7720f8fa3d16370d630afddc?s=128

Taylan Pince

November 28, 2014
Tweet

More Decks by Taylan Pince

Other Decks in Technology

Transcript

  1. HARDWARE PROTOTYPING WITH ARDUINO TAYLAN PINCE

  2. None
  3. MAKERS

  4. None
  5. None
  6. None
  7. None
  8. BACKERS

  9. None
  10. None
  11. None
  12. None
  13. FUTURE

  14. None
  15. None
  16. None
  17. HOW DO WE GET THERE?

  18. None
  19. None
  20. None
  21. None
  22. None
  23. None
  24. None
  25. PROJECT HOME MONITOR

  26. None
  27. HOME MONITOR ▸ Temperature ▸ Humidity ▸ UV Levels ▸

    Noise Levels ▸ Luminance Delivered over WiFi to central database
  28. None
  29. None
  30. app = Flask(__name__) app.db = dynamodb2.connect_to_region(AWS_REGION) @app.route("/entries", methods=["POST"]) def create_entry():

    with app.db.table.batch_write() as batch: for entry_type in dict(ENTRY_TYPES).keys(): batch.put_item(data={ "entry_type": entry_type, "date_created": int(time()), "reading": request.json.get(entry_type) }) return Response(status=200)
  31. /* Temperature & Humidity */ float temperature = TH02.ReadTemperature(); float

    humidity = TH02.ReadHumidity(); /* UV */ long uv_exposure = analogRead(A2); /* Luminance & Noise */ int luminance = analogRead(A3); int noise = analogRead(A1);
  32. client.fastrprint(F("POST ")); client.fastrprint(endpoint); client.fastrprintln(F(" HTTP/1.1")); client.fastrprintln(F("Content-Type:")); client.fastrprintln(F("application/json")); client.fastrprint(F("Host: ")); client.fastrprintln(server_host);

    client.fastrprint(F("User-Agent: ")); client.fastrprintln(user_agent); client.fastrprint(F("Content-Length: ")); client.println(length); client.fastrprint(F("Connection: close")); sendData(client, payload, buffer_size);
  33. // Enable watchdog wdt_enable(WDTO_8S); for (int i = 0; i

    < total_packets; i++) { client.print( payload.substring(i * buffer_size, (i + 1) * buffer_size)); // Reset watchdog wdt_reset(); } // Disable watchdog wdt_disable();
  34. None
  35. None
  36. None
  37. RESULTS

  38. PROJECT HOME MONITOR

  39. PHONE METER ▸ Air Pressure ▸ Temperature Transmitted to an

    iPhone in real time via Bluetooth LE
  40. None
  41. uint32_t temperature = myBarometer.bmp085GetTemperature( myBarometer.bmp085ReadUT() ); BLEMini_write(0x0A); BLEMini_write(temperature >> 24);

    BLEMini_write(temperature >> 16); BLEMini_write(temperature >> 8); BLEMini_write(temperature);
  42. - (void)bleDidReceiveData:(unsigned char *)data length:(int)length { for (int i =

    0; i < length; i += 5) { Float32 readingValue = data[i + 1] << 24 | data[i + 2] << 16 | data[i + 3] << 8 | data[i + 4]; if (data[i] == 0x0A) { NSLog(@"TEMPERATURE: %1.2f Celcius", readingValue); } else if (data[i] == 0x0B) { NSLog(@"PRESSURE: %1.2f Pa", readingValue); } else if (data[i] == 0x0C) { NSLog(@"ALTITUDE: %1.2fm", readingValue); } } }
  43. None
  44. DEMO

  45. WHAT'S NEXT?

  46. None
  47. None
  48. None
  49. THANK YOU @TAYLANPINCE TAYLAN@HIPOLABS.COM GITHUB.COM/TAYLANPINCE