Introduction: Fenrir: an Open Source Dog Robot

About: Making Robo

Stationary Leg Movement

Rotation Transform

Walking Demo

The User Interface

This is a mini open source mammal quadruped robot or you can think of it as a four leg dog robot . The aim of this project is to give people the ability to create and study 4 legged mammal quadruped robot such as the Boston Dynamics LS3 or the MIT Cheetah on a smaller scale. Plus, I love dogs and always wanted to make a dog-like companion robot.

All parts of the robot can be easily 3D printed on a low end 3D printer such the M3D(This is what I use to manufacture the parts ). If you don't have a 3D printer you can send them to print online on site such as Shapeways.com or get access to a Tech Shop that had a 3D printer.

For this project, I try to accomplish the following goal :

  • Easy to construct.
  • Low cost.
  • Wireless control.
  • Some kind of movement functionality.

As an open source project, I will make public all the cad files as well as the software. In addition, 4 legged mammal quadruped robot only recently become popular due to Boston Dynamics so there is a lack of an open source code. Due to this, I would encourage you guy to build upon my work and create your own motion algorithm. I myself will also work on this project's software and make new design improvements from time to time. I hope that you can also make your own Fenrir after reading this instruction. :)

Step 1: Download Section

Step 2: Materials

Electronics

**1x Raspberry Pi 2 $37

*1x Raspberry pi Camera Module $25

1x Mini Maestro Pololu Servo Driver $30

1x Turnigy Receiver Pack 2300mAh 6.0v NiMH $16

12x HobbyKing™ HK15138 Standard Analog Servo $40

1x Anker Battery $15

Total Electronic Cost : $158

Mechanical

Printed Part $10

Phillips Head Tapping Screws $6 (Use to secure servo horn to printed parts)

1/2-Inch Button Socket Cap Screw (Find 30 screws and bolts similar to this size. No need to be the exact size. Use to secure the servo to the servo bracket)

Standoff (Find four piece around this size)

Total Mechanical Coast: $17

Total : $180

A note on the screws : You don't need to buy the listed types of screws specifically. Just get something similar to that size and it should be good enough.

* Optional part : Include these if you want more functionality.

** You can replace the Rapsberry Pi 2 with a Raspberry Pi 3. They cost the same !!! I use the Pi 2 because I already own it.

Step 3: Printed Part List

Here is a list of all the parts that need to be printed :

  • 2x Spine
  • 1x Spine Connector
  • 2x Front
  • 4x Socket
  • 4x Twist
  • 4x Femur
  • 4x Femur_Back
  • 4x Thight_Socket
  • 4x Feet
  • 2x Rod
  • 3x Rod_2
  • 1x Head
  • 1x Tail

All of these parts are in the cad files that I posted in the download section. I would recommend to print the part as in order describe above, so that you can build the robot while the parts is being printed. All parts were printed with medium infill and low resolution setting on the M3D.

Step 4: Building the Body

The robot body consist of : 1 Spine Connector, 2 Spine, 4 servos.

  • First, connect the Spines Connector to the first Spines piece. There should be holes that allow the two piece to click right in
  • Then connect the the second Spine piece to the other side of the Spine Connector.
  • Make sure everything is secure. Add superglue if you feel that is necessary.
  • Finally, Put the four servo into the big opening on the Spine piece with servo head facing upward. Secure the servos with screws .

Grats, you have finish the first section of your robot. Time to put the leg socket on your robot.

Step 5: Building the Leg Socket

The Leg Socket is the the portion of the robot that connect the body to the leg, the front, and the back. The Leg Socket section contain : 4 Socket, 4 Twist, 4 servos, and 4 servos horn.

  • First, attach the star shaped servo horn to the Socket piece using the Philip screw.
  • Next, insert the recently attached servo horn into one of the four servos that is on the Body Section. Make sure that the maximum the servo can turn is flat horizontal as show in Picture 3.
  • Then, attach the Twist piece on the other side of the Socket piece.
  • Repeat this step until you have build 4 leg sockets as show in Picture 4.

