ROS and Arduino: A Beginner's Guide

As you may have read earlier in this blog, I have started implementing ROS on my wheelchair robot. It has definetely been an uphill struggle but it's going, there is no doubt about that. Between my lack of focus and my not understanding the concepts, I estimate that the project will be "done" in less than 10 years. Just kidding ;-). As I said in a previous post: "Robots are never done".

Back to the topic. As I research more about ROS and the resources for beginners, I see one tiny problem(very tiny): most of the material is geared towards collegiate students and engineers, not as much toward your average hobbyist. So I think I can fix that... I am going to try put down some tutorials here for the people that are just starting out in ROS and trying to make their very own ROS bot. I might as well start here:

If you don't know what ROS(Robot Operating System) is I would highly reccomend that you read the following pages:

Here is the hardware that I will be using for my robot(note: all the code and files written will be tailored to this particular setup you may need to change stuff...):

1x Jazzy electric wheelchair(similar to this)
1x Sabertooth 2x12
1x Arduino Mega 2560
2x photointerrupters (I pulled mine from an old printer)
2x 35ah 12V AGM batteries
1x Microsoft Kinect for Windows Note: I am not sure about the new Kinects compatibility with ROS so in this set of tutorials I will be using the old Kinect which now retail for less than $60, such as here.
custom power wiring (a word about this later...)
1x Laptop running Ubuntu
1x Power inverter 120W

All of the sample code will be stored in my wheelchair_info repository on github, which is accessible here: For now the ROS package and Arduino firmware is here:

The custom wiring I used was basically a switch, a terminal block, and two circuit breakers. I have one circuit breaker per battery on the positive line and I have wired the batteries in series as the brakes on my motors only turn off at 24V and I also get more wattage to the motors.

For connections to the Arduino Mega I have connected the S1 line to the sabertooth(see note below) to TX2 on the Mega and I have the signal line of the encoders connected to digital pins 2 and 3 on the Mega. I almost forgot, don't forget to connect the ground pin on the sabertooth to the GND pin on the Mega.

Note on the care and feeding of your Sabertooth motor controller: This controller is feature filled and therefore requires some setup. To set the DIP switches, Dimension Engineering has made a handy wizard that will ask you a few questions and show you the proper diagram. It is available here: Also DO put circuit breakers rated for a less than 12 amps as without an additional heatsink, the Sabertooth will literally be toast(ed). Not good...

Thats all for now.