Arduino Project Hub
Project tutorial

Arduino Node Tank © GPL3+

This four wheeled car run by Johnny-Five. It can fire with a mounted Nerf gun using servos and controllable with a Nintendo 64 controller.

  • 1 comment
  • 6 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
HC-06 Bluetooth Module
Adafruit Motor/Stepper/Servo shield V2
SM-S4306R Continuous Rotation Servo
DC motor (generic)
Motor Tire
11026 02
Jumper wires (generic)
Adafruit industries ada62 image 75px
USB-A to B Cable
Power bank
Mobile phone mount
Nintendo 64 Retrolink USB gamepad
SG90 mini servo
Pan/Tilt camera platform

Apps and online services

About this project

Short introduction

This four wheeled robot is able to move wireless via Bluetooth connection. It is controllable by a retrolink Nintendo64 USB controller using Johnny-Five library. A Nerf gun is mounted to the chassis and users are able to shoot with it. There is also a flashlight attached to lighten dark areas.

You can see the circuit of the main parts in figure 1.


Due to the lot of electronic components (4 DC motors, 3 servos, etc) the best option is the usage of an USB power bank with high capacity. I have used a 10000 mAh Proda bank for the project. There is only one problem with most of power banks. If there is not enough current drained from the batteries, the bank will shut down within a few seconds. Thankfully there are enough active power consumers in the circuit so this feature will not cause any trouble. I had to break the original USB cable and create another endpoint for powering the motor shield as well. So Arduino gets 5V from the power bank directly through it's USB slot and the motor shield gets another 5V from parallel connection. If you remove the jumper from the motor shield, you can power both boards separately. This is more optimal than powering motors and servos directly from the Arduino board. You can find more info at Adafruit.

Bluetooth connection

I have used an HC-06 Bluetooth module to establish connection between the car and my computer. I wanted to use as less cables as possible so I decided to build a custom shield by soldering the Bluetooth module to an empty prototype shield and attached to the Arduino.


I have used a Nintendo 64 controller with USB connection. You can see it in figure 2.

To be able to use this controller in Javascript context you need to install some third party libraries which support it. I have used node-gamepad which can offer a simple API and understandable documentation.

The robot is able to do the following movements / actions:

  • Joystick - move forward, backward and can rotate the robot
  • C Up, C Down, C Right, C Left - Move the Nerf mount to the preferred direction
  • A - Move the trigger servo to shoot with the Nerf gun
  • B - Move back the trigger servo

Nerf gun

The idea of the Nerf automation is to mount it onto a Pan/Tilt camera platform. There are tons of these on the internet, usually without servos, so make sure you have a pair if you ordered just the simple mount. I've used two TowerPro SG90 servos for positioning and one continuous servo for triggering fire. I have used a short fishing line attached to the servo and the gun trigger. The servo has the power to make enough force to pull the trigger when activated.

You can see the Nerf gun in action in the following video. The project was in an early state when I captured this so some parts are missing and the power sources are 4 rechargeable AA batteries plus a 9V battery for the Arduino instead of a power bank (they drained really fast).

video 1 - Nerf gun in action

The code

I have used NodeJS with Johnny-Five to make this project. You can find the full code in my GitHub repository linked below.

There are three main components of the code:

  • Board Module - Handle the Arduino board
  • Motor Module - Handle the motor movements and control bindings
  • Servo Module - Handle the servo movements and control bindings

In app.js you can see them together:

import { BoardModule } from './src/boardModule';
import { MotorModule } from './src/motorModule';
import { ServoModule } from './src/servoModule';
const port = 'COM26';
const speed = 255;
let boardModule = new BoardModule(port);
let motorModule = new MotorModule(speed);
let servoModule = new ServoModule();
boardModule.initBoard().then(() => {

After initialization of motors and servos the gamepad should be instantiated and we are free to set the bindings for controlling each part via our Nintendo 64 controller. See this snippet for example:

initGamePad() {
 let gamePad = new GamePad('n64/retrolink');
    gamePad.on('cUp:press', () => this.platformUp());
    gamePad.on('cDown:press', () => this.platformDown());
    gamePad.on('cRight:press', () => this.platformRight());
    gamePad.on('cLeft:press', () => this.platformLeft());
    gamePad.on('cUp:release', () => this.servoStop());
    gamePad.on('cDown:release', ()=> this.servoStop());
    gamePad.on('cRight:release', () => this.servoStop());
    gamePad.on('cLeft:release', () => this.servoStop());
    gamePad.on('a:press', () => this.triggerServoCW());
    gamePad.on('b:press', () => this.triggerServoCCW());
    gamePad.on('a:release', () => this.triggerServoStop());
    gamePad.on('b:release', () => this.triggerServoStop());

As you can see each key press triggers two events: press and release. Press callback will be executed after the button pressed and release will be executed when we release it. In this way we have the opportunity to stop our moving parts.

The joystick of the gamepad have a bit more different configuration. It's about coordinates based on the direction where we move the stick. You can see the setup in the following code snippet:

gamePad.on('center:move', (coords) => {
    if (coords.x == 127 && coords.y == 0) this.motorsForward();
    if (coords.x == 127 && coords.y == 255) this.motorsBackward();
    if (coords.x == 0 && coords.y == 127) this.motorsLeft();
    if (coords.x == 255 && coords.y == 127) this.motorsRight();
    if (coords.x == 127 && coords.y == 127) this.motorsStop();

Last words

Hope you like this little project which is another proof of concept about proving the power of Johnny-Five and Javascript robotics in general. The flashlight is just an extra, sitting on a phone mount. It is not controllable at the moment but can be with relays. Maybe in my next project.





Similar projects you might like

An Arduino-Powered Easter Egg Printer

Project showcase by ELEKS

  • 18 respects

Automatic Fear 1.0

Project tutorial by Alexis Santiago Allende

  • 1 comment
  • 5 respects

Arduino Addons : Battery Level Indicator

Project showcase by Arduino World

  • 21 respects

End-Effector and Control Logic for Robot

Project showcase by Team PowerBerry

  • 23 respects

Pi Time - A Fabric Arduino Clock

Project showcase by Team Chris And Jessica Hogan

  • 14 respects

Arduino Toolboxes : Analog Level Visualizer

Project showcase by Arduino World

  • 20 respects
Add projectSign up / Login