Step 6: Attaching the Leg

The Leg section consist of : 4 Femur, 4 Femur_Back, 4 Thigh Socket, 4 Feet, 8 servo horn, 8 servo.

  • Take 2 star shaped servo horns and attach them on the Femur as show in the Picture 1 and Picture 2. Remember that the screw head is on the side that do not show the servo horn. In addition, the connection between the servo horn and the servo is facing out.
  • Next, put the a servo inside the Thigh Socket with the servo head facing the side that don't have an extruding cylinder. Look at Picture 3 for reference.
  • If you look at the Femur , there is a longer side and shorter side. They are separate by a small dent. Put the longer side on the Leg Socket and shorter side on the Thigh Socket.
  • Secure the servo horn on the servo with screws that come with the servo.
  • Finally, attach the Femur_Back to the Leg Socket and Thigh Socket. Remember, long side on the Leg Socket and short side on the Thigh Socket. Secure the Femur_Back to the sockets with screw.If you are confuse, look at Picture 5 for reference.

Step 7: Adding Front and Back

Now we are going to add the front and back of the robot. The front is where the camera going to be place and the back is where the servo controller going to be secure. It can also be used for additional components in the future. This section consist of the following pieces : 1 Head, 1 Tail, 2 Front, 2 Rod, 1 Camera Module.

  • First, attach the camera into the head.
  • Next put the Front pieces on the 2 twist pieces as show in Picture 2 . Do the same for the other side.
  • Take a Rod piece and insert it into the hole on the Front piece, keep pushing it until it reach the hole on the Spine piece. Secure the rod in place with superglue. Do the same for the other side.
  • Place the Head piece on the side that you want to designate as the front and place Tail piece on the other side.

The robot is almost finish, we still need to add the foots and few more rod to secure the robot's frame.

Step 8: Final Touch

This section consist of adding the feet and make sure that the robot is strong and secure. The following pieces is required : 4 Feet , 3 Rod_2.

  • Find some rubber piece and put on the base of the feet. You don't need to find a piece exactly like mine. Just make sure that the feet base have some kind of friction and not slipping around.
  • Next, attach the feet piece into the leg piece. It should fit right in
  • To make sure that the body of the robot is stable. Add three Rod_2 piece across the middle as show in Picture 3.

The frame of the the robot is finally done !!! Next we going to put on the electronics component that going to make the robot move.

Step 9: Putting on the Electronics

This part i will show you how to put all the electronics that needed on the robot in a neat and easy to maintain manner.

  • Place the Standoff pieces on the four hole in the Spine Connector. Then place the Anker battery inside the space of the four Standoff as show in Picture 1.
  • Next, place the Raspberry Pi 2 on to of the four Standoff. Use more Standoff or some screws to secure the Raspberry Pi in place. This will also make the Anker battery fight tight and should not slide around.
  • Next, screw down the Mini-maestro on the tail as show in Picture 3.
  • Finally, Put the Turnigy battery vertically under the body section of the robot. The 3 rod across the middle will prevent the Turnigy battery from falling out.

The construction of Fenrir is now 100% finish. Up next, I'm going to show you how to connect all electronics together and start loading in the code to make it move.

Step 10: Connecting Electrical Components Together

The electrical wiring and connection is fairly simple and straightforward. Every thing is plug-in ready so there is no need for any soldering tools.

  1. Connect the Pi Camera to the Raspberry Pi in the Camera port as show in Picture 1 and Picture 2.
  2. Connect all the servos to the Mini-Maestro, the ground pin is the outermost pin and the signal pin is the innermost pin a.k.a black facing out . Look at Picture 3 for pinout reference of the Mini-Maestro.
  3. Plug in the Turnigy 2300mAh Battery in to the Mini-Maestro. GND is the outer outlet and VCC is the inner outlet.
  4. Make the connection between the Raspberry Pi and Mini Maestro by using a USB to Micro-USB Cable
  5. Finally, use another USB to Micro-USB Cable (should come with the Anker Battery) to connect the Anker battery to the Raspberry Pi .

