Node.js for Embedded Systems

This post is an excerpt of the Chapter 3 of “Node.js for the Web of Things” in “Building the Web of Things“, a Manning book by Dominique Guinard and Vlad Trifa.

Long gone are the days when JavaScript was solely used to animate banners on a web page! Thanks to its widespread support by virtually all web browsers, relative ease of use, and flexibility, JavaScript has become the de-facto solution for writing dynamic, client-side applications.

Developers usually love or hate JavaScript for various good (or less good) reasons but overall it is safe to say that it isn’t safe anymore to ignore JavaScript! According to the number of public repositories on GitHub, it has also become one of the most popular programming languages ever, with a community of developers growing faster than any other.
This popularity in parts linked to the fact that a few years back (in 2009) JavaScript entered a new space: the space of server side applications in the form of Node.js or aka Node. Node provides an event-driven architecture and a non-blocking I/O API that optimizes an application’s throughput and scalability. This model is commonly used to design high-performance Data-Intensive Real-Time (DIRT) applications. Node basically took the Web by a storm with a simple core principle moving out of the one-request-one-thread model of most Web servers back them (Apache, older Tomcat, etc.):


to a system where all requests are served by the same thread but parked until the I/O operations the request depends on have returned:


Okay well what does it have to do with the Internet of Things or the Web of Things?

Well it turns out that Node did not stop at the server. Over the past few years it also sneaked into the very core of Things and devices! In a world massively dominated by devices running low-level C programs, JavaScript and Node.js have managed to stand out as a viable and easy-to-use alternative for powering all kinds of things from robots to wireless sensor nodes. Indeed, a number of embedded device platforms today directly support JavaScript and Node.js to write embedded code. This is the case for most Linux-based platforms such as the Raspberry Pi, the Intel Edison, or BeagleBoards, but also for some low-power platforms such as the Tessel or Espruino.

“When you have a hammer, everything looks like a nail!” we hear you say! Not exactly: we don’t advocate using JavaScript and Node.js for every IoT implementation. We’d rather compare JavaScript and Node.js to the Swiss army knife of modern IoT and WoT development than to a hammer. It certainly isn’t the optimal solution for every IoT project we can think of, but it’s quite good at a number of things!

An embedded application requiring absolutely predictable and real-time performance (for example, the code running in a high-speed train) is better off being written in a low-level language such as C. Moreover, JavaScript as a language is often criticized by its detractors for its lack of static typing and a plethora of different programming patterns and styles leading to code that’s sometimes harder to maintain, such as for very big projects involving a large number of people. Nevertheless, its ubiquity, portability, asynchronous event-driven model, along with a large and vibrant online community make it a solid candidate to consider seriously, especially when using Node.js to build scalable and real-time web systems, but also increasingly more frequently for the blazing-fast development of hardware projects.

You can see this in a number of recent Node.js projects from programming robots with Johny-Five and Cylon.js, to creating physical mashups with Node-red and EVRYTHNG or elegantly and efficiently manage GPIOs with onoff.

The recent domination of Node for the IoT does not stop at libraries: new embedded systems are now built with Node and JavaScript as their primary development platform. This is the case of the Samsung Artik platform, the Intel Edison, the BeagleBone black, the Tessel or the Espurino. These great developments show that Node for embedded systems isn’t simply a short living trend: like it or not it is here to stay and makes embedded devices more accessible by bringing them one step closer to the Web!

This is why we decided to adopt Node and JavaScript as the main language for our book. You can already check all the Node and JavaScript examples of the book on our GitHub repository and should this be not enough to convince you getting the book then check webofthings.js, a sample Web of Things server for the Pi, Beaglebone or Edison that you’ll learn how to build step by step in Building the Web of Things.

23 Responses

  1. says:

    obviously like your web-site however you need to check the spelling on quite a few of your posts. Several of them are rife with spelling problems and I find it very bothersome to tell the truth however I will surely come back again.

  2. I admire your work, thankyou for all the useful posts.

  3. Some truly fantastic info , Gladiolus I discovered this. “Without discipline, there’s no life at all.” by Katharine Hepburn.

  4. more... says:

    I have been surfing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the web will be much more useful than ever before.

  5. QQ188 says:

    I have been browsing on-line more than three hours lately, yet I by no means discovered any interesting article like yours. It is lovely worth enough for me. In my opinion, if all site owners and bloggers made good content as you did, the internet will likely be much more useful than ever before.

  6. Hello, i think that i noticed you visited my site thus i got here to “return the prefer”.I am attempting to to find issues to enhance my web site!I assume its good enough to use some of your ideas!!

  7. Hey There. I found your blog using msn. This is a very well written article. I will make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I will definitely return.

  8. I am no longer certain the place you’re getting your info, but great topic. I must spend some time learning more or figuring out more. Thanks for great information I used to be on the lookout for this information for my mission.

  9. I¦ve read a few excellent stuff here. Certainly value bookmarking for revisiting. I wonder how a lot effort you set to create this sort of great informative site.

  10. Hola! I’ve been following your web site for some time now and finally got the courage to go ahead and give you a shout out from Houston Tx! Just wanted to say keep up the fantastic work!

  11. Hello. fantastic job. I did not anticipate this. This is a impressive story. Thanks!

  12. I likewise think therefore, perfectly composed post! .

  13. I got what you mean , thankyou for putting up.Woh I am glad to find this website through google.

  14. I am lucky that I discovered this weblog, exactly the right information that I was looking for! .

  15. rodaslot88 says:

    You made certain good points there. I did a search on the matter and found mainly persons will consent with your blog.

  16. I went over this site and I believe you have a lot of wonderful info, saved to favorites (:.

  17. You have noted very interesting details! ps nice website . “Hares can gamble over the body of a dead lion.” by Publilius Syrus.

  18. um surabaya says:

    Howdy! Someone in my Myspace group shared this site with us so I came to look it over. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Exceptional blog and excellent style and design.

  19. Hello there! Do you use Twitter? I’d like to follow you if that would be okay. I’m definitely enjoying your blog and look forward to new posts.

  20. Delve into the Lightning Network: Bitcoins layer-2 solution enhancing speed and reducing fees. Understand its mechanics, benefits, and transformative potential.

  21. INSS says:

    This is the right blog for anyone who wants to find out about this topic. You realize so much its almost hard to argue with you (not that I actually would want…HaHa). You definitely put a new spin on a topic thats been written about for years. Great stuff, just great!

  22. Regards for this marvelous post, I am glad I detected this site on yahoo.

  23. We’re a group of volunteers and opening a new scheme in our community. Your site offered us with valuable information to work on. You’ve done an impressive job and our whole community will be grateful to you.

Leave a Reply

Your email address will not be published. Required fields are marked *