Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Controlling m3pi (no mbed) from computer via XBee


I’m brand new to m3pi and XBee. I’ve so far been very impressed with how easy it has been to get going, so kudos for that. I want to be able to control the robot from a computer. As per the user manual I do not have the mbed socketed, and so i shorted the three jumpers beside the XBee socket. As per Digi documentation i set up the XBees with API firmware using the XCTU software. I also confirmed that the XBees can communicate. In both cases the serial was set to 115200 8N1.

There are two related problems. First, when i turn the m3pi on, it beeps twice and displays “bad cmd 75”, and then beeps twice again and says “bad cmd 73”. Second, when i send a wireless command, i get the “bad cmd” message but the byte that i sent is not the byte that gets displayed. For example, if i send a 0xb7, it says “bad cmd 32”. Some bytes cause the robot to react (move forward, etc) but are always associated with an error message.

I’m thinking that maybe the XBee is forwarding a frame to the m3pi serial slave and the error message displayed is the checksum or something. But i don’t know why it would be doing this, and i can’t find any clues as to how to fix it. Can anyone help?

Best regards,


Hello, Matthew.

From your description, it sounds like an XBee configuration issue. Which mode (API or AT) did configured your XBee modules to? Can you try using the Serial Transmit Utility to send commands (listed under the “Serial slave program” section of the Pololu 3pi Robot User’s Guide) to the m3pi? Do you still get errors?

- Amanda


Hi Amanda,

Thanks so much for your response. I had had the mode for both XBees set to API (as per Digi documentation here: http://docs.digi.com/display/XBJLIB/Configuring+your+XBee+modules). The factory settings of the devices though were AT. Based on your message i set the remote device back to AT, and voila, it works.

A couple more quick questions:

  1. Do you know if this is a good configuration for the XBees, i.e. local (to the computer) as “Coordinator API” and remote as “Router AT”?
  2. Is there a way to set the 3pi to always use slave mode? I think out of the box it will wait for a command for a few seconds, and then launch the demo program. I could have the computer constantly poll, but it would be nice to not have to do that.

Many thanks,


The API mode adds more bytes of overhead on the serial interface, which is not handled in the serial slave code. If you want to use API mode with the m3pi, you will need to modify the code. Otherwise, you should configure both modules to AT mode and specify the module connected to your computer to be the Coordinator and the other module (connected to you m3pi) to be the End Device.

You can program the 3pi with the serial slave program (which does not include the demo code), however, you would need to use an AVR programmer like this one to upload the program to the 3pi.

- Amanda


Very helpful Amanda. Thanks again!