arrow_back Building Cross Platform Desktop App using Web Technologies with Electron
NodeBots & JS Hardware Workshop
Submitted by Andrew Fisher (@ajfisher) on Tuesday, 28 July 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 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.
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!
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
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.ccw()to instead use
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.
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.
- 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.
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
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.