If everything was connect correctly, the raspberry pi and the Mini Maestro should light up to indicate that they are power and ready for use. For now , you can just turn off the power to the Mini Maestro band load up all the software onto the Pi first then power up the Mini Maestro again and test out the robot.

Step 11: Setting Up Raspberry Pi 2

Getting The Raspberry Pi 2 Ready

  1. First, you need to have a Micro SD card and load the Raspian Wheezy Operating System(OS) in to the card. Here is an Instructables that I used to install the OS.
  2. Once you have inserted the Micro SD card into the slot on the Raspberry Pi 2. You have 2 option to start using the Raspberry Pi 2.
    • Option 1 :
      • SSH into the Raspberry Pi 2. This option doesn't require a keyboard and a monitor, but you must have an Ethernet cables . Follow this guide on how to do this.
    • Option 2 :
      • Plug your Raspberry Pi 2 into a monitor and connect a keyboard into the Raspberry Pi 2 USB port.
      • Started your Raspberry and enter pi for username and raspberry for password. Now you should have access to your Raspberry Pi
  3. Once you have access to the Raspberry Pi, you need to enable the wifi to get thing rolling. Enter :
    • sudo nano /etc/network/interfaces
    • Enter the following text into the space :
auto lo
 
iface lo inet loopback
iface eth0 inet dhcp
 
allow-hotplug wlan0
auto wlan0
 
 
iface wlan0 inet dhcp
        wpa-ssid "ssid"
        wpa-psk "password"

  • ssid is the name of your network. password is the password of your network
  • press Ctrl+X to exit and save.
  • Restart your Raspberry Pi and Wifi should be working.
  • Type in : sudo apt-get update ( to update your system)
  • If the update failed due to no connection. Try some other tutorial like SETTING WIFI UP VIA THE COMMAND LINE.
  • If update was successful. Type in : sudo apt-get upgrade (this installed the new updated packet)

Step 12: Dowloading Node.js and Source Code

