Hardware Hacking with JavaScript

Hardware Hacking with JavaScript

Full repo of code and slides here: https://github.com/andrew/jquery-uk

8ddbf811da78bb0daeeb3cacd7cf743f?s=128

Andrew Nesbitt

May 16, 2014
Tweet

Transcript

  1. jQuery UK 16 May 2014 1 / 73

  2. Andrew Nesbitt Bath, UK @teabass GitHub 2 / 73

  3. Francis Gulotta New York City, USA @reconbot Wizard Development 3

    / 73
  4. Hardware Hacking with JavaScript 4 / 73

  5. Hardware Hacking? 5 / 73

  6. Hardware Hacking? Combining electronics and physical components with code 6

    / 73
  7. Hardware Hacking? Combining electronics and physical components with code Making

    real things and controlling them with software 7 / 73
  8. Hardware Hacking? Combining electronics and physical components with code Making

    real things and controlling them with software Building things with your hands 8 / 73
  9. Hardware Hacking? Combining electronics and physical components with code Making

    real things and controlling them with software Building things with your hands Joining the Maker Movement 9 / 73
  10. Why JavaScript? 10 / 73

  11. Why JavaScript? Hardware demands asynchronous software 11 / 73

  12. Why JavaScript? Hardware demands asynchronous software Huge and diverse community

    12 / 73
  13. Why JavaScript? Hardware demands asynchronous software Huge and diverse community

    Lowering the barriers to entry 13 / 73
  14. Why yes, JavaScript! Hardware demands asynchronous software Huge and diverse

    community Lowering the barriers to entry JavaScript is the language of the web 14 / 73
  15. Internet of Things 15 / 73

  16. Internet of Things Bridging hardware devices and online services 16

    / 73
  17. Internet of Things Bridging hardware devices and online services Treating

    hardware as an API 17 / 73
  18. Internet of Things Bridging hardware devices and online services Treating

    hardware as an API Interconnecting all kinds of hardware 18 / 73
  19. Internet of Things Bridging hardware devices and online services Treating

    hardware as an API Interconnecting all kinds of hardware Mashing up software and hardware 19 / 73
  20. Demo Driven Development 20 / 73

  21. 21 / 73

  22. Makey Makey 22 / 73

  23. Makey Makey keys = { 87: 'W', 65: 'A', 83:

    'S', 68: 'D' } $(document).keydown(function (e) { console.log(keys[e.which]) }); 23 / 73
  24. Emoji Fruit Piano 24 / 73

  25. Emoji Fruit Piano Patent Pending 25 / 73

  26. 26 / 73

  27. Emoji Fruit Piano Demo 27 / 73

  28. 28 / 73

  29. Spark Core 29 / 73

  30. Spark.io Open source microcontroller Arduino compatible Wifi enabled Cloud certified®

    30 / 73
  31. The Internet Connected Hat 31 / 73

  32. The Internet Connected Hat Patent Pending 32 / 73

  33. 33 / 73

  34. Spark Core 34 / 73

  35. Spark Core npm install sparky var Sparky = require('sparky') var

    core = new Sparky({ deviceId: 'your device id', token: 'your access token', }) core.digitalWrite('D7', 'HIGH'); core.digitalRead('D0', function(val){ console.log(val) }); 35 / 73
  36. 36 / 73

  37. 37 / 73

  38. Arduino Uno 38 / 73

  39. Johnny Five 39 / 73

  40. 40 / 73

  41. Johnny-Five is jQuery for robots 41 / 73

  42. Johnny-Five is jQuery for the physical world 42 / 73

  43. Johnny-Five Supports over 99 hardware devices Started by Rick Waldren

    now has over 61 Contributers Most active JavaScript Robot Community 43 / 73
  44. "A blinking light is the hello world of robotics." -Sara

    Chipps 44 / 73
  45. Blink for Arduino int led = 13; // the setup

    routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } 45 / 73
  46. Blink for Johnny Five var five = require("johnny-five"); var board

    = new five.Board(); // Connect to the arudino board.on("ready", function() { // Create a new Led object on pin 13 var led = new five.Led(13); led.blink(); // blink! }); 46 / 73
  47. Das Blinkenlights 47 / 73

  48. 48 / 73

  49. ED 209 var ED = require('johhny-five/eg/ed.js'); // Create a new

    Enforcer Droid var ed209 = new ED({ // assign servos right: { hip: 9, foot: 11 }, left: { hip: 10, foot: 12 } }); // Stand upright! ed209.attn(); // Walk forward! ed209.fwd(); // Dance! ed209.dance(); // another Rick Waldron creation 49 / 73
  50. ED 209 50 / 73

  51. Parrot AR Drone 2.0 51 / 73

  52. 52 / 73

  53. AR Drone npm install ar-drone var arDrone = require('ar-drone'); var

    client = arDrone.createClient(); client.takeoff(); client .after(5000, function() { this.clockwise(0.5); }) .after(3000, function() { this.animate('flipLeft', 15); }) .after(1000, function() { this.stop(); this.land(); }); 53 / 73
  54. 54 / 73

  55. 55 / 73

  56. High-tech Observation & Orientation Device Interaction Enabler 56 / 73

  57. High-tech Observation & Orientation Device Interaction Enabler H.O.O.D.I.E 57 /

    73
  58. High-tech Observation & Orientation Device Interaction Enabler H.O.O.D.I.E Patent Pending

    58 / 73
  59. 59 / 73

  60. 60 / 73

  61. H.O.O.D.I.E // we're already connected to the drone and arduino

    var button = new five.Button(7); var leftYFlexSensor = new five.Sensor("A0"); var rightYFlexSensor = new five.Sensor("A1"); var leftZFlexSensor = new five.Sensor("A2"); var rightZFlexSensor = new five.Sensor("A3"); // push the button to turn on flying button.on("up", function() { toggleFlying(); }); 61 / 73
  62. H.O.O.D.I.E // Map the flex sensors to both the drone

    and the VR simulation leftYFlexSensor.on("read", function(err, value){ var a= five.Fn.map(value, 100, 500, -90, 90); leftY = five.Fn.constrain(a, -80, 80); io.sockets.emit('leftY', { angle: leftY, value: value }); move(); }); rightZFlexSensor.on("read", function(err, value){ var a = five.Fn.map(value, 500, 200, -60, 60); rightZ = five.Fn.constrain(a, -60, 60); io.sockets.emit('rightZ', { angle: rightZ, value: value }); move(); }); 62 / 73
  63. 63 / 73

  64. Wrapping up As web developers, you are in the perfect

    position for the future of internet connect devices. 64 / 73
  65. Wrapping up As web developers, you are in the perfect

    position for the future of internet connect devices. This new breed of hardware and software brings jQuery-like levels of accessibility to Hardware Hacking. 65 / 73
  66. Wrapping up As web developers, you are in the perfect

    position for the future of internet connect devices. This new breed of hardware and software brings jQuery-like levels of accessibility to Hardware Hacking. Making things with you hands is incredibly rewarding 66 / 73
  67. 67 / 73

  68. NodeBots Any robot controlled by Node.js (or JS in general)

    Coined by Chris Willams in "Rise of JS Robotics" Cool Logo 68 / 73
  69. NodeBots Events Chapters all over the world (4 countries, 6

    cities) Reach out to Oli Evans (@olizilla) about NodeBots London Start a new chapter near you with just a github pull request? Nodebots are better with friends 69 / 73
  70. 70 / 73

  71. NodeCopter AR Drones controlled with nodejs Hackdays with flying robots

    Community event (affordable & inclusive) Learning, sharing, fun and being nice to each other 71 / 73
  72. Get out the and start hacking! 72 / 73

  73. Thanks @teabass @reconbot github.com/andrew/jquery-uk 73 / 73