Endeavors of hacks, howtos, and destruction

Open Source Robot Controls

I’ve been playing around with some ideas for an Arduino/Netduino robot control system the past few months. I knew that I wanted to be able to control my robots from an Android phone, PC, or any other WiFi enabled device. I also knew that I wanted the system to be small and simplistic, but also powerful and extensible. The reason I went with an Arduino (Ethernet Pro) or a Netduino Plus for the controller was the low cost, ease of programming, and the embedded ethernet port. I coupled the onboard ethernet with a wireless router so that I could connect and transmit data to the robot wirelessly. Here are the results of our first robot build with this system. The robot was affectionately named Mantis.

While developing this control system, I wrote an open source app for Android devices called IPGamepad. It is now in the market for free and available on Google Code. On the Google Code page you can also find the Arduino, Netduino, and Python code for use on your own robot control system. Episode #7 of The Tech Junkies gives a good overview of how the system is put together, how the code works, and a closer look at the Mantis robot:

As for all of the parts we used in the video, here’s all of the basics you’ll need to get your control system off the ground:

It’s a bit rough, but here is the basic layout of the wiring for a basic robot setup using this system:

I’m definitely looking for help to continue the project and add several more features to the Android app and controls side of the system. Feel free to pitch in or contact me through the Google Code page. As I pointed out earlier, all of the code to make all of this work is up on that page.

If you’ve got any crazy robot ideas or just need some help implementing the system, go ahead and add a comment to this post. I’ll try to monitor the page and get back to you as soon as possible. I’ll be out at Maker Faire Detroit next weekend (30th and 31st) demoing Mantis and a few other robots driven by this system. I hope to see you there!

Share this:

Like this:

Related

63 Comments on “Open Source Robot Controls”

Hi, this is really cool. Where did you get the chassis and wheels, etc?

I’m new to this sort of thing and dont know much about electronics. Where is a good place to start when trying to build something like you have?

There is no way I’d know what pieces I’d need or whether it would support the power consumption for breakers, fuse box, regulators, etc. Very interested in knowing how you went from idea, concept and prototype.

The chassis was just square tube steel we cut up and welded together. We used solid steel tube for the axles and picked up some cheap wheels from northerntool.com.

Take a look at the build of materials I listed above…that should be just about every electrical component you need. We were able to buy about 90% of everything from robotmarketplace.com or sparkfun.com.

We ended up using a lot of parts that are typically used for FIRST competition robots, so we had a ballpark idea of the power requirements. What size robot are you thinking of?

The headlights were just cheap car headlights we picked up at Autozone. They’re wired directly into our 12V spike relay which is controlled from a digital pin on the Netduino.

We’re using four of these CIM motors: http://www.andymark.com/product-p/am-0255.htm For the price you can’t beat them! We’ll try to get a bit more footage while we’re at Maker Faire this weekend. In the meantime, there’s also the YouTube video on the front page of ttjcrew.com.

Eric
Very cool project and professional build. I download all software, thank you.
I loaded the arduino code on a EtherTen and it prints “robot control system initialized” Don’t have an android YET. I know nothing about python, but I put python 3.2.1 on windows XP And I do get a shell I think its working. I’m not clear on pygame and your code? Any advice will be greatly appreciated. Also how many single acting spike relays have you plugged into one arduino at the same time?
Bill

Logitech F310 USB Wired Game pad with drivers installed.
6.5 year old DELL Laptop with XP sp3.
Kyocera KR2 Router at 192.168.1.1.
EtherTen Arduino at 192.168.1.22.
////////////////////////////////////////////////////////////////////
Python Shell
Python 3.2.1 (default, Jul 10 2011, 21:51:15) [MSC v.1500 32 bit (Intel)] on win32
Type “copyright”, “credits” or “license()” for more information.
>>>
////////////////////////////////////////////////////////////////////
Pygame AND Pywin From your Links.
python_robot_control_v01_2.py From Google Code.
When I double click the .py file, I see a black screen for a second or less then it disappears ?
All the software loaded ? OK, NO Ererss.
I can ping the arduino ok, and the arduino can talk to google with deferent code.
Control Panel > Game Controllers > Logitech Dual Action Properties Test Page is working OK.
I’m monitoring network activity with windows task manager with all columns selected.
Many Reboots on every thing.
I keep thinking I’m missing something.
I appreciate your time, and I hope I’m not wasting it.

