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

Espruino

 Espruino

Espruino - JavaScript for Things - Open Source JavaScript Microcontroller

Niko Köbler

January 26, 2015
Tweet

More Decks by Niko Köbler

Other Decks in Technology

Transcript

  1. Espruino Project Espruino Project Founder: Gordon Williams ( ), UK

    @espruino www.espruino.com Open Source Hardware (CC-BY-SA) Open Source Software (MPLv2)
  2. Crowdfunded on Kickstarter! Crowdfunded on Kickstarter! Espruino Espruino Goal: 20k

    GBP, Pledged: 100k GBP by 1.692 backers in September 2013 Pico Pico Goal: 15k GBP, Pledged: 75k GBP by 1.448 backers in November 2014
  3. The Board The Board 54 x 41 mm (half of

    business card!) STM32F1 chip family
  4. The STM32 Chip The STM32 Chip STM32F103RCT6 32-bit, 72MHz 256kB

    Flash Memory 48kB RAM Only 1 Chip, therefore less power consumption! (this is kind of "green IT")
  5. The Pico The Pico STM32F401C chip, 384kB Flash, 96kB RAM

    less (22) GPIOs than Espruino Board USB powered
  6. The Interpreter The Interpreter Because JavaScript is interpreted, the code

    can be changed while it is running! You don't have to compile/install anything anymore. No deployment-cycles, faster delivery! Instant feedback on every code/function execution: good (ok) / bad (error)
  7. Event-based Model Event-based Model Evented I/O like Node.js, Vert.x, Play,

    Akka and other popular approaches. (even NPM modules can be used!) More interactive and understandable, because it's the way people naturally describe tasks: "When it's dark, turn on the light." Code is only processed on events and if necessary, this saves energy!
  8. Power Saving Power Saving The interpreter knows when it can

    go to sleep, and how deeply. Even the WiFi module doesn't need power while sleeping! Example: Example: LED-flashing with a 700mAh Li-Ion battery: Raspberry PI: 1 - 2 hours Arduino: 1 - 2 days Espruino: ~6 months
  9. Example 1: Toggle LED Example 1: Toggle LED digitalWrite(LED1,1); digitalWrite(LED1,0);

    function toggle() { on = !on; digitalWrite(LED1, on); }; toggle(); var interval = setInterval(toggle, 500); clearInterval(interval);
  10. Example 2: Example 2: Switch LEDs with Button Switch LEDs

    with Button LED1.set(); LED1.reset(); setWatch(function () { LED1.set(); setTimeout("LED1.reset(); LED2.set();", 500); setTimeout("LED2.reset(); LED3.set();", 1000); setTimeout("LED3.reset()", 1500); }, BTN, { repeat : true, edge : "rising" }); Video: http://youtu.be/Ts8K07VhzIM
  11. Create HTTP server via Wifi module and test on startup

    if wireless connection can be established. Example 3: HTTP-Server Example 3: HTTP-Server var wlan = require("CC3000").connect(); var http = require("http"); wlan.connect("mySSID", "mySecret", function (s) { if (s == "dhcp") { console.log("My IP is " + wlan.getIP().ip); http.get("http://www.pur3.co.uk/hello.txt", function(res) { res.on('data', function(data) { console.log(">" + data); }); }); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write('Hello World'); res.end(); }).listen(80); } }); (CC3000)
  12. Sensor Networks Sensor Networks small form-factor low energy consumption (needs

    energy only when doing something, not while sleeping) MQTT + socket support HTTP support already built-in!
  13. USB HID support USB HID support Allowing Espruino (Pico) to

    act like a USB keyboard, mouse or joystick. Make your own input devices for you PC, or make Espruino "play back" a series of keypresses. http://forum.espruino.com/conversations/127079/