• Preparation

  • Introduction

  • Status quo

  • The problem

  • The solutions: What is there?

  • The solutions: Why?

  • The solutions: How?

  • Demonstration

  • Closure

    • Hi everyone, thanks for coming!

      I’m Gonzalo Casas.

      I am a software engineer in the mobile team at local.ch.

      Before we begin, let me ask you, how many of you guys have have played with Arduino before? Hands…? And what about knowledge of electronics? Ok, for those that didn’t raise the hand: don’t worry, it’s gonna be alright!

      As I was saying, I work for a mobile team, but today I am NOT going to talk about mobile. Well, at least, not about smart phones. Instead of that, today I want to tell you about a special kind of objects: enchanted objects.

    • What do I mean by Enchanted Objects? These are ordinary items with extraordinary abilities. They can interact with us and with each other, they can sense the world and react to it. And they are almost magical.

      One example of an enchanted object is the Vessyl. Looks like a cup, a bit hipster perhaps, but a cup nonetheless; however it’s packed with sensors and can tell you things like how much caffeine you had today. All in a seemingly normal object. Not sure if this object is really ever going to be useful, or even produced, but the idea of adding magic to objects is very appealing to me.

      The metaphor of enchanted objects was developed and published by David Rose, an MIT Media Lab Researcher. It is a beautiful rephrasing of the buzz phrase ‘Internet of Things’.

    • You all know this quote, and it sums it up pretty well.

      The good news is that we, as developers, are in center stage to make this happen. We can make the magic work.

    • In order to add smarts to an object we program it, and to program it we need a small enough computer to fit it: we need microcontrollers.

      The problems is that this has been historically very hard to actually do.

      But microcontrollers are traditionally associated with advanced knowledge in electronics, low-level programming, proprietary APIs, awful toolchains, etc.

      Basically, there is a very high barrier to entry into this world.

    • Only the brave used to dive into this arcane world. The rest of us just stayed as far as possible from a soldering iron.

      I know it because that was me 2 months ago! I have basically zero knowledge of electronics, or electricity for that matter. And that’s one of the reasons why I’m here, I want to show you that you don’t need to know much of electronics to get into this world. You should not fear the soldering iron. :)

      My wife always complains, we spent 2 years with a standard light bulb as the only lighting in our living room because installing the IKEA ceiling lights was too hard a task for me.

      So, what changed?
      Not me for sure, I’m still equally ignorant about these topics.

    • It is our industry that is changing. One of the big steps forward was Arduino board and the whole Open Source Hardware movement.

      Arduino lowered the barrier of entry, made it cheaper, easier, grew a big community around it.

      BUT it still has a slow Edit-Compile-Run cycle.

      And it is still a relatively low-level programming language. I am sure many of you guys will disagree, but if there’s one language I don’t want to use, that has to be C. And Java, but that’s a different story.

      Back to Arduino, besides being a great improvement over the previous situation, debugging is still tricky, multi-tasking is tricky, and it still feels relatively hard to grok for an outsider.

    • Enter Javascript.

    • There’s a new wave of hardware coming, I am going to call it zero-friction hardware for now.

      It is hardware that aims to have the least friction possible to get you started with it.

      It is not just about Javascript, but that is a big part of it.

      These are devices that run Javascript, either natively or with a very thin layer, are cloud-enabled or have mesh networking support, are truly plug and play, are based on open source hardware designs, have open communities. And they are CHEAP. Ok, maybe not so much in CH, but again that’s another story!

      As the cost of these devices drops we are going to see an explosion of experimentation in the developer community.

    • There is going to be an explosion of JS-based hardware. In fact, it is already happening.

      Last year, the Espruino board was kickstarted, a CHF 40 board that runs Javascript natively and has been shipping since the beginning of the year.

      Last month, the Tessel started shipping, another crowd-funded board that runs JS natively, with a strong focus on Node.js.

      There are lots more: Pinoccio that promises super easy mesh networks. Spark Core which is an Arduino compatible little board and ships with a great ‘Get started’ experience and cloud-enabled services. Literally, you plug the thing it will online in 2 minutes. Intel’s Edison computer, a low-cost board with WiFi built-in, all packed in about the size of an SD card.

      In the same line of zero-barrier hardware, but less focused on JS itself, we have these card-sized computers. Not SD cards, but more like credit card size. The Raspberry Pi being the prime example, or its cousin the BeagleBone Black. This guy comes with node.js and Cloud9 editor pre-installed.

    • One of the big challenges for all these boards is to keep power consumption to the minimum. And networking is kind of a problem on this matter, because it tends to be pretty power-hungry.

      There is no shortage of initiatives on this front either. Besides WiFi, we have a lot of new protocols popping up everywhere. Protocols especially designed to fit low-power devices, like mesh network protocols (e.g. Z-Wave, ZigBee, Insteon, Weightless standard), or BLE (the technology behind the most over-hyped buzzword of the year: Apple’s iBeacon).

      There are also standardization efforts going on: the Thread Group is a joint effort by Nest (Google), Samsung and ARM to have an IPv6 networking protocol designed for mesh networks and low-power devices, built on open standards.

    • Perhaps one open question is: why would we want to program microcontrollers in Javascript? Why Javascript of all the languages in the world?

      Well, you all came to a JS conference, so I guess you already have a few ideas of why this is might be.

      The single most important reason for this is Javascript’s huge user base. And by user here I mean developers. We are the users of the language. There are literally millions of developers around the globe that already speak Javascript. Not only that, they also speak async, which -we will see soon- it a fundamental characteristic of these boards.

      This huge reach also means that means nowadays Javascript runs everywhere. Literally, in every device and application layer you can think of.

      The next one is instant gratification: we don’t need any Edit-Compile-Run cycles, we write code, we run it. Instant gratification. Is a very powerful enabler for innovation.

      And then we have events. Javascript is an event-based language, we have events built right into it, and we’re very used to the asynchronous paradigm it presents to us.

      And it just happens that this event-based nature is very convenient for a microcontroller: leveraging it, these boards can be extremely power-efficient, they can go into deep sleep and just wait for an event to wake them up.

      When I talk about events, I don’t mean these…

    • These were Javascript events back in 1997.
      And these are events in the Espruino.

    • And finally, because we CAN!

    • A few minutes ago, I mentioned several boards that can run Javascript. Each has its strengths but there are two that are particularly focused on Javascript: Espruino and Tessel. I want to take the Espruino as an example, show you which features it brings to the table, and show you a bit of code.

      Espruino is particular in that it targets both beginners and seasoned makers alike. I’ll get to how it does that in a minute.

    • It is a pure Javascript board, it has no OS, there’s no message passing, no nothing, just a JS interpreter as firmware.

      It’s also worth noting that it runs a custom implementation of JS, it’s not V8 or SpiderMonkey. Mainly due to the memory usage constraints. It’s about 95% compatible with ES5 spec.

      It’s also just ridiculously easy to get started with. It takes under 3 minutes from un-boxing to running code. This is in part because the IDE is a Chrome Web App, so there’s no download, no installation, just open and start hacking. Also because of Javascript itself: there’s no Edit-Compile-Run cycle. You open the IDE and you have a REPL right there, you can start running code on the device without further ado.

      Flashing the firmware with updates to the JS interpreter is a breeze as well, no risk of bricking the device, directly from the Web IDE.

      Overall a very streamlined ‘getting started’ experience.

      It is a device that enables fast, cheap and efficient hardware prototyping. The efficiency part comes from the events on hardware level.

      The fact that events are implemented on the hardware level means the board can do cooperative multitasking with very little overhead, and can do heavy optimizations of power supply and deep sleep cycles.

    • I mentioned that this board targets beginners and experienced developers. One way it does that is by having this very smooth ‘getting started’ experience.

      Also, I keep saying this is a JS board, but in fact, there are other two programming languages you can use with it. One is Blocky, it’s this LEGO-like visual editor that is awesome for education, especially with young kids. The programs built it is are actually exported to Javascript, so in fact this is just a graphical layer on top of it, but there fact that is there is important for a lot of people.

      On the other end, we have Assembler support. That sounds pretty bizarre, and I really don’t know if anyone is actually using it, but it’s there if you want to rejoice in the irony of writing assembler directly on an IDE that is built on Javascript.

      So you see, on one hand we have features that enables your 10-year old brother or sister to play with it, and on the other hand, some features for the hardcore makers. But in center stage its us, Javascript developers.

    • So I said I wanted to show you some code. Let’s start with some code snippets. First thing is modules. Espruino comes with a Node.js inspired module loader. It is not really node.js, but it feels like it. What is actually does is going to a repository of Espruino modules, getting a minified version of the module and uploading it together with your code. There’s a pretty nice selection of modules available, mostly for different sensors, shields, and the like.

    • Then, the canonical ‘Hello World’ of microcontrollers: how to turn on a LED. Trival.

      Then, how to connect to WiFi. again extremely trivial. The Espruino doesn’t ship with wifi on-board, you have to get a separate module and wire it. But it’s also really simple to do it.

      And one more, serving HTTP requests directly from the Espruino. In 5 lines.

    • Ok.

      I started this session talking about enchanted objects.

      An enchanted object is surely not a board with a blinking LED. Or service a simple HTTP response. But if we combine the tools we already use with these new devices, we can compose things in new ways, and approach those magic properties I was talking about.

      My personal project with the Espruino is this robot. It is not really sophisticated, but there’s one thing about it that still amazes me. I was able to build it from scratch in about one an a half days. But when I mean ‘from scratch’, I really mean it: I mean, I bought my first soldering iron that week, and it was the first time I used such a tool! So, literally going from never having done anything with electronics, to a robot that actually works in less than 2 days, that blew my mind.

      So I want to do a social experiment. And see if we can add some magic to this thing. The robot is pretty simple, right now the program is just waiting for commands, so it has no exploration logic in it. It does have a distance ranging sensor, but that is just to avoid hitting stuff.

      But I don’t want to control it myself. I want you to control it. All together. In a collective intelligence coordination kind of way.

      I prepared a remote control for you, guys. It is a super simple Javascript (what else) web app. The app will log all your commands, average the most voted one on a sliding window of 5 seconds, and then the robot will move.

      Now, please take your phones. Yes, NOW it is good etiquette to do so. Open this URL. And command the robot.

      Special brownie points if you get it do draw a square shape around this.

    • Ok, I hope you enjoyed that.

      To finalize, one last question you might be asking yourselves. “All very nice, but, where the heck do I start?”

      Easy. First get yourself one of these guys, be it the Espruino or one of the others. Then while you wait for the shipment, read up! AdaFruit and SparkFun have amazing tutorials and learning resources. In fact, you don’t even need to read, they have video tutorials. And once you get it, start hacking! It’s that easy.

      Don’t fear the soldering iron! Get yourself breadboards and header packs in abundance so that you can prototype like a mad man, and the, document your builds!

      Fritzing is your friend. Publish what you discover, get involved in the community!

    • So, yes, that would be it for now. I hope you enjoyed it and now, GO and Script all the things!!

    • Gonzalo Casas
      Mobile Engineer at local.ch

    • Enchanted objects

      Ordinary things with extraordinary abilities
      Interconnected
      Sensing
      Active

      (Background image: Vessyl image)

    • “Any sufficiently advanced technology is indistinguishable from magic.”
      — Arthur C. Clarke

      (Background image: HAL 9000)

    • Traditional microcontrollers

      High barrier to entry
      Very tricky to debug
      Proprietary/crippled toolchains

    • GIF: fear of the soldering iron.

    • Arduino

      Makes things better
      But debugging is still tricky
      Multitasking is hard

      (Image: Arduino)

    • Javascript <3 Microcontrollers

      GIF: BMO Dance

    • Zero-friction hardware

      Javascript-based
      Cloud-enabled
      Mesh networks
      True PnP
      Open source hardware
      Community
      and CHEAP!

      (Image: use a collage for each of these points instead of bullet points)

    • The JS hardware explosion

      Espruino, Tessel, Pinoccio, Spark Core, Intel Edison, BeagleBone Black, Raspberry Pi

      (Image: use a collage with the logos)

    • Net for things
      WiFi
      Mesh
      BLE

    • Why Javascript?

      Community: Massive user base
      Instant gratification
      Events

    • Javascript events in 1997:

      <a href="http://home.netscape.com/comprod/mirror/index.html">
          <img onmouseover="this.src='on.gif'" onmouseout="this.src='off.gif'">
              Best viewed with Netscape Navigator 3.0
      </a>

      Events in Espruino:

      setWatch(function() { 
          console.log('Yay!');
      }, BTN1, { repeat:true, edge:"rising" });
    • Atwood’s Law

    • Espruino specs

      • 32-bit 72MHz ARM Cortex M3 CPU
      • 256KB of Flash memory, 48KB of RAM
      • 44 GPIO Pins

      (Image: Espruino)

    • Pure Javascript
      Ridiculously easy to use
      Enables fast, cheap, efficient prototyping

    • (Image of a spectrum from LEGO kid, to JS hipster dev with Mac, to crazy nerd)

    • Modules:

      http = require('http');
    • Turn on the on-board LEDs:

      LED1.write(1);
    • Connect to WiFi:

      wlan = require("CC3000").connect();
      wlan.connect( "SSID", "omg_is_cleartext!",
        function() { // yay! });
    • HTTP Server:

      http.createServer(function (req, res) {
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.write('Hello, out there! Is the movie over?!');
        res.end();
      }).listen(80);
    • Where do I start?

      Espruino
      Header packs
      Breadboard
      Soldering iron
      AdaFruit
      SparkFun
      Fritzing

      (Images: collage of all the above)

    • Hands.
      Not mobile -> objects. Enchanted

    • Vessyl.
      David Rose

    • Good news -> Devs

    • Add smarts -> need microcontrollers
      Historically hard, advanced electronics

    • Consequence -> dev fear
      2 months ago -> zero knowledge -> my wife
      What changed?

    • Open Source Hardware -> Lowered the barrier
      Grew community
      Still hard to grok

    • Enter JS

    • New wave of hardware
      Devices run JS native / thin layer
      Cheap = OK, Not in CHF!
      Cost down = experimentation up

    • Last year, espruino CHF 40…
      …then…Tessel
      AND Cylon.js: physical computing framework!

    • challenge -> power
      protocols + standarization (Thread)

    • you came here -> you know
      JS users speak async
      JS in all layers
      Bret Victor
      events, i don’t mean these…

      • focus on Espruino + Tessel
        48kb - wikipedia 10 times
        Espruino is special = beginner & advanced -> in a minute

      • no V8
        3 minutes from unbox to REPL
        flashing easy -> no bricks
        efficient -> events -> optimization on hardware

      • one way of helping, ‘getting started’ UX
        blocky + asm (irony of writing ASM on JS IDE)
        center stage -> us, JS devs

      • node.js inspired
        modules -> sensors

      • No wifi on board, but builtin module

      • http server, in 5 lines

      • Web IDE: LED blink & distance reading

        I started with enchanted obj != LED blink
        Combination = magic
        Zero to robot = 2 days

        Experiment!
        GOAL: Run over the birds!

      {"cards":[{"_id":"4621071212074c7259000054","treeId":"4620c0a712074c7259000018","seq":322776,"position":0.5,"parentId":null,"content":"**Preparation**"},{"_id":"4620c9a812074c725900001a","treeId":"4620c0a712074c7259000018","seq":322554,"position":1,"parentId":null,"content":"Introduction\n"},{"_id":"4620ccb712074c725900001c","treeId":"4620c0a712074c7259000018","seq":832840,"position":1,"parentId":"4620c9a812074c725900001a","content":"Hi everyone, thanks for coming!\n\nI'm Gonzalo Casas.\n\nI am a software engineer in the mobile team at local.ch. \n\nBefore we begin, let me ask you, how many of you guys have have played with Arduino before? Hands...? And what about knowledge of electronics? Ok, for those that didn't raise the hand: don't worry, it's gonna be alright!\n\nAs I was saying, I work for a mobile team, but today I am NOT going to talk about mobile. Well, at least, not about smart phones. Instead of that, today I want to tell you about a special kind of objects: enchanted objects."},{"_id":"4620ce2f12074c725900001d","treeId":"4620c0a712074c7259000018","seq":322543,"position":1,"parentId":"4620ccb712074c725900001c","content":"Gonzalo Casas\nMobile Engineer at local.ch"},{"_id":"4641c1d9d511896fc900003e","treeId":"4620c0a712074c7259000018","seq":334501,"position":1,"parentId":"4620ce2f12074c725900001d","content":"Hands.\nNot mobile -> objects. Enchanted"},{"_id":"4620d03e12074c7259000021","treeId":"4620c0a712074c7259000018","seq":322556,"position":2,"parentId":null,"content":"Status quo"},{"_id":"4620cfae12074c7259000020","treeId":"4620c0a712074c7259000018","seq":832848,"position":2,"parentId":"4620d03e12074c7259000021","content":"What do I mean by Enchanted Objects? These are ordinary items with extraordinary abilities. They can interact with us and with each other, they can sense the world and react to it. And they are almost magical.\n\nOne example of an enchanted object is the Vessyl. Looks like a cup, a bit hipster perhaps, but a cup nonetheless; however it's packed with sensors and can tell you things like how much caffeine you had today. All in a seemingly normal object. Not sure if this object is really ever going to be useful, or even produced, but the idea of adding magic to objects is very appealing to me.\n\nThe metaphor of enchanted objects was developed and published by David Rose, an MIT Media Lab Researcher. It is a beautiful rephrasing of the buzz phrase 'Internet of Things'."},{"_id":"4620d0c312074c7259000022","treeId":"4620c0a712074c7259000018","seq":322578,"position":1,"parentId":"4620cfae12074c7259000020","content":"**Enchanted objects**\n\nOrdinary things with extraordinary abilities\nInterconnected\nSensing\nActive\n\n(Background image: Vessyl image)"},{"_id":"4641c5f2d511896fc9000040","treeId":"4620c0a712074c7259000018","seq":334502,"position":1,"parentId":"4620d0c312074c7259000022","content":"Vessyl.\nDavid Rose"},{"_id":"4620d2d812074c7259000023","treeId":"4620c0a712074c7259000018","seq":832854,"position":3,"parentId":"4620d03e12074c7259000021","content":"You all know this quote, and it sums it up pretty well.\n\nThe good news is that we, as developers, are in center stage to make this happen. We can make the magic work."},{"_id":"4620d90b12074c7259000024","treeId":"4620c0a712074c7259000018","seq":324633,"position":1,"parentId":"4620d2d812074c7259000023","content":"> \"Any sufficiently advanced technology is indistinguishable from magic.\"\n> -- Arthur C. Clarke\n\n(Background image: HAL 9000)"},{"_id":"4641c6bbd511896fc9000041","treeId":"4620c0a712074c7259000018","seq":334503,"position":1,"parentId":"4620d90b12074c7259000024","content":"Good news -> Devs"},{"_id":"4620df2f12074c7259000025","treeId":"4620c0a712074c7259000018","seq":322596,"position":3,"parentId":null,"content":"The problem"},{"_id":"4620df6d12074c7259000026","treeId":"4620c0a712074c7259000018","seq":332340,"position":1,"parentId":"4620df2f12074c7259000025","content":"In order to add smarts to an object we program it, and to program it we need a small enough computer to fit it: we need microcontrollers. \n\nThe problems is that this has been historically very hard to actually do. \n\nBut microcontrollers are traditionally associated with advanced knowledge in electronics, low-level programming, proprietary APIs, awful toolchains, etc.\n\nBasically, there is a very high barrier to entry into this world."},{"_id":"4620dffd12074c7259000027","treeId":"4620c0a712074c7259000018","seq":324705,"position":1,"parentId":"4620df6d12074c7259000026","content":"**Traditional microcontrollers**\n\nHigh barrier to entry\nVery tricky to debug\nProprietary/crippled toolchains"},{"_id":"4641c717d511896fc9000042","treeId":"4620c0a712074c7259000018","seq":334505,"position":1,"parentId":"4620dffd12074c7259000027","content":"Add smarts -> need microcontrollers\nHistorically hard, advanced electronics"},{"_id":"4620e0ba12074c7259000028","treeId":"4620c0a712074c7259000018","seq":332343,"position":2,"parentId":"4620df2f12074c7259000025","content":"Only the brave used to dive into this arcane world. The rest of us just stayed as far as possible from a soldering iron.\n\nI know it because that was me 2 months ago! I have basically zero knowledge of electronics, or electricity for that matter. And that's one of the reasons why I'm here, I want to show you that you don't need to know much of electronics to get into this world. You should not fear the soldering iron. :)\n\nMy wife always complains, we spent 2 years with a standard light bulb as the only lighting in our living room because installing the IKEA ceiling lights was too hard a task for me.\n\nSo, what changed?\nNot me for sure, I'm still equally ignorant about these topics."},{"_id":"4620e13412074c7259000029","treeId":"4620c0a712074c7259000018","seq":334506,"position":1,"parentId":"4620e0ba12074c7259000028","content":"GIF: fear of the soldering iron."},{"_id":"4641ca9bd511896fc9000043","treeId":"4620c0a712074c7259000018","seq":334508,"position":1,"parentId":"4620e13412074c7259000029","content":"Consequence -> dev fear\n2 months ago -> zero knowledge -> my wife\nWhat changed?\n"},{"_id":"4620e3a112074c725900002a","treeId":"4620c0a712074c7259000018","seq":334269,"position":3,"parentId":"4620df2f12074c7259000025","content":"It is our industry that is changing. One of the big steps forward was Arduino board and the whole Open Source Hardware movement. \n\nArduino lowered the barrier of entry, made it cheaper, easier, grew a big community around it.\n\nBUT it still has a slow Edit-Compile-Run cycle.\n\nAnd it is still a relatively low-level programming language. I am sure many of you guys will disagree, but if there's one language I don't want to use, that has to be C. And Java, but that's a different story.\n\nBack to Arduino, besides being a great improvement over the previous situation, debugging is still tricky, multi-tasking is tricky, and it still *feels* relatively hard to grok for an outsider."},{"_id":"4620e3ef12074c725900002b","treeId":"4620c0a712074c7259000018","seq":324711,"position":1,"parentId":"4620e3a112074c725900002a","content":"**Arduino**\n\nMakes things better\nBut debugging is still tricky\nMultitasking is hard\n\n(Image: Arduino)"},{"_id":"4641d66ad511896fc9000044","treeId":"4620c0a712074c7259000018","seq":334509,"position":1,"parentId":"4620e3ef12074c725900002b","content":"Open Source Hardware -> Lowered the barrier\nGrew community\nStill hard to grok"},{"_id":"4620e49412074c725900002c","treeId":"4620c0a712074c7259000018","seq":322633,"position":4,"parentId":null,"content":"The solutions: What is there?"},{"_id":"4620e9a112074c725900002d","treeId":"4620c0a712074c7259000018","seq":322623,"position":1,"parentId":"4620e49412074c725900002c","content":"Enter Javascript."},{"_id":"4620ea2512074c725900002e","treeId":"4620c0a712074c7259000018","seq":324918,"position":1,"parentId":"4620e9a112074c725900002d","content":"Javascript <3 Microcontrollers\n\nGIF: BMO Dance"},{"_id":"4641dec4d511896fc9000045","treeId":"4620c0a712074c7259000018","seq":334413,"position":1,"parentId":"4620ea2512074c725900002e","content":"Enter JS"},{"_id":"4620ea9112074c725900002f","treeId":"4620c0a712074c7259000018","seq":322629,"position":2,"parentId":"4620e49412074c725900002c","content":"There's a new wave of hardware coming, I am going to call it zero-friction hardware for now. \n\nIt is hardware that aims to have the least friction possible to get you started with it.\n\nIt is not just about Javascript, but that is a big part of it. \n\nThese are devices that run Javascript, either natively or with a very thin layer, are cloud-enabled or have mesh networking support, are truly plug and play, are based on open source hardware designs, have open communities. And they are CHEAP. Ok, maybe not so much in CH, but again that's another story!\n\nAs the cost of these devices drops we are going to see an explosion of experimentation in the developer community.\n"},{"_id":"4620eafd12074c7259000030","treeId":"4620c0a712074c7259000018","seq":322631,"position":1,"parentId":"4620ea9112074c725900002f","content":"**Zero-friction hardware**\n\nJavascript-based\nCloud-enabled\nMesh networks\nTrue PnP\nOpen source hardware\nCommunity\nand CHEAP!\n\n(Image: use a collage for each of these points instead of bullet points)"},{"_id":"4641df62d511896fc9000046","treeId":"4620c0a712074c7259000018","seq":334511,"position":1,"parentId":"4620eafd12074c7259000030","content":"New wave of hardware\nDevices run JS native / thin layer\nCheap = OK, Not in CHF!\nCost down = experimentation up"},{"_id":"4620ecfe12074c7259000031","treeId":"4620c0a712074c7259000018","seq":328371,"position":3,"parentId":"4620e49412074c725900002c","content":"There is going to be an explosion of JS-based hardware. In fact, it is already happening.\n\nLast year, the Espruino board was kickstarted, a CHF 40 board that runs Javascript natively and has been shipping since the beginning of the year. \n\nLast month, the Tessel started shipping, another crowd-funded board that runs JS natively, with a strong focus on Node.js.\n\nThere are lots more: Pinoccio that promises super easy mesh networks. Spark Core which is an Arduino compatible little board and ships with a great 'Get started' experience and cloud-enabled services. Literally, you plug the thing it will online in 2 minutes. Intel's Edison computer, a low-cost board with WiFi built-in, all packed in about the size of an SD card.\n\nIn the same line of zero-barrier hardware, but less focused on JS itself, we have these card-sized computers. Not SD cards, but more like credit card size. The Raspberry Pi being the prime example, or its cousin the BeagleBone Black. This guy comes with node.js and Cloud9 editor pre-installed."},{"_id":"4620ed2e12074c7259000032","treeId":"4620c0a712074c7259000018","seq":322644,"position":1,"parentId":"4620ecfe12074c7259000031","content":"**The JS hardware explosion**\n\nEspruino, Tessel, Pinoccio, Spark Core, Intel Edison, BeagleBone Black, Raspberry Pi\n\n(Image: use a collage with the logos)"},{"_id":"4641e889d511896fc9000047","treeId":"4620c0a712074c7259000018","seq":334582,"position":1,"parentId":"4620ed2e12074c7259000032","content":"Last year, espruino CHF 40...\n...then...Tessel\nAND Cylon.js: physical computing framework!"},{"_id":"4620ee5112074c7259000033","treeId":"4620c0a712074c7259000018","seq":322649,"position":4,"parentId":"4620e49412074c725900002c","content":"One of the big challenges for all these boards is to keep power consumption to the minimum. And networking is kind of a problem on this matter, because it tends to be pretty power-hungry.\n\nThere is no shortage of initiatives on this front either. Besides WiFi, we have a lot of new protocols popping up everywhere. Protocols especially designed to fit low-power devices, like mesh network protocols (e.g. Z-Wave, ZigBee, Insteon, Weightless standard), or BLE (the technology behind the most over-hyped buzzword of the year: Apple's iBeacon). \n\nThere are also standardization efforts going on: the Thread Group is a joint effort by Nest (Google), Samsung and ARM to have an IPv6 networking protocol designed for mesh networks and low-power devices, built on open standards."},{"_id":"4620ee7912074c7259000034","treeId":"4620c0a712074c7259000018","seq":322654,"position":1,"parentId":"4620ee5112074c7259000033","content":"**Net for things**\nWiFi\nMesh\nBLE\n"},{"_id":"4641edf3d511896fc9000048","treeId":"4620c0a712074c7259000018","seq":334513,"position":1,"parentId":"4620ee7912074c7259000034","content":"challenge -> power\nprotocols + standarization (Thread)"},{"_id":"4620ef5c12074c7259000035","treeId":"4620c0a712074c7259000018","seq":322659,"position":5,"parentId":null,"content":"The solutions: Why?"},{"_id":"4620ef9912074c7259000036","treeId":"4620c0a712074c7259000018","seq":322663,"position":1,"parentId":"4620ef5c12074c7259000035","content":"Perhaps one open question is: why would we want to program microcontrollers in Javascript? Why Javascript of all the languages in the world?\n\nWell, you all came to a JS conference, so I guess you already have a few ideas of why this is might be.\n\nThe single most important reason for this is Javascript's huge user base. And by user here I mean developers. We are the users of the language. There are literally millions of developers around the globe that already speak Javascript. Not only that, they also speak async, which -we will see soon- it a fundamental characteristic of these boards.\n\nThis huge reach also means that means nowadays Javascript runs everywhere. Literally, in every device and application layer you can think of.\n\nThe next one is instant gratification: we don't need any Edit-Compile-Run cycles, we write code, we run it. Instant gratification. Is a very powerful enabler for innovation.\n\nAnd then we have events. Javascript is an event-based language, we have events built right into it, and we're very used to the asynchronous paradigm it presents to us.\n\nAnd it just happens that this event-based nature is very convenient for a microcontroller: leveraging it, these boards can be extremely power-efficient, they can go into deep sleep and just wait for an event to wake them up.\n\nWhen I talk about events, I don't mean these..."},{"_id":"4620f01512074c7259000037","treeId":"4620c0a712074c7259000018","seq":322671,"position":1,"parentId":"4620ef9912074c7259000036","content":"**Why Javascript?**\n\nCommunity: Massive user base\nInstant gratification\nEvents"},{"_id":"4641f06fd511896fc9000049","treeId":"4620c0a712074c7259000018","seq":334584,"position":1,"parentId":"4620f01512074c7259000037","content":"you came here -> you know\nJS users speak async\nJS in all layers\nBret Victor\nevents, i don't mean these..."},{"_id":"4620f31f12074c725900003b","treeId":"4620c0a712074c7259000018","seq":322684,"position":2,"parentId":"4620ef5c12074c7259000035","content":"These were Javascript events back in 1997.\nAnd these are events in the Espruino."},{"_id":"4620f39e12074c725900003c","treeId":"4620c0a712074c7259000018","seq":322709,"position":1,"parentId":"4620f31f12074c725900003b","content":"Javascript events in 1997:\n```\n<a href=\"http://home.netscape.com/comprod/mirror/index.html\">\n <img onmouseover=\"this.src='on.gif'\" onmouseout=\"this.src='off.gif'\">\n Best viewed with Netscape Navigator 3.0\n</a>\n```\n\nEvents in Espruino:\n```\nsetWatch(function() { \n console.log('Yay!');\n}, BTN1, { repeat:true, edge:\"rising\" }); \n```"},{"_id":"4620f7ed12074c725900003d","treeId":"4620c0a712074c7259000018","seq":322717,"position":3,"parentId":"4620ef5c12074c7259000035","content":"And finally, because we CAN!"},{"_id":"4620f80e12074c725900003e","treeId":"4620c0a712074c7259000018","seq":322719,"position":1,"parentId":"4620f7ed12074c725900003d","content":"Atwood's Law"},{"_id":"4620f8e012074c725900003f","treeId":"4620c0a712074c7259000018","seq":322721,"position":6,"parentId":null,"content":"The solutions: How?"},{"_id":"4620f91712074c7259000040","treeId":"4620c0a712074c7259000018","seq":322723,"position":1,"parentId":"4620f8e012074c725900003f","content":"A few minutes ago, I mentioned several boards that can run Javascript. Each has its strengths but there are two that are particularly focused on Javascript: Espruino and Tessel. I want to take the Espruino as an example, show you which features it brings to the table, and show you a bit of code.\n\nEspruino is particular in that it targets both beginners and seasoned makers alike. I'll get to how it does that in a minute."},{"_id":"4620f93c12074c7259000041","treeId":"4620c0a712074c7259000018","seq":328458,"position":1,"parentId":"4620f91712074c7259000040","content":"**Espruino specs**\n- 32-bit 72MHz ARM Cortex M3 CPU\n- 256KB of Flash memory, 48KB of RAM\n- 44 GPIO Pins\n\n(Image: Espruino)"},{"_id":"4641f89fd511896fc900004c","treeId":"4620c0a712074c7259000018","seq":334587,"position":1,"parentId":"4620f93c12074c7259000041","content":"focus on Espruino + Tessel\n48kb - wikipedia 10 times\nEspruino is special = beginner & advanced -> in a minute"},{"_id":"4620f9f812074c7259000042","treeId":"4620c0a712074c7259000018","seq":334479,"position":2,"parentId":"4620f8e012074c725900003f","content":"It is a pure Javascript board, it has no OS, there's no message passing, no nothing, just a JS interpreter as firmware.\n\nIt's also worth noting that it runs a custom implementation of JS, it's not V8 or SpiderMonkey. Mainly due to the memory usage constraints. It's about 95% compatible with ES5 spec.\n\nIt's also just ridiculously easy to get started with. It takes under 3 minutes from un-boxing to running code. This is in part because the IDE is a Chrome Web App, so there's no download, no installation, just open and start hacking. Also because of Javascript itself: there's no Edit-Compile-Run cycle. You open the IDE and you have a REPL right there, you can start running code on the device without further ado.\n\nFlashing the firmware with updates to the JS interpreter is a breeze as well, no risk of bricking the device, directly from the Web IDE.\n\nOverall a very streamlined 'getting started' experience.\n\nIt is a device that enables fast, cheap and efficient hardware prototyping. The efficiency part comes from the events on hardware level.\n\nThe fact that events are implemented on the hardware level means the board can do cooperative multitasking with very little overhead, and can do heavy optimizations of power supply and deep sleep cycles.\n"},{"_id":"4620fa9812074c7259000043","treeId":"4620c0a712074c7259000018","seq":322730,"position":1,"parentId":"4620f9f812074c7259000042","content":"Pure Javascript\nRidiculously easy to use\nEnables fast, cheap, efficient prototyping"},{"_id":"4641feb4d511896fc900004d","treeId":"4620c0a712074c7259000018","seq":334520,"position":1,"parentId":"4620fa9812074c7259000043","content":"no V8\n3 minutes from unbox to REPL\nflashing easy -> no bricks\nefficient -> events -> optimization on hardware"},{"_id":"4620fd9812074c7259000046","treeId":"4620c0a712074c7259000018","seq":322738,"position":4,"parentId":"4620f8e012074c725900003f","content":"I mentioned that this board targets beginners and experienced developers. One way it does that is by having this very smooth 'getting started' experience. \n\nAlso, I keep saying this is a JS board, but in fact, there are other two programming languages you can use with it. One is Blocky, it's this LEGO-like visual editor that is awesome for education, especially with young kids. The programs built it is are actually exported to Javascript, so in fact this is just a graphical layer on top of it, but there fact that is there is important for a lot of people.\n\nOn the other end, we have Assembler support. That sounds pretty bizarre, and I really don't know if anyone is actually using it, but it's there if you want to rejoice in the irony of writing assembler directly on an IDE that is built on Javascript.\n\nSo you see, on one hand we have features that enables your 10-year old brother or sister to play with it, and on the other hand, some features for the hardcore makers. But in center stage its us, Javascript developers.\n"},{"_id":"4620fdb912074c7259000047","treeId":"4620c0a712074c7259000018","seq":322740,"position":1,"parentId":"4620fd9812074c7259000046","content":"(Image of a spectrum from LEGO kid, to JS hipster dev with Mac, to crazy nerd)"},{"_id":"46420719d511896fc900004e","treeId":"4620c0a712074c7259000018","seq":334597,"position":1,"parentId":"4620fdb912074c7259000047","content":"one way of helping, 'getting started' UX\nblocky + asm (irony of writing ASM on JS IDE)\ncenter stage -> us, JS devs"},{"_id":"4620fedb12074c7259000048","treeId":"4620c0a712074c7259000018","seq":322745,"position":7,"parentId":null,"content":"Demonstration"},{"_id":"4620ff2312074c7259000049","treeId":"4620c0a712074c7259000018","seq":334491,"position":1,"parentId":"4620fedb12074c7259000048","content":"So I said I wanted to show you some code. Let's start with some code snippets. First thing is modules. Espruino comes with a Node.js inspired module loader. It is not really node.js, but it feels like it. What is actually does is going to a repository of Espruino modules, getting a minified version of the module and uploading it together with your code. There's a pretty nice selection of modules available, mostly for different sensors, shields, and the like."},{"_id":"4620ff4b12074c725900004a","treeId":"4620c0a712074c7259000018","seq":329210,"position":1,"parentId":"4620ff2312074c7259000049","content":"**Modules:**\n```\nhttp = require('http');\n```"},{"_id":"46420a8dd511896fc900004f","treeId":"4620c0a712074c7259000018","seq":334523,"position":1,"parentId":"4620ff4b12074c725900004a","content":"node.js inspired\nmodules -> sensors"},{"_id":"4631c7bf9e879c484d00008b","treeId":"4620c0a712074c7259000018","seq":329217,"position":1.5,"parentId":"4620fedb12074c7259000048","content":"Then, the canonical 'Hello World' of microcontrollers: how to turn on a LED. Trival.\n\nThen, how to connect to WiFi. again extremely trivial. The Espruino doesn't ship with wifi on-board, you have to get a separate module and wire it. But it's also really simple to do it.\n\nAnd one more, serving HTTP requests directly from the Espruino. In 5 lines."},{"_id":"4631c04f9e879c484d000088","treeId":"4620c0a712074c7259000018","seq":329218,"position":1,"parentId":"4631c7bf9e879c484d00008b","content":"**Turn on the on-board LEDs:**\n```\nLED1.write(1);\n```"},{"_id":"4631c0ce9e879c484d000089","treeId":"4620c0a712074c7259000018","seq":329227,"position":2,"parentId":"4631c7bf9e879c484d00008b","content":"**Connect to WiFi:**\n```\nwlan = require(\"CC3000\").connect();\nwlan.connect( \"SSID\", \"omg_is_cleartext!\",\n function() { // yay! });\n```"},{"_id":"46420d44d511896fc9000050","treeId":"4620c0a712074c7259000018","seq":334524,"position":1,"parentId":"4631c0ce9e879c484d000089","content":"No wifi on board, but builtin module"},{"_id":"4631c1239e879c484d00008a","treeId":"4620c0a712074c7259000018","seq":329228,"position":3,"parentId":"4631c7bf9e879c484d00008b","content":"**HTTP Server:**\n```\nhttp.createServer(function (req, res) {\n res.writeHead(200, {'Content-Type': 'text/plain'});\n res.write('Hello, out there! Is the movie over?!');\n res.end();\n}).listen(80);\n```"},{"_id":"46420f0dd511896fc9000051","treeId":"4620c0a712074c7259000018","seq":334525,"position":1,"parentId":"4631c1239e879c484d00008a","content":"http server, in 5 lines"},{"_id":"4621029d12074c725900004b","treeId":"4620c0a712074c7259000018","seq":322756,"position":2,"parentId":"4620fedb12074c7259000048","content":"Ok.\n\nI started this session talking about enchanted objects.\n\nAn enchanted object is surely not a board with a blinking LED. Or service a simple HTTP response. But if we combine the tools we already use with these new devices, we can compose things in new ways, and approach those magic properties I was talking about.\n\nMy personal project with the Espruino is this robot. It is not really sophisticated, but there's one thing about it that still amazes me. I was able to build it from scratch in about one an a half days. But when I mean 'from scratch', I really mean it: I mean, I bought my first soldering iron that week, and it was the first time I used such a tool! So, literally going from never having done anything with electronics, to a robot that actually works in less than 2 days, that blew my mind.\n\nSo I want to do a social experiment. And see if we can add some magic to this thing. The robot is pretty simple, right now the program is just waiting for commands, so it has no exploration logic in it. It does have a distance ranging sensor, but that is just to avoid hitting stuff.\n\nBut I don't want to control it myself. I want you to control it. All together. In a collective intelligence coordination kind of way.\n\nI prepared a remote control for you, guys. It is a super simple Javascript (what else) web app. The app will log all your commands, average the most voted one on a sliding window of 5 seconds, and then the robot will move.\n\nNow, please take your phones. Yes, NOW it is good etiquette to do so. Open this URL. And command the robot. \n\nSpecial brownie points if you get it do draw a square shape around this.\n"},{"_id":"462102bd12074c725900004c","treeId":"4620c0a712074c7259000018","seq":322758,"position":1,"parentId":"4621029d12074c725900004b","content":"Demo time\n\nhttp://m.local.ch/robots\n"},{"_id":"4642115ed511896fc9000052","treeId":"4620c0a712074c7259000018","seq":334591,"position":1,"parentId":"462102bd12074c725900004c","content":"Web IDE: LED blink & distance reading\n\nI started with enchanted obj != LED blink\nCombination = magic\nZero to robot = 2 days\n\nExperiment!\nGOAL: Run over the birds!"},{"_id":"4621039a12074c725900004d","treeId":"4620c0a712074c7259000018","seq":322759,"position":8,"parentId":null,"content":"Closure"},{"_id":"462103ba12074c725900004e","treeId":"4620c0a712074c7259000018","seq":322760,"position":1,"parentId":"4621039a12074c725900004d","content":"Ok, I hope you enjoyed that.\n\nTo finalize, one last question you might be asking yourselves. \"All very nice, but, where the heck do I start?\"\n\nEasy. First get yourself one of these guys, be it the Espruino or one of the others. Then while you wait for the shipment, read up! AdaFruit and SparkFun have amazing tutorials and learning resources. In fact, you don't even need to read, they have video tutorials. And once you get it, start hacking! It's that easy.\n\nDon't fear the soldering iron! Get yourself breadboards and header packs in abundance so that you can prototype like a mad man, and the, document your builds! \n\nFritzing is your friend. Publish what you discover, get involved in the community!\n"},{"_id":"462103d712074c725900004f","treeId":"4620c0a712074c7259000018","seq":322765,"position":1,"parentId":"462103ba12074c725900004e","content":"**Where do I start?**\n\nEspruino\nHeader packs\nBreadboard\nSoldering iron\nAdaFruit\nSparkFun\nFritzing\n\n(Images: collage of all the above)"},{"_id":"4621045d12074c7259000050","treeId":"4620c0a712074c7259000018","seq":322763,"position":2,"parentId":"4621039a12074c725900004d","content":"So, yes, that would be it for now. I hope you enjoyed it and now, GO and Script all the things!!"},{"_id":"4621049812074c7259000051","treeId":"4620c0a712074c7259000018","seq":322764,"position":1,"parentId":"4621045d12074c7259000050","content":"Thank you!\nQuestions?\n"},{"_id":"462105f712074c7259000053","treeId":"4620c0a712074c7259000018","seq":322769,"position":2,"parentId":"4621045d12074c7259000050","content":"**Credits**\nDavid Rose, http://www.amazon.com/Enchanted-Objects-Design-Desire-Internet/dp/1476725632"}],"tree":{"_id":"4620c0a712074c7259000018","name":"Script all the things!","publicUrl":"script-all-the-things"}}