I found another of your projects that’s a much better fit for what I’m trying to do,
A driver side PS2 controller, Arduino and Ethernet Shield control system for 221.
The question is your android phone App. Setup for the software on their site ? And also Is it possible to change your Android App. Using Google’s AppInventor ?

No worries…sounds like the app may be encountering an error and just exiting. What if you open up the Python terminal first and then drag the .py file to the window and run it that way? Does it stay up and allow you to see an error message? I haven’t used that particular version of Python on Windows, so it could be an issue with that version.

Right now the android app code isn’t setup to control that exact control system, but the data packet is almost setup the same way. With a little bit of tweaking you could easily get both running together. I’m hoping to publish the code and wiring diagram for the PS2 controller arduino-side soon.

I’ve never used Google’s AppInventor so it’s tough to say…if you do find anything out about it or give it a shot, let me know so I can tell our readers about that!

Eric
First: nice video at Maker fair.
I tried your suggestion, and it did the same thing and opened briefly.
After guessing and stumbling around in the dark, I got your file opened in the python shell and called up the debugger after guessing and fooling around for awhile I managed to get two errors that I managed to repeat two times and it was the same both times, this means to me I’m consistently good at making mistakes the same way or I may have stumbled and fumbled and produce something usable?
I made screen captures of both of them. Because I don’t think I could sufficiently described the results.
You have my e-mail, if you’d like to do something else or try something else give the word, I’m game.
Bill

Eric
I tried deleting the print line and saved, same thing when I click on it.

I followed your directions, deleted everything, downloaded the new files, loaded all the files, did a restart, loaded robot control on the arduino, and it’s WORKING as far as I can tell, you’re the man.

Thanks for the feedback. We ended up using ToughBoxes from AndyMark: http://www.andymark.com/product-p/am-0145.htm You’d be correct on the 2 CIMs/gearbox. We took out one of the stages in the gearbox so it’s a single reduction. This took a little bit of modification/drilling, but it ended up working well. The sprocket on the end of the ToughBox shaft is a 10 tooth garage door opener sprocket. We used 46 tooth bike sprockets for each wheel and connected it all with bike chain.

Thanks, Rob…it’s much appreciated. The ToughBoxes are designed to accept two CIM motors without any modifications. We simply drilled a hole in the other side so that we could remove a stage in the gearbox and flip the gears around 180 degrees. If you purchase the ToughBoxes with the gearing you need, you won’t need to modify anything to couple the two CIMs.

We’ve actually got an IP based camera that we’ve tested onboard the robot. It connects to one of the ports on the router and our eventual plan is to do video processing on a remote PC and then transmit control data back to the robot.

Thanks for the prompt reply Eric. Let me rephrase my question about the motors. Did you find that a single motor per side was inadequate to drive this type of chassis? Do you know what gear ratio you ended up with in the ToughBox?

No problem…a single motor on each side should’ve been just fine, but for the price of the motors, we decided to use 4. I believe it’s just the standard gear ratio of the toughbox (12.75:1) that we ended up using.

Unfortunately I have neither any iOS hardware or an Apple developer license at this time. If it appears as though there is enough demand I will definitely consider it, though. I’m actually in the middle of a new project based off of IPgamepad (open source) that will be released in the coming months. It should be much more capable than IPgamepad and have some neat things like packet checksumming so that all control data is validated. It’ll also be a 2-way communication protocol so you can get feedback from your robot. Hopefully that will make it to iOS at some point.

hey there guys im a rc fan that had a little bit of electronic experance but very little in the programming feild have come accross the ipgamepad and would like some help it has the basic features i would like for my robotics project but i would like to expand on the idea and also have on screen switches for lights and other acc is there any chance you will be adding new fetures to the program or can you point me in the right direction to modify or extend on your idea email me back at the provided address

At the current moment in time I’m not able to add those features, but I would love to make a much more feature filled version in the future. In terms of modifying the app, it probably won’t be all that bad. The code is pretty simple and it would just be a matter of placing new components on the GUI and then sending this additional data over in the packet byte array. You can take a look and see how I added the headlight switch to get an idea.

As far as making this run on smaller scale robots, of course. As long as you can control it from an Arduino, this system should work well for you!

I got your older “PS2 Arduino wifi code” working with your
“Open Source Robot Controls” Robot Side.
My First Arduino Project.
There’s still some bugs. Next I want Data feedback from the robot side = Speed, RPM, Gas Gauge, GPS. From a Lawn Mower “part 2 coming soon” Take a look at part 1: http://youtu.be/id6rz9pvz7s
Thanks so much for the help.
Keep up the GOOD work/fun

