ComMotion Motor Shield

I need the arduino code to control a rover robot so it can go forward, backwards, left, and right. I used the Commotion Motor Controller. The thing that confuses me though is that I have no idea about the pins. Example: If you were to say pinMode(x, HIGH); x would be unknown because I have no idea which pin it is. I hope you can help me. I have looked at a bunch of different motor shields to use them as a example but I have nothing. I hope you can help me. : :confused:

Here’s the image attached to the top post so others don’t have to download the image to view it.

dd0707e99e50db93e919022d2ce1c608a68965b3.jpg

Here’s a link to instructions on how to insert an uploaded image (for next time).

Blueglide mentioned working on some demo code for the ComMotion shield.

There used to be a lot of documentation on the ComMotion shield on Let’s Make Robots. The new owners (RobotShop) deleted content of users who didn’t agree to their new terms of service. The person who designed the ComMotion didn’t agree with the new TOS so all his posts were deleted (they also deleted all my posts).

I have a ComMotion shield myself. If the demo code Blueglide provides doesn’t help you I’ll attempt to help you myself.

While the ComMotion can be programmed directly, I believe it’s mainly intended to be used as a shield to an Arduino or compatible board. IIRC, the ComMotion was originally designed with SparkFun’s Redboard in mind. It looks like Sparkfun has some demo code you could download.

I have some demo code for the ComMotion. I’ll check the code on SparkFun and Blueglide’s code to see if the code I have is different from these other options. If the code I have is different, I’ll make it available for you to download.

I’ll try to keep an eye on this thread but if you post and I don’t reply within a day or two feel free to send me a PM with a link to your post.

BTW pinMode takes INPUT, INPUT_PULLUP or OUTPUT, not HIGH. (You probably meant that, but just in case)

Thank you for your reply. I will try and model code using Blueglide’s code. The only problem is that his code isn’t working. I used the Bogie Runt Rover Chassis. The motor shield is also attached to the Arduino Uno. I can’t provide a picture because the file is too big, I already tried sorry.

amriechert:
I can't provide a picture because the file is too big, I already tried sorry.

You can use MS Paint (or just about any other graphics program) to resize the image. I almost always use Paint to crop and resize pictures before I post them. I usually resize with a 25% setting.

A link to the robot you're using would be helpful.

Do your motors have encoders?

No I do not have encoders, I know what they are but not how to use them. Here's a link to the rover https://www.servocity.com/html/bogie_runt_rovertm__637162_.html#.Vnnv0fkrLIU

So you have six motors right?

The ComMotion shield can control up to four motors independently. Do you plan to group the motors into sets of three?

What sort of battery are you using?

I did qroup them. I use a 7.4 volt LiPo Battery to control this rover.

I whipped up a demo program modelling the dfrobotshop rover code and blueglider’s code. I’m hoping you could give me some suggestions to help me modify it or you could modify it yourself thank you.

here’s the code:

ScienceBot1_Demo_Code.ino (934 Bytes)

amriechert:
I whipped up a demo program modelling the dfrobotshop rover code and blueglider's code. I'm hoping you could give me some suggestions to help me modify it or you could modify it yourself thank you.

I'll take a look at the code and try to offer some suggestions.

Do you plan to control the robot from a keyboard or are the keyboard commands just part of your initial testing plan?

Do you have plans to use any other type of controller?

I plan to control the rover from a keyboard using 0 = stop 1 = forward 2 = backwards 3 = left 4 = right.
It’s still a work in progress. I modeled the keyboard control using dfrobotshop rover program. I’m thinking of different motor controllers, but I will most likely not use a different one. I’m also on a time limit, so I have 2-4 weeks to complete. Thank you please respond. I also plan to add a xbee to the motor shield since it already comes with a xbee mount. Here’s the code I modeled my control from.

sketch_dec21b.ino (1.28 KB)

amriechert:
I also plan to add a xbee to the motor shield since it already comes with a xbee mount. Here's the code I modeled my control from.

A XBee seems like a good idea. Do you already have the XBees? If you don't we might want to discuss other options but if you have the XBees already, then I can help you with these.

Do you have some sort of joystick? Forward, backwards, left and right are okay, but IMO, proportional control is so much better. With a joystick you don't just tell the robot to move forward, you can tell it how fast to move forward. The same goes for turning. With a joystick you can control a robot to gradually turn or turn in place.

A normal analog joystick could be used or a game controller of some sort. A Wii Nunchuck, a PlayStation 2 controller or a GameCube controller can be used with an Arduino and all make good robot controllers. Normal RC gear can also be used a robot controller. Another possible controller would be a smartphone (Android). All you need is an inexpensive Bluetooth module to use a smartphone as a controller.

As I mentioned, I'll look at the code some more when I get a chance. I have a couple motors I can test the program with.

