A simple wifi controlled tank robot

Keep a log of a project build here. Be sure to include pictures and as much documentation as possible.

A simple wifi controlled tank robot

Postby annath » December 17th, 2013, 8:56 pm

Hey all, I thought this would be a good place to start tracking my work and progress on a project I've started. I'm building a simple wifi controlled tank using a Beaglebone black. My current project goals are:

  • Be battery powered. I'll probably use a 2S LiPo battery with a high discharge rate.
  • Be controllable via wifi. I'm writing a simple server in Python using Twisted to control the motors and the adjustable camera
  • Have a video feed from a webcam streaming to the client. I'm doing this using mjpg-streamer and a cheap UVC webcam.
  • Allow a user to pan the camera left/right and up/down. I'm making a simple jig to hold the webcam and using a pair of stepper motors to move it around.

This is really just the first iteration of a much larger project. Some end goals include making the control protocol secure and adding a simple authentication method (I've thought about making a control app for android and transmitting the security key via NFC), moving to a larger, sturdier chassis, and adding a large arm with a gripper. The plan is for this to be a demo robot at a BEST game that I'll be driving around and messing around with to get the kids fired up. They can take turns driving and I can do routine simple things with the robot. I thought it would be a fun way to get the kids participating really excited about robotics (As if they weren't already, they're at a BEST game!).

Here's what I've done so far:

Got the Beaglebone, of course.
Image
I procured a chassis. I'm using the Tamiya tank chassis from Pololu.
Image
I've gotten better motors as well, that run happily on 5V (the motors that come with the gearbox have significantly shortened lifespan at any voltage over 3V).
Image
I found a suitable power suppy. It's a 5V switch mode regulator with up to 7A continuous output. It should do a pretty efficient job of bringing that 7.4V from the battery down to 5V that the rest of the robot will use. I got a screw terminal barrel jack as well so I can connect my BBB to the
Image
I found a way to power the USB peripherals: I'm using a USB webcam, and a USB wifi adapter, both of which I'm expecting to draw a fair bit of power. I rigged up the barrel jack cable from the remains of an old radioshack wall wart, and stripped off the ends so they can be connected to the regulator's screw terminals, and found a hub I could use since the BBB only has one host port.
Image
Found a webcam. Any UVC webcam will do.
Image

I also started writing some code to jump off from, although I haven't done much yet. It's all on Github: https://github.com/Annath/wifi-tank and will be kept up to date as I go.

This is really the very beginning of this project, and I will try to keep this thread up to date with details as I go!

EDIT: And if anyone wants hi-res images, here's the full imgur album, which I will also be adding pictures to as I go.
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: A simple wifi controlled tank robot

Postby flaming_goat » December 20th, 2013, 8:47 pm

Looks good :) , Im looking forward to how this progresses. Wouldnt servos be easier and lighter for moving the webcam?

Also what is a BEST game?
User avatar
flaming_goat
 
Posts: 2
Joined: December 19th, 2013, 9:50 pm

Re: A simple wifi controlled tank robot

Postby annath » December 20th, 2013, 9:14 pm

flaming_goat wrote:Looks good :) , Im looking forward to how this progresses. Wouldnt servos be easier and lighter for moving the webcam?

Also what is a BEST game?
They probably would, but I wanted an execuse for playing around with stepper motors. :P

BEST is a highschool/middleschool robotics program in which each team of middle and high school students are given a kit of parts and told to build a robot, which has to complete a few specific tasks. The robots are really simple, they use a CPU that connects wirelessly to a controller (pretty similar to an X-box controller) and has a really simple programming language. The actual game day is a big affair with lots of to do made about the students and the robots. It's a really great way for kids to get involved in STEM early, and to feel like rockstars doing so.

EDIT: More info about BEST: http://best.eng.auburn.edu/
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: A simple wifi controlled tank robot

Postby annath » December 22nd, 2013, 10:20 pm

Minor update to the tank robot. Started trying to transition the motor lib to use PWM, and found out that my current kernel version (3.8.13-bone20) has a bug which breaks the adafruit PWM library. I'm going to update my kernel and try it again, and I may switch distro while I'm at it (Arch? Debian?).
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: A simple wifi controlled tank robot

Postby annath » January 4th, 2014, 12:00 pm

I recently picked up a battery for this robot.
Image

