Nodebots

Today I got to play with hardware at an International Nodebot Day event put on by NodeJS Houston. It was a lot of fun, and I was surprised by how much got accomplished in less than a day. I used a Tessel2 board from Sparkfun, which comes with linux and Node.js installed. The best thing about the Tessel2 is how quickly you can go from having just parts to having a working project. Unlike the Raspberry Pi and other boards, there is no lengthy initial install process. The OS is pre-installed. The client installs via a single line of code using NPM. Likewise, getting wifi connection up and running, so you can push code without a wired connection, is a single line of code.


~20 Minutes from Parts to LED on!

image6

JavaScript code running on my laptop, connects to the Tessel2 board via a USB cable, which makes the LED blink.

screenshot of webpage with controls for sumobot

Screenshot of the terminal. The red bar and the number to the right of it shows the current level of the dimmer switch that will control the LED brightness

image7

In this configuration, the brightness of the LED is reported back to the console and changed via a dimmer switch on the bread board.

 

 

 

 

 

 

 

 

 

 

 


Sumobots!

After several smaller projects to practice writing and deploying code for the Tessel2, we build our main project, a sumobot. At the end of the day, there was a bot vs. bot bracket competition.

sumobot

My sumobot. It might have won ugliest sumobot had that been a category. Rubber bands > Elmers Glue for prototyping and impact sports.

Screen Shot 2016-07-30 at 9.48.00 PM

The sumobot was controlled via a webpage served from the bot and running on my phone. This is a screenshot of those controls.

Nodebots_img_0283

The object is to push the other bot off the platform. Someone is about to lose.

All the sumobots that took part in the competition.


Instructions

The following instructions should be all the information you need to try out a few small projects and then build a sumobot.

  • Sparkfun sells a kit that looks to be everything I got at nodebots day and a extra pieces.
  • Slides and code by Donovan Buck, who is also a contributor to Johnny-Five. These were presented by Don at the nodebot event and contain information on getting started with the Tessel2. Small code snippets for projects using LEDs and Temperature Sensors are included, as well as some of the information needed to make a sumobot.
  • The Johnny-Five JavaScript library is used for a variety of boards, including the Tessel2, to control components and sensors using simple and short Node.js commands. The name, of course, comes from the main character of the awesome 1980s robot movie, Short Circuit. The JavaScript files in the Don’s presentation use Johnny-Five.johnny-five-fb
  • ‘Getting started’ instructions from Tessel. These are an additional reference point to what is in Don’s slides.
  • For the Sumobot control, I ended up not using the code linked to at the end of Don’s slides, but rather a repo but together by Ryan Gill, who was at the event. I found Ryan’s code was easy to get running.
  • To install & run Ryan’s sumobot code, I followed these steps (Note: Node.js latest stable version, Tessel2 client, wifi connection, and wifi access point have already been installed and are running based on Don’s code in the first link):

1. Clone the directory: git clone https://github.com/ryanjgill/sumobot.git
2. CD into that directory.
3. In the terminal, type “npm install” while inside the directory to install dependencies.
4. Type “t2 run index.js”, which should start the program running.
5. At some point in the terminal, you should see “Server running at http://172.###.###.###:3000”, which is your bot’s IP and the port the webpage will be running on. Keep that information, you’ll need to put that in the browser later to control the bot.
6. Now you should push the code, so that it runs when the Tessel is not connected to your computer by USB. Type, “t2 push index.js” into the terminal. After it finishes loading, unplug the USB, switch to onboard battery power, and wait for the board to reboot and wifi to connect.
7. After the blue light on the left side of the tessel2 board is solid blue and the light in the ethernet plug area is solid green, change your computer or phone wifi to be the wifi access point of the bot. (Starting the wifi access point was a previous step described in Don’s slides mentioned above.) Navigate to the IP address and port from step #5 in your browser of choice. You should see a website that your bot is serving to you through the wifi connection. There will be buttons for forward, reverse, right, and left. Clicking on these buttons will trigger the JS code running on your bot and your bot will move.


Lastly, thank you to the sponsors of this event.

 

novetta.

 

brandextract-splash    chaione_2

 

 

uhcs

 

 

and the organizers:

 

 

nodejs-houston

 

3 thoughts on “Nodebots

  • Great blog post, glad to hear it went so well! Quick link fix, though, please: the Tessel getting started instructions you have linked right now point to Tessel 1 instructions; T2 instructions are at tessel.io/start. Can be very frustrating for folks trying to get started with T2 who don’t realize they’re working with the wrong instruction set. :) Kelsey

Leave a Reply

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