Do the following step. Note, all the bold text are command line.

  1. Getting Node.js . Type in the following command
  2. Next we going to get the necessary Node.js library. Type in these command in your Raspberry Pi 2
  3. Now, we going to get the streaming software
    • sudo apt-get update
    • raspi-config
      • Choose Enabled Camera. It is Option 5
    • sudo apt-get install uv4l uv4l-raspicam
    • sudo apt-get install uv4l-webrtc
    • uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding h264 --framerate 20 --vflip yes --hflip yes (command to run the streaming software. Type in http://raspberrypi:8080/stream on your browser to test if the stream is working )

  4. Loading the robot code from github.

Now you should have everything that allow you to run the Fenrir software on Rapsberry Pi 2. To start the software do this :

  • ./start.sh

Then put Raspberrypi.local:5000 on your browser to start control your robot.

Step 13: Servo Control

I am going to talk briefly about how to control the servo for testing and creating leg movement here in case you want to create your own movement algorithm . There two main ways to test out and model the servos movement before you fully implement it.

The first method to is to connect the Mini Maestro Servo Controller directly to the your computer and use the Maestro Control Center Software to create leg movement. This is the easier method out of the two.

The second method is control the servo via Node.js in the Rapsberry Pi 2. In essence, the Raspberry Pi 2 use a maestro library ( https://github.com/omcaree/node-pololumaestro.git) created by omcaree to communicate with the Mini Maestro Servo Controller. You must have all the necessary Node.js library that i mention in Getting the Raspberry Pi 2 Ready in order for this to work. Below is an example javascript code using Node.js to control the servo.

//Example code on how to user Node.js Mini Maestro Servo Controller library
//This code move the servo back and forth indefinitely

var PololuMaestro = require("node-pololumaestro");// needed to use servo library
var maestro = new PololuMaestro("/dev/ttyACM0");// input your USB port name here

maestro.on("ready", function() { //initiate communication with the Servo Controller
 console.log("connection made");
 maestro.setSpeed(0, 100);// set servo at pin 0 to speed 100. 
});

var Delay  = 500;   	// our delay timer
var Multiplier = 0;	//delay multiplier
	
while(1==1){      //loop	
setTimeout(function(){	// simulate delay
 maestro.setTarget(0, 800);// move servo at pin 0 clockwise
 }, Delay*Multiplier);// will execute  maestro.setTarget(0, 800); after 500 ms
Multiplier++;	// increment multiplier so next delay will be 1000ms

setTimeout(function(){
 maestro.setTarget(0,2300); // move servo at pin 0 counter clockwise
}, Delay*Multiplier);//will execute  maestro.setTarget(0, 2300); after 1000 ms
Multiplier++;// increment multiplier again so next delay will be 1500ms
}

What I usually do is simulate the leg movement in the computer first. This will give you a sequence of servo positions in microsecond. From there i look at all the number and see if i can com up with an algorithm to implement it in Node.js.

Step 14: Software Description

Wolf main software is similar to Husky , but with an upgraded User Interface(UI). In this section, I'm going to digress on some important files of the software. Wolf wireless control is design around using Wifi. Inside the robot software, there is a file called app.js. This is Wolf's webserver that uses your home Wifi and broadcast the signal throughout the entire network. After you started the robot and run the software, open up a browser and typed in raspberrypi.local:5000 and you should see a fully working UI with video streaming. The reason I use Wifi as opposed to Bluetooth or Radio Control(RC) control is because it had an easy way to integrate video streaming.

Folder Structure

The below diagram is a presentation of the files structure in the main software. The two important files in the software folder is the app.js and client.js . I will digress more on these two files in the next section.

Main Folder

app.js (server side )

start.sh (bash script to run node and camera progarm)

Public (web interfaces folder)

index.html

js (javascript folder for the web interface)

client.js (client side)

socket.io.js (websocket libary)

Servo.js

LIDAR.js

MPU9250.js

dist(resource for webpages)

build(boostrap file)

Step 15: 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 socket.io library and then tell the app to listen to port 5000.

var app = require('http');
createServer(handler);
io = require('socket.io').listen(app);
url= require('url');
fs = require('fs');
app.listen(5000);

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) {
                    res.writeHead(500);
                    return res.end("Error: unable to load index.html");
                }
                res.writeHead(200,{'Content-Type': 'text/html'});
                res.end(data);
            });
    // Managing the route for the javascript files
    } else if( /\.(js)$/.test(path) ) {
        index = fs.readFile(__dirname+'/public'+path, 
            function(error,data) {
                if (error) {
                    res.writeHead(500);
                    return res.end("Error: unable to load " + path);
                }
                res.writeHead(200,{'Content-Type': 'text/plain'});
                res.end(data);
            });
    } else {
        res.writeHead(404);
        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 socket.io.

 
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 LiftForward(){
    maestro.setTarget(12, 600); 
}

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('LF', function(data) {
      console.log("LegForward");
      LiftForward();   
  });

}

Step 16: 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 
$(document).keypress(function(e){ 
//If the letter K was press, send the string LF back to the server 
 if(e.keyCode == 107){ 
        socket.emit('LF');
    }
}

There are a lot more in the client.js ,but all other command was just simply reuse the above template to interact with other keyboard stroke to send different command.

Make it Move Contest 2016

First Prize in the
Make it Move Contest 2016

3D Printing Contest 2016

Runner Up in the
3D Printing Contest 2016

Robotics Contest 2016

First Prize in the
Robotics Contest 2016