I'm expecting a peak current draw from the 5V side of between 2 and 3 amps (So roughly 15 Watts max power dissipation). At any draw above 1A, my switching power supply has ~90% efficiency, so the battery should dissipate around 16.66W. With that 11.1V battery that'll be around 1.5A peak current. Considering the fact that it's a 2100 mAh battery, I should get over an hour of run time from this battery. :D (Someone correct me if I did any of that math wrong).

It occurred to me as well that I'm going to need to add something to watch the voltage on the battery to make sure I don't discharge it too much. This battery has a minimum discharge voltage of 9V, so I probably want to add some kind of auto shut down well before I reach that voltage. I'll have to experiment a bit, but I imagine I can just connect an ADC to the battery terminals and measure the battery voltage. I might use an mcu external to the beaglebone for that and connect it to the BBB via I2C or a UART.
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: A simple wifi controlled tank robot

Postby annath » January 9th, 2014, 10:56 am

I finally got around to wiring the battery up the beaglebone and testing it out. I didn't have time to do a lifetime test, but I was able to run the BBB on the battery for a couple of hours.

Image
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: A simple wifi controlled tank robot

Postby annath » January 22nd, 2014, 9:57 pm

I finally got around to re-flashing the BeagleBone Black with Debian and a newer kernel (3.8.13-bone32) and PWM works now! Now I just have to go about re-configuring the wi-fi and mjpg-streamer, neither of which are very difficult. I should be able to get the last of the small materials at the start of February and all the chassis materials, so I can wrap up the chassis and basic hardware.
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: A simple wifi controlled tank robot

Postby annath » January 24th, 2014, 11:31 pm

So these are the steps I had to take to get the wifi working on the beaglebone. I'm using an Edimax EW-7811Un wifi dongle, which is based on an rtl8192cu chipset.

  • Thankfully, the rtl8192cu module is already compiled in, it just has to be enabled. We want it to be enabled all the time, so I edited /etc/modules to load the rtl8192cu module on boot.
  • I needed to add the wifi details and the interface, so I edited /etc/network/interfaces to include wlan0.
    Code: Select all
    auto wlan0
    iface wlan0 inet dhcp
        wpa-ssid "MY_ESSID"
        wpa-psk "My WPA passphrase"

That was it. Pretty simple. There's some weird-ness where the system isn't aware when an ethernet cable has been unplugged and tries to forward traffic through ethernet by default. If you start the system with ethernet plugged in and then remove it, it doesn't switch over correctly. This isn't a huge deal for this application though.

For the webcam, I followed this guide for building mjpg-streamer, then I followed this guide from the same website for allowing my user to access it. Overall it was a pretty straightforward process. Now I can run mjpg-streamer using
Code: Select all
$ ./mjpg-streamer/mjpg_streamer -i "./mjpg-streamer/input_uvc.so -d /dev/video0 -n" -o "./mjpg-streamer/output_http.so -w ./mjpg-streamer/www -p 8090"
from my home dir.

Some other helpful tips:

  • If you install the acpid package the on-board shutdown button will work under Debian, giving you a clean reboot.
  • Debian has a bunch of really useful scripts in /boot/uboot/tools/scripts/ including ones for copying your filesystem over to an SD card, and even making an SD card into an eMMC flasher for your current system. This is a great way to back a system up when you've finished configuring it.
Last edited by annath on March 1st, 2014, 1:41 pm, edited 1 time in total.
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm

Re: A simple wifi controlled tank robot

Postby annath » February 14th, 2014, 9:48 pm

So my BBB had a hardware failure and I had to RMA it, which held up the project a bit. I've just now gotten it back, so we're making progress again! I started laying out the chassis, and I built a carrier board for the motor driver.

The carrier board consists of headers for the motor driver to sit in, a female header for the BBB to make connections to the control side of the driver, and JST connectors for the motor side of the driver. It also has a JST connector connected to a resistor bridge so that the BBB can measure the battery voltage.
Here it is without the driver installed:
Image

And here it is with the driver:
Image

Next, I started laying out the chassis. The mechanical part of the chassis consists of the Tamiya tank kit I posted a picture of before, and all of the electronics are going onto two stacked pieces of Lexan. Here is the lower layer with nothing but the switch and my rough outlines:
Image

I've given a lot more thought to the software side of things as well. I'm probably going to end up using Faye with digital signing for security. This will allow clients to be written in Ruby, Node.js, or browser side javascript.

And here with all of the parts laid out:
Image
annath
 
Posts: 26
Joined: December 15th, 2013, 3:50 pm


Return to Project Logs

Who is online

Users browsing this forum: No registered users and 1 guest