This is awesome stuff! Glad to see it’s been working out well for you. I look forward to part 2 =) If you want to check out some code I’ve written since then that allows feedback data to be sent, here’s another project I’ve been working on:

Eric
Now this is awesome stuff!
You’ve been BUSSSSSY and then some.
I look forward to trying it out, it will take me awhile to watch and read it all, But I did a quick 15min. skim over: On the robot side all the data is running over wifi and udp? Thru the arduino first? Then to the robot control shield? And the feed back is from the [robot control shield] and the [arduino] both?
It looks like “I think android code” has video?? Is the video running thru udp to???
Is the android code ready for prime time? – I’m not sure what to do with the code?
Can’t find it on the market.
Keep up the GOOD fun/work
Bill

Yup, everything is UDP/WiFi just like IPGamepad. It passes through the Arduino and the atmega on the shield is for generating PWM signals. The feedback comes from the Arduino as the shield is just used for interfacing with the FIRST Digital Sidecar and PWM generation.

The video is all separate of the Arduino. Just using a standard IP based camera. The Android code isn’t quite ready so it’s not on the market. The current version in Git is just for tablets – it does support an Xbox 360 controller though.

Hello Eric, your project is amazing! I was wondering how the router is setup to receive data from python. Does the router need to be hacked or does it work straight out of the box with the original firmware installed on the linksys router? Any advice would be great!
Thanks

The router is completely stock – no modifications. The Arduino (or Netduino in this case) is what accepts and parses the data being transmitted from the phone. The phone has its own IP address and so does the Arduino/Netduino. From there it’s just being sent as UDP packets that contain the joystick values.

Sorry, I’m still having a hard time understanding the setup. Is the router on the Robot consider a “Wireless Bridge” to your home access point network? Or are you creating a totally different network all by itself for the robot? In that case, I’m guessing there’s new internet connection on the robot router??

Yup, completely separate network. That’s correct – there is no Internet connection when you are connected to the robot. You could certainly use a Wireless Bridge and connect to your home WiFi…but where’s the fun in driving a robot restricted to your house? =)

Can you get video feedback from an IP camera on the robot router network without any internet?? I never knew that was possible or not!! If so how difficult would it be to implement computer vision from the video feedback??
Thank you so much for your replies, i’ve learned a lot from your tutorials!

A group of us built a robot last year to compete in a NASA competition. That robot had a netbook communicating through serial to the Arduino. The programming language I used was Processing. I used a simple Client/server library to communicate with the robot and the control base computer. The problem with that setup is that the program must be running at all times in order for it to work. I REALLY like your idea of using a router instead of a netbook which makes things whole lot simpler.

Indeed you can! A lot of IP based network cameras just have a web interface that you could log into (e.g. http://192.168.1.x) and view the video live. Axis specifically makes some really solid hardware/software that usually hits close to 30 fps over WiFi.

finally some code using upd ports! Love your work! Just getting back into this hobby.. was using oopic controllers before… Check out Ubiquiti’s Long Range Access Points/ Routers.. they are cheap and can be put into bridge mode very easily…

Let me start by saying YOU ROCK!!!!!!
I implemented your ipgamepad robot control system and it works like a dream. Right now i have the left control running forward & reverse and the right control running the steering(tank style) on the ipgamepad app. Is there any way to configure the left control on the app to run forward and reverse on the y axis, and run the steering(tank style) on the x axis, leaving the right control unused. This would allow me to control forward, reverse, left and right with just one finger.

Hi Eric,
Back in June I mentioned how I used your app to control a golf cart on the golf course, so far so good it works Great!!!! The whole system functions, how ever I was wondering if there was any way to configure the left control on the app to run forward and reverse on the y axis, and run the steering(tank style) on the x axis, leaving the right control unused. This would allow me to control forward, reverse, left and right with just one finger. Is this possible?….and does it require a lot of rework?

Hi Eric,
Just wanted to touch base and ask you if you had a chance to review my previous post. I was wondering if there was any way to configure the left control on the app to run forward and reverse on the y axis, and run the steering(tank style) on the x axis, leaving the right control unused. This would allow me to control forward, reverse, left and right with just one finger. Is this possible?….and does it require a lot of rework?