RC to Baby Orangutan to Maestro please help


I’ve been working on a small robot for quite a while now, and have finally collected all of my components.

I am creating a self balancing RC controlled single wheeled bot. I have 2 sharp IR sensors to determine lean angle, a motor to control forward back movement, and a servo to swing a counterweight to maintain balance. If your curious about the design you can see pics at the bottom of this page: gscustoms.wordpress.com/

Here are my chalenges…

  1. I cannot get the 3P code for RC control to work on Baby O. I can program it to do other test programs, but is there some difference I need to account for when running this code on Baby O?
  2. I cannot find an example of IR sensors being used with the Baby O. I know it has analog inputs, but C code is pretty new to me so I was hoping to find a working example.
  3. I need to send commands to the Maestro to control the servo. Basically as the robot starts to lean I need to send a serial command to Maestro to swing the battery the opposite direction. I understand that it is looking for a string of commands indicating the servo number and position, but I cannot figure out how to do this with Baby O.

I know these are large issues, but I thought I would post them up while I am trying to figure it out incase someone already has overcome these obstacles before!

Thanks for any help!


That design looks very nice. I’m a bit concerned about the response time of the Sharp distance sensors, especially since your robot looks rather small. The sensors only update about 40 times a second, and though I’ve seen them on some bigger balancing robots, a smaller design will fall over more quickly. Have you considered using accelerometers and gyros? That would also have the benefit of not requiring a level surface.

For your challenges, they are large issues, so I think you should treat them individually. From what you’ve said on the first issue, I have no idea in what sense your code isn’t working; in general, the microcontroller is the same and you’re just using an I/O line, so the code should work. For reading the sensors, you should look at some other analog reading examples, and if you have trouble, get more specific in your posts. For the Maestro, it’s the same thing: what have you done and what isn’t working about it? We can’t tell if you have questions about the protocol or about setting up the UART or about what physical connections to make.

- Jan


What Baby-O do you have? Assuming it is a B-328, you should have no problems getting 3pi code to run on it, as long as you remove any LCD, pushbutton, and light sensor code.

I wanted to add to Jan’s response to mention that there are a number of example programs included with the Pololu AVR Library. In particular, we have example analog programs called “analog1”, “analog2”, and “analog3” that show different ways of using the A/D ports, and the 3pi examples “3pi-serial-master” and “3pi-serial-slave” show how to use the serial port. You should probably mostly look at the master code, since that corresponds closely to how you would use the Maestro.



Note that now the Pololu AVR library has an OrangutanPulseIn library that makes it simple to read RC channels (it handles all of the pin-change interrupt code for you). This portion of the library isn’t yet documented in the user’s guide or command reference, but I wrote a forum thread about it that might help you learn how to use it:

I will be documenting it soon. If you’re having trouble with the 3pi RC code, I recommend you try the OrangutanPulseIn library functions.

- Ben