Husky I : Quadruped Live Streaming Bot With Raspberry Pi




Introduction: Husky I : Quadruped Live Streaming Bot With Raspberry Pi

About: Making Robo

The Quadruped code name Husky I is a four legged crab like robot that used the raspberry pi 2 at it brain and main control center. In addition, Husky I also included a servo controller and motor driver for servo control and motor driving. There still many thing left to be done on the robot such as integration of sound module, autonomous algorithm. So look out for future update.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials

_The Frame

2x Aluminum Multi-Purpose Servo Bracket Two Pack(2x12 = $24)

2x Aluminum Long "C" Servo Bracket with Ball Bearings Two Pack (2x13 = $26)

2x Aluminum "L" Connector Bracket Two Pack (2x6 = $12)

buy at

1x Quadruped Body Kit 2 ($20)

buy at

_Printed Parts

4x Lower Leg

4x Inner Tread Cover

4x Outer Tread Cover

4x Main Motor Hub

8x Side Motor Hub _Electronics


1x Raspberry pi 2 ($40)

1x camera module ($8)

1x usb wifi adapter ($5)

1x Mini Maestro 18-Channel USB Servo Controller ($40)

1x raspberry pi motor hat ($22)

4x Pololu-Maestro 75:1 DC Micromotor ($15)

12x HS-645MG Servo Motor (30 each x 12 = $360)

1x BAT-05 6V / 2800 mAH Ni-MH Rechargeable Battery ($27)

1x 6V - 12V NiMH / NiCd Smart Charger ($22)

buy at

Anker Astro E1 5200mAh Candy bar-Sized Ultra Compact Portable Charger ($15)

buy at

Frame = $62

Electronics = $585

Total + tax + shipping = $705

Note: The most costly part of this project is the servos. If you want to cut back you can use the HS-422 servo($10 each) servo partially or fully, but you might need to get a lighter battery if you intended to use a full HS-422 build.

Step 2: The Leg

This is a new variant of the Lynxmotion Quadruped Robot which features a new lower leg design that includes housing for a motor and an added tank module. The idea behind this new leg design is to allow the robot to transform between walking and driving at any given time. The bottom leg is made in Solidwork and printed using PLA filament. . All the leg files will be posted at the bottom of the page in .step format.

3D Viewer :

Step 3:

Begin by Constructing the Multipurpose Servo Bracket, the C servo Bracket , and The L Connector Bracket. The instruction came in the package when you buy them so it is self explanatory on how to assemble this. Once you have these 3 pieces constructed move on to the next step.

Step 4:

First, attach a HS-422 servo to the side with the ball bearings and make sure that the servo head is directly above the ball bearing ( this is very important). Then attach the C servo bracket to the multipurpose servo bracket as shown in the second picture. After the 2 pieces have been attached together, put the HS-645 MG on as shown in the third picture. Finally attach the L servo bracket on the left side of the C servo bracket as show in picture 4. Note: it is very important that you put the right servo in the correct place or else it will affect the performance of the robot.

Step 5:

Next, attached the LowerLeg to the servo bracket as show in the first picture. Now you should have a single completed leg. The big hole in the LowerLeg served as the housing for the motor which will be used to put the robot to driving mode. If you want to have to have the driving mode go to the driving module section for instruction.

Step 6: The Body

The body were made using Quadrapod Body Kit - Mini QBK-02. There are 2 batteries which are placed on the lower level. The green battery is the 6V NiMH/NiCD which is used to power the servo and the motor. The black battery is the Anker portable charger for the raspberry pi 2. I decided to use a second battery for the raspberry pi because the main battery is already under heavy load from all the servos and motors. Putting more load on it is not a good idea. Furthermore, the Anker portable charger can power the raspberry pi for about 1-2 hour with the camera plugin whereas the main battery can do 30 min max. After the batteries is placed in its appropriate spot, screw in the top cover and put the raspberry pi 2 near the end of the robot and the mini-maestro servo controller at the top as shown in the last picture. Now the main body is finished we will move on to constructing the camera module.

3D Viewer :