I do not have the xbees but I was planning to order some tomorrow. I have a Iphone I could possibly control it from.

Wait I could order some analog joysticks and they can be here in a week, but I initially planned to use my computer to control it, but I guess I could change it up. I was going for a NASA style rover because I was going to add many sensors to my robot.

Right now im studing page 2 of this link to help me modify my code. https://cdn.sparkfun.com/datasheets/Robotics/ComMotion-Manual.pdf

amriechert:
I do not have the xbees but I was planning to order some tomorrow. I have a Iphone I could possibly control it from.

If you get XBees you want to make sure you have a way of connecting the XBee to the computer. There are lots of possible options to do this.

I'm sure there are plenty of programs one could use with an iPhone but I don't know what sort of Bluetooth module you'd need. I don't have an iPhone and I don't know how one would use an iPhone to control a robot.

amriechert:
Wait I could order some analog joysticks and they can be here in a week, but I initially planned to use my computer to control it, but I guess I could change it up. I was going for a NASA style rover because I was going to add many sensors to my robot.

It's certainly possible to use a computer and an analog joystick to control a robot but in order to use both a computer and a joystick, you'd need a microcontroller to read the joystick positions. This would complicate the control station.

Your original idea of using the computer to control the robot would likely be the easiest option.

You wouldn't need a microcontroller for the XBee connected to the computer. You just need to get a board which allows the computer to communicate with the XBee.

I think XBees are fine (I have a bunch myself) but I think they're kind of expensive compared with other wireless communication options.

One wireless option is a Wixel. Pololu's Wixel allows serial communication between an Arduino and a computer and it also allows the Arduino to be programmed wirelessly.

Here are a few suggestions on parts.

F/F jumper wires. You only need wires with female connectors since you can add these long pins when you need to connect two female connectors together.

I used to purchase M/M, M/F and F/F jumper wires but now I only purchase the F/F kind. The long pins used to join two female connectors together are stronger than the pins which come on the male connectors. Long wires can cause all sorts of noise problems. You generally want to keep wires as short as possible. I suggest getting mostly 3" wires but you'll want some 6" wires and probably some 12" wires too.

There are lots of sources for these sorts of jumper wires. Adafruit is another good source for jumper wires. If you purchase jumper wires without the black plastic connector housing make sure you purchase some (Pololu sells the housings separate).

If you were to use Wixel radios, you'll need to load the appropriate program onto the Wixel. This isn't hard, but keep in mind Wixels aren't plug and play. It might be slightly easier to get up and running with XBees but the effort required to use Wixels should be worth it since you can use the Wixels to program the Arduino wirelessly.

I haven't had time yet to try out the ComMotion programs. I think I'll likely try these out in the next couple of days.

I will think about using wixel, but I already did lot's of research on xbees.

Thanks for replying I will consider Wixel, but I orginallly planned for Xbee, and already did lot's of research on xbee

Duane Degn could you also list compatible xbees for the ComMotion MotorShield

I think XBees or Wixels would likely work for your application.

I previously mentioned advantages each type of radio has, but I didn't mention one of the advantages a XBee would have over a Wixel. As you're already aware, the ComMotion shield has a socket for a XBee. A XBee would likely look (slightly) "tidier" than a Wixel.

The XBees would likely cost more since you'd need a board to connect between the XBee and the computer.

I'll try to help you get setup with either radio system.

It's your decision, but I think I have a slight preference for the Wixel. I certainly won't hold it against you if you go with XBees.

If you get Wixels, get at least one of them without the leads soldered in place. I think it might be easier to incorporate a Wixel into a robot if wires were soldered into the PCB holes rather than header pins. As I look at one of my Wixels in front of me, I don't think this matters much. If you don't mind soldering a bit, get at least one Wixel without leads, but if you're not comfortable soldering then a Wixel with leads would likely be easier for you to use.

amriechert:
Duane Degn could you also list compatible xbees for the ComMotion MotorShield

I doubt there are any XBees which aren't compatible with the ComMotion shield.

You're welcome to post links to items you intend to purchase and I'll let you know if I see any problems.

I was thinking about using RF because it's also really cheap, but I would have to solder wires as the antennae, but I can't solder. The upside about the ComMotion is that is saves money not having to buy a xbee shield. Instead of a Arduino Board with a shield connected to your computer you could just use a xbee explorer which would cut cost prices. Also im hoping you get time to take a look at my code and test. Here are some links to some parts I've been thinking about using. I'm still unsure. Note that i'm 11 and can't solder yet.

explorer: http://www.robotshop.com/en/sfe-xbee-explorer-usb.html $24.95 for 1
Xbee(x2): XBee 1mW Wire Antenna - Series 1 (802.15.4) - WRL-08665 - SparkFun Electronics 24.95 for 1