JSFoo 2015

The future of JavaScript

Andrew Fisher


NodeBots & JS Hardware Workshop

Submitted Jul 28, 2015

As the Internet of Things takes off, building devices that can operate in the physical world but can talk to the Web becomes an important part of the skills of the web developer.

This workshop will provide a good foundation for how you can use JavaScript to be able to work with and build physical Internet Connected Things as well as Robots.


As well as being a great web language, JavaScript is well suited to working with the physical world too.

This workshop will be a hands on exploration of NodeBots - a JS framework for building web connected, physical world things - culminating in a BattleBots session at the end of the day.

The session will start with an introduction to the nodebots stack covering how to use javascript to control physical things with examples focussed on some common tasks in order to get everyone up and running as quickly as possible.

From there we will get into small teams of 2-3 people and build a SimpleBot with the aim of competing in a Sumo Battle at the end of the day. SimpleBots are highly configurable and customisable, yet very straightforward wheeled robots designed for teaching. Augmented with some creativity and some code they are also great little battle bots.

The Sumo battle challenge is designed to teach fundamentals of construction (physical and electronics), drive mechanisms and control and real world event handling, as well as being just lots of fun!

Participants will leave having a good knowledge of the JS Hardware stack, how to start working with simple electronics using JavaScript and having designed and built a robot based on requirements.

NodeBots Workshop Bangalore - post session follow up.

Here are some post-workshop notes in order to keep going with JS & Hardware.


www.johnny-five.io is the place to start for all
of the API documentation as well as many examples on different types of hardware.

If you want to understand more about johnny-five, then
check out the code and if you see a
bug please report it in a GH Issue or even better, make a fix and issue a pull
request. If you are serious about JS, I can’t recommend getting involved in
Johnny Five enough, Rick is one of the authors of the ES6 standard and is part
of the group that is shaping the future of the language. As such if you want
to see real instances of ES6 in use and learn a lot on a relatively small
(but significant) code base, this is a good place to do it.

If you have general questions about whether something will work or not or
a particular problem you’ve got then the Johnny Five Gitter
is a good place to hang out. There’s someone there most of the time from the
core team or extended community who can answer a question or three.

To learn a bit more about electronics generally then I would recommend getting
an Arduino Experimenter’s kit. These kits have a lot of different components -
everything from motors to sensors to relays and many other pieces. There is
a great project called Node ARDX which has been designed
to build example projects with the items from the Experimenter’s Kit but use
JavaScript for the code to run it.

SimpleBot kit updates

As you’re all aware, there were a few issues with the servos in the kit. If you
had left before we got a working solution then here are the details of it:

  • Use a 9v battery and provide power and ground to the servo.
  • Don’t forget a common ground between servo, battery and arduino
  • Change the simplebot code in the controller so instead of using servo.cw() or
    servo.ccw() to instead use servo.to(60) and servo.to(120).

Recall that Continuous Rotation servos are a “hack” on normal servos which usually
go between 0 and 180 degrees. This means that when you pass an angle into a CR
servo if you set it to ‘90’ you’re actually setting it to “stop” and the further
from 90 you go in each direction between 0 and 180, the faster you’re making
it turn in a particular direction. So 0 sets it to as fast as possible in the counter
clockwise direction but 45 is only half that speed in CCW direction. Likewise
180 and 135 are the same but in the CW direction.

We are confirming the specifications for these servos however the suspicion is
that they are designed for a remote controlled car or plane. What this means is
that if you use a 7.4V RC battery (Li Ion or LiPoly) then you will probably
have better success. Generally speaking in robotics these batteries are better
anyway, however you will need a specialist charger.

Going wireless

There are two wireless modules in your kit. One is an HC-05 Bluetooth module.
This is an interesting BT module that allows for both master and minion mode so
you can connect your arduino to it in minion mode and take commands from say
your computer. Likewise you could also put it in master mode and have other
devices connect to it as minions.

There is a Bluetooth howto guide in the SimpleBot Rep

Likewise there is a wifi module called the ESP8266 (ESP-01 module). This is an
incredible device which has a microcontroller on it as well that is more
capable than the arduino. However at this point the toolchain to program it is
a little convoluted. Linked from the SimpleBot repo is a Gist which describes
how to use the module in more detail and use it in what’s called “Serial Bridge”
mode - this creates a wifi to serial link which allows you to talk over the
network as though it was on a USB connection.

Going further

  • Look at using the ultrasonic sensor to check for distance and then respond if
    the robot gets close to an obstacle
  • Create a web interface for the robot and control it from a browser through node
  • Add additional servos and get the robot to do other things with some arms not
    just drive around.


Participants should have an good knowledge of JavaScript and at least familiarity with NodeJS as these will be assumed knowledge. No assumptions are made regarding hardware or electronics knowledge as this will be covered in the session enough to get you going (if you’re an electrical engineer you’re welcome to come too though!).

All participants will need to have a laptop that can run nodejs and arduino on it.

The hardware components for the workshop will be supplied.

Please ensure you downloaded the repo below and gone through the installation process before the workshop

[https://github.com/nodebotsau/simplebot](SimpleBot repository)

Speaker bio

Andrew Fisher is a member of the core Johnny-Five team, the most used framework for JS + Hardware, and is the creator and lead maintainer of node-pixel, an open source project for controlling LEDs from JavaScript. He is a co-author of the book, “Make: JavaScript Robotics” and has helped organise and run NodeBots workshops for thousands of developers around the region including Australia, China and Sri Lanka. Andrew also helps design hardware for teaching NodeBots workshops.

When not building robots, Andrew is the Chief Technology Officer and Head of Data Science for JBA, an Australian based consultancy focused on customer experience analysis and design.

  • twitter.com/ajfisher
  • github.com/ajfisher
  • droidsjs.ajf.io
  • github.com/nodebotsau/simplebot




{{ gettext('Login to leave a comment') }}

{{ gettext('Post a comment…') }}
{{ gettext('New comment') }}
{{ formTitle }}

{{ errorMsg }}

{{ gettext('No comments posted yet') }}

Hosted by

JSFoo is a forum for discussing UI engineering; fullstack development; web applications engineering, performance, security and design; accessibility; and latest developments in #JavaScript. Follow JSFoo on Twitter more