Step 7: The Camera Module

The camera is 3D printed out using STL files from . Once you have printed out all the necessary components. I constructed the camera module by looking at the picture from the site. It is self explanatory. The Camera module is powered by 2 Hitec HS-5055 servos. These servo are relatively cheap and cost about 2 dollar each.

Step 8: Putting Everything Together

At this point, the four leg should be completed and ready to be integrated into the body. At the four corner of the Quadruped body there is a big hole. This is where you put the leg. Look at picture one for reference.

Step 9:

Next ,we attached the camera module to the body. The camera will be placed on top of the mini-maestro servo controller. It should be placed high enough so that it is in the way of the wire. That about it for the placement of the camera. Refer to the above pictures to get an idea of where to place the camera module.

Step 10: Setting Up the Raspberry Pi

Make sure you have Raspian installed on your raspberry pi 2. If not head over to for instruction on how to install the operating system.

First, hook up your raspberry pi to a monitor/tv that had an HDMI port. The pi will boot up and ask you for password and username. The default username is "pi" and default password is "raspberry". Once you log in , type raspi-config and set the files-ystem to used all of the sd card space. Then go to advanced option and enabled the camera and ssh. Now we need the raspberry pi to make a connection with the wifi. Follow these step:

  • sudo nano /etc/network/interfaces

you will see the text layout as follow

  • auto lo
  • iface lo inet loopback iface eth0 inet dhcp
  • allow-hotplug wlan0
  • iface wlan0 inet manual
  • wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
  • iface default inet dhcp

change it to

  • auto lo
  • iface lo inet loopback iface eth0 inet dhc
  • pallow-hotplug wlan0
  • iface wlan0 inet manual
  • iface default inet dhcp
  • ssid="your network name"
  • psk="network passowrd"

Step 11:

Once we get internet connection on the raspberry pi, it is time to get the necessary libraries and framework to build our program.

First we need to get nodejs since it is the main framework for the robot to communicate through wifi. Type in the to install nodejs.

If you want to check your node version, you can type node -v and it should return a version around 12.0.0 .The version number might have gone up from the time i write this instruction.

  • node -v
  • v0.12.0

Now we need to get the necessary node module for the program. Type in the following

  • npm install serialport (for UART communication )
  • npm install (for websocket)
  • npm install express
  • npm install winston

That should be it for the npm install, now we need to get the javascript library for mini-maestro servo controller so go into you node_modules folder and clone back the driver library.

Step 12:

Next we need to get a streaming software for the raspberry pi so that the robot can have the ability to live stream. First :

  • sudo apt-get update
  • sudo apt-get install uv4l uv4l-raspicam
  • sudo apt-get install uv4l-webrtc

This will install the camera software. Next you can test the to see if it is running properly by typing

  • uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding h264 --framerate 20 --vflip yes --hflip yes

Here are some flag that is important when u run the uv4l camera software : --width and -- height set the resolution, --enconding specify the type of encoding , --vflip and --hflip is vertical and horizon flip so that the image isn't up side down. put this address in your browser : http://raspberrypi:8080/stream. You should see a stream with less than .5 s latency.Below is a demo of the camera.

Step 13: Software

Here, I will just explain the important part of the software and not all of them since that would be tedious and not useful at all . The structure of the software is as follow

Main Folder

app.js (server side ) (bash script to run node and camera progarm)

Public (web interfaces folder)


js (javascript folder for the web interface)

client.js (client side) (websocket libary)

jquery.min,js(jquery libary)



Step 14: Software: App.js

App.js is a local server written in javascript and it used websocket to communicate with other device through wifi.

The following code create an object to use function from within the library and then tell the app to listen to port 5000.

var app = require('http');
io = require('').listen(app);
url= require('url');
fs = require('fs');

The next part of the code is simply forwarding the content in public through the wifi so that you can communicate with it via ip address.

