Connecting the brain (Particle Core)

Particle Core

Image Build 1

Sumobot Circuit

Image Build 1

Fully assembled circuit attached to the Sumobot body

Image Build 1

Controlling The SumoBot

The controller program has been adapted from the original program provided in the SumboBot Jr. repo and is available via npm. The controls library, keypress, must also be installed.

npm install keypress sumobot

The keypress module will turn your laptop into a remote control device for the SumoBot, using the following keys -> command mappings:

Key Command
Arrow Up Forward
Arrow Down Reverse
Arrow Left Turn Left
Arrow Right Turn Right
Space Stop
Q Quit
// keyControl.js
var keypress = require("keypress");
var Spark = require("spark-io");
var five = require("johnny-five");
var Sumobot = require("sumobot")(five);


var board = new five.Board({
  io: new Spark({
    token: process.env.SPARK_TOKEN,
    deviceId: process.env.SPARK_DEVICE_2

board.on("ready", function() {

  console.log("Welcome to Sumobot Jr!");

  // Initialize a new Sumobot.
  // - Left Servo is attached to pin D0
  // - Right Servo is attached to pin D1
  // - Speed set to 0.50 (half of max speed)
  var bot = new Sumobot({
    left: "D0",
    right: "D1",
    speed: 0.50

  // Maps key names to bot methods
  var actions = {
    up: "fwd",
    down: "rev",
    left: "left",
    right: "right",
    space: "stop"

  // Ensure the bot is stopped

  // A bit of keypress ceremony ;)

  process.stdin.on("keypress", function(ch, key) {
    var action;

    if (!key) {

    action = actions[] ||;

    if (action == "q") {
      setTimeout(process.exit, 500);

    if (bot[action]) {

These instructions are adapted from Controlling the RobotsConf Sumobot with Spark Core & Johnny-Five by Rick Waldron, creator of Johnny Five

results matching ""

    No results matching ""