The Project board is for sharing projects based on Silicon Labs' component with other community members. View Projects Guidelines ›

So, after a couple of beers, a colleague and me decided that JavaScript had to be the ultimate IoT language. Why? Three reasons:

  • JavaScript is asynchronous
    • Easy to write energy efficient code
  • JavaScript is a scripting language
    • Parsed on the fly
    • Easy to test/develop
    • Easy to debug
  • JavaScript is SOOOOOO hot right now


Where the last bullet of course is the most importantSmiley Happy


So, as any good engineer I didn't want to make everything from scratch, so I searched for alternatives. Turns out there actually exists quite some projects for running JS on IOT devices, like Samsung IoT.jsTessel and Marvells Kinoma. Most of these frameworks are however full JavaScript engines requiring something like 300 MHz to run at adequate speed. To me, that's not too energy-friendly so I opted for a framework that takes some short-cuts on the JavaScript implementation but has a very energy-friendly implementation: Espruino.


You can get the basic info here: and all the source code are available at github: . It has a very easy-to-use web IDE, created for running code on the fly. It also support integration with regular JS development environments like Electron. You can get the web IDE here,


So, after a couple of nights I got the basic support running. It supports timekeeping in EM2, wake-ups from EM2. If you want to try it out, download the attached binary and flash it on your Giant Gecko starter kit. Then open the web IDE and connect to the COM-port of the kit.


If you want some simple examples, you can for example try:

var state=0;

function led_swap() {
  state = !state;

setWatch(led_swap, BTN1, {edge:'falling',repeat:true});


var Clock = require("clock").Clock;
var clk = new Clock(2016,0,27,17,0,0,0);

function setLed() {
  LED1.write(clk.getDate().getSeconds() & 0x1);
  LED2.write(clk.getDate().getSeconds() & 0x2);


If you ever save something to flash (using save()) or send it to EM2 and want to recover the console, just hold down BTN1 (marked as PB0 on the kit) when resetting. There's also a bug that caused the console not to recover after loading from or saving to flash.


Here's two Energy Profiler shots of the examples above:

Example 1, You can see it's using about 2.8 uA when waiting for pin-wakeup and the LED consuming ~0.5mA. You can also see that it actually triggers on both edges (rising & falling) with Espruino validating the trigger.



Example 2:

Again, you can see normal timekeeping at 2.8 uA, and the LEDs consuming 0.5 mA each..



If you want to save something with setDeepSleep() I recommend using the below stub to go to deep sleep after 5 secs, so you have enough time to type save() after uploading the code:

//Go to deep sleep after 5 secs, so we have time to do save()
setTimeout(function() {setDeepSleep(true)}, 5000); 


Lastly, if you want to contribute just get the code from github, there is a Simplicity Studio project located in the targets/efm32 folder. What's currently missing:



- Analog functionality

- Serial over USB (Right now it's using the serial over the debug USB-cable. Should move this to the on-chip USB)

  • Projects
  • 32-bit MCUs
  • JavaScript lends itself well to low-power. Ineresting....

    I'm not a JS guy--I'm a C guy--but I will be interested to see a more productized version of this.
  • I am also interested in this. I am also not much of a JS guy. But my daughter is heavily into JS. About a year ago I thought about trying to run JS on our Gecko hardware. I also found the Espruino stuff. But at the time, it said it was not compatible with MBED hardware and I did not have the time/talent/desire combination to investigate any further.


    This could be very interesting indeed.




  • Sorry for digging up an old thread. But I finally got around to trying this out. Unfortunately, it did not work for me. I didn't get any error messages or anything. It's just that the WEB IDE endlessly indicates "searching" when I hit the connect button. 


    Then I noticed in your original post, " the attached binary and flash it on your Giant Gecko starter kit." I don't have a Giant Gecko starter kit. I have a Wonder Gecko starter kit. Is the Giant Gecko necessary?


    If so, I will get one and try it again.