// Http handler function
function handler (req, res) {
    // Using URL to parse the requested URL
    var path = url.parse(req.url).pathname;
    // Managing the root route
    if (path == '/') {
        index = fs.readFile(__dirname+'/public/index.html', 
            function(error,data) {
                if (error) {
                    return res.end("Error: unable to load index.html");
                res.writeHead(200,{'Content-Type': 'text/html'});
    // Managing the route for the javascript files
    } else if( /\.(js)$/.test(path) ) {
        index = fs.readFile(__dirname+'/public'+path, 
            function(error,data) {
                if (error) {
                    return res.end("Error: unable to load " + path);
                res.writeHead(200,{'Content-Type': 'text/plain'});
    } else {
        res.end("Error: 404 - File not found.");

In addition we also put the code to control the servo inside app.js. First , you need to create an object for the mini-maestro library like

var PololuMaestro = require("pololu-maestro");
var maestro = new PololuMaestro("/dev/ttyACM0");

Then you can use the function inside the mini-maestro library as follow.

// Initiate communication with the servo controller
maestro.on("ready", function() {
 console.log("connection made");}
//Set the speed of servo at pin 0 to 60 
maestro.setSpeed(0, 60);
// Set the angle ( you write in PWM value) at pin 0
maestro.setTarget(0, 1200); 

//Example function 
function CameraRight(){
    yaw = yaw+100;
    maestro.setTarget(12, yaw); 

Next we need to include a portion of code to call these function when we get the data from the communication side that they want to run a certain function.

// Check for signal being sent
io.sockets.on('connection', function (socket) {
  //If signal is CR, then run CameraRight();
  socket.on('CR', function(data) {


Step 15: Software : Client.js

client.js handle all the input that the user do in the web intertfaces and send it back to the app.js so it interpret those command and execute the proper function. Here is a simple example of the code that need to in client.js

//Check to see if the keyboard is press 
//If the letter K was press, send the string LF back to the server 
 if(e.keyCode == 107){ 

Step 16: Software: Driving Module

This is the software part for the driving module. If you didn't put the wheels and motors on your robot you can skip this part.

In order to interact with the motor driver, we going to need to installed it library on the raspberry pi. First do these step.

Since this library is in python. We going to need to write 2 python script , one for forward and the other for backward. Then called these scripts in our app.js. In order to do this we going to need python-shell, python-shell allowed us to called on python script in javascript using nodejs.

  • npm install python-shell

To install python-shell

The below is an example of a python script that move the motor forward.

from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
import time
import atexit
# create a default object, no changes to I2C address or frequency
mh = Adafruit_MotorHAT(addr=0x60)
# recommended for auto-disabling motors on shutdown!
def turnOffMotors():
# Attached the motor to it respective pin
myMotor1 = mh.getMotor(1)
myMotor2 = mh.getMotor(2)
myMotor3 = mh.getMotor(3)
myMotor4 = mh.getMotor(4)
# set the speed to start, from 0 (off) to 255 (max speed)
# set the motor to go forward for 3 second
# Adafruit_MotorHAT.FORWARD: going forward
# Adafruit_MotorHAT.FORWARD: going forward
# Adafruit_MotorHAT.FORWARD: going forward

This part here is in app,js that will called on the python script called "".

var PythonShell = require('python-shell'); // create an object for python shell

function MotorForward(){ // function that call on python script'', function (err) {
  if (err) throw err;
MotorForward(); // call the function

Step 17: Software: Getting the Files

To get get all the files to your raspberry pi, you simply just have to clone all the stuff in my repo. Type in the following:

This should download all the files back to your raspberry pi. Make sure u have your node version around 0.12 or the software won't work.

Step 18: Dowload File

Raspberry Pi Contest 2016

Third Prize in the
Raspberry Pi Contest 2016

Full Spectrum Laser Contest 2016

Participated in the
Full Spectrum Laser Contest 2016

Hack Your Day Contest

Participated in the
Hack Your Day Contest

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    5 Discussions


    3 years ago

    Is the program doing the moves in salvos?
    Or are you commanding it live?


    Reply 3 years ago

    Hello, I am commanding the robot in realtime via Wifi using a webserver that was made in Node.js.


    3 years ago

    Thats Good


    Reply 3 years ago