This blog covers the build of my first ‘large’ and what I would consider to be ‘proper’ robot. It came about due to several factors, firstly because for a very long time I had been considering building a DALEK and decided it was time to start. Around about the same time I was (and at the time of writing, still am) in the middle of a British Computer Society Certificate in Computing part of which is a coding project for which I wanted to build a robot. Also just as I started the initial stages of the build Robot Wars was on TV and in school, where I teach, several of the children were talking about how to build a robot.
I studied peoples DALEK build on the Project DALEK forum and soon realise that building a full size DALEK is a big undertaking and to do it correctly (which I wanted to do) required a lot of tools that I just don’t have. So as I still wanted to eventually build a DALEK I settled the idea that I would build a large robot chassis that could later be used for the DALEK but in the interim would serve as a stand alone robot. Remembering something I read many years ago that said never take take apart a robot to build another one the idea would be that I would simply be adding a DALEK body over the original frame and moving some of the components around :-).
taking inspiration from some of the DALEK builds I set about constructing a frame using 2mm 20mm x 20mm boxed steel. I picked up the 3 x 2.1m lengths of box section from a metal fabrication shop on a local industrial estate for £15.
The base would initially consist of a rectangle made using 2 x 400mm and 2 x 200mm pieces of box section and would end up 400mm wide and 240mm long due to the fact that the 200mm lengths sat inside the 400mm lengths creating the extra 40mm (2 x 20mm). I cut four pieces for the first section and straightened off the edges. To help welding I also chamfered them. To ensure that the frame was straight I clamped the sections to be welded on a piece of plywood.
First I tack welded each joint so that I could check the alignment and straightness of the corners using a set square and once the frame was tacked together I seam / butt welded all of the joints. Then I dressed down the welds (not completely to maintain strength).
As I am impatient I did a test fit of the motors which were mounted by drilling our holes (two either side) through the box section. I do intend to weld a piece of flat bar onto the side pieces so that each motor will be held with four bolts. Whilst this is not necessary for this robot if I intend to sit inside the DALEK it will be needed to hold my weight.
I even wired up the original electrics to see it moving.
The next stage was to add a slightly angled front end using approx 600mm lengths (I will measure and edit this posts) your own lengths will be dependent upon your requirements. The welding process was the same using plywood to maintain alignment and spot welding all joints before going over them again.
Once the welds were dressed down I slapped on some Hammerite smooth.
All that is missing now is a castor for the front.
On reading the DALEK motorisation guide I opted to use as much of the original wiring loom as possible. On my wheel chair there is a connector between the main control box / joystick and the motor and battery connectors. I decided to cut the loom off here but still leave enough wire to reconnect the joystick (if I ever needed to use it again). It took some time to work out what each wire was for. The two large red and black wires were the battery + and – (the batteries are connected in series somewhere in the loom hence only two wires at this end). The brakes are also connected in series so again only two wires exit the loom at this end (thinnest of the lot). The remaining wires are the Left and Right Motor + and -. After working out which wires wires which I stripped the ends and put them in a terminal strip which needs to be rated for the highest amp cable being inserted.
In the picture below the cables are as follows from the left:
- Red – Battery +
- Black – Battery –
- Brown / Purple (two wires) – Motor 1 + and –
- Black – Brake + or – (polarity does not matter)
- White / Green (two wires) – Motor 2 + and –
- Yellow – Brake + or – (polarity does not matter)
To help work out how to wire up the Sabertooth, as well as consulting the Sabertooth Manual, I had to follow a couple of guides, one was a digital download on motorising a DALEK (Need to be a paid up member) and the other was this guide on building a Robot using an old powered wheel chair.
Fuse as recommended on some of the guides I have been looking at I installed an automotive blade fuse in line with the battery positive cable. I only had a 15Amp and a 10Amp available. The 15 Amp worked fine whilst I had the motors set to half speed but during a test I set them to full speed and after doing a couple of short turns I fried the 15Amp fuse!!
The Microprocessor(Raspberry Pi) – Initial Setup
The microprocessor chosen for the Robot was a spare Raspberry Pi 2. I decided to wipe a spare SD Card and start from scratch. Once the SD card was setup I did the following:
- Installed the latest Rasbian Jessie OS.
- Setup the WLAN to connect to my WiFi.
- Installed ‘netatalk’ a file sharing utility that allows my Mac to access the Raspberry Pi file system making file transfer a doddle.
- Downloaded and installed WebIOPi (used for serial and web control)
- You need to install a patch to get WebIOPi working with Pi2 Model B.
Use the installation instructions from the WebIOPi web page for detailed instruction on how to use WebIOPi.
To use WebIOpPi you have to start the webio service, after which WebIOPi is accessible on any other device connected to your LAN by entering the following as a URL in your web browser (insert your Pis IP address):
http://Pi IP address:8000
You will then be asked for the user name and password for WebIOPi which is ‘webiopi’ and ‘raspberry’ by default.
Next to test that WebIOPi is installed and working correctly I wired up an LED to GPIO 27 and using the GPIO header GUI available when you access the WebIOPi URL above. Set the GPIO pin to OUT by clicking on it and the click on the pin number itself to activate it. If everything is working correctly your LED should illuminate 🙂 I found quite a good guide here showing most of the steps above.
The Serial Code
To initially test that I could control the motors by sending serial commands over USB I wrote a short python script using information from the webiopi tutorials. Here is a link to my script on GitHub:
N.B. you need to know the serial communications port that you have your motor driver connected to. To do this type the following at in a terminal on the Pi:
This will list all of the tty devices. Your motor driver will be towards the end. Mine was /dev/ttyACM0. To help you find it run this command before you plug it in and then again afterwards and notice any addition port listed. This will be your port number.
You can also enter the following command in terminal:
dmesg | tail
This will give you the device details in plain english.
Make sure that you study the tutorial and add the correct serial port in the DEVICES section of the webiopi config file (/etc/webiopi/config).
Advance Software Setup
Now that we know that we can send serial commands to the motor driver from the Raspberry Pi it’s time to get down to the real stuff, configuring a web based control panel to provide remote control.
To make the remote interface I installed mjpg-streamer, this is a great piece of software that I used on my Biscuit Tin Telepresence robot. A good up to date guide on how to do this is here. Once mjpg-streamer is up and running you now need to create you web interface. The interface will consist of two things:
- A html script for the web interface
- A python script which will interpret the commands from the web page using webiopi and send the appropriate serial command to the motor driver.
When I tried to connect the camera and the motor driver the camera stopped the Pi from sending serial commands to the motor driver.
reboot before trying to verify your device is listed in /dev
For information on how to create a bash script use this guide here.
Engineering Life Plus Hacks: http://www.deviceplus.com/how-tos/raspberrypi-guide/raspberrypi_entry_030/
Building an RC Robot Using a Wheelchair: https://www.allaboutcircuits.com/projects/building-an-rc-robot-using-a-wheelchair-base-part-2/