SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By striker121
As part of learning some circuitry I decided to build a small autonamous robot. Nothing special, just "If distance to object in front >= 2 feet, turn left 90 degrees, go forward, REPEAT" Only problem is I don't understand the tables that sparkfun carries on them. I was wondering if anyone could point me towards a good driver for this. ... cts_id=319 and hopefully point out how to use it. IE: How to wire it up, and a bit of sample code for forward, reverse, stop. I'm sure I can just edit from there. Any help would be REALLY appreciated.
User avatar
By leon_heller
I've got one of those but haven't used it yet. If you want reverse you will need an H-bridge; things start getting complicated and you are in for a lot of studying. You might be able to manage with a couple of relays, if constant speed is OK.

By striker121
Really I suppose constant speed would be good, but that probably wouldn't be that great for turning. Relays would be the alternative though.
User avatar
By leon_heller
striker121 wrote:Really I suppose constant speed would be good, but that probably wouldn't be that great for turning. Relays would be the alternative though.
An H-bridge for each motor is the proper way to do it, with PWM.

By whoismaha
I recently went down this road and i'd be happy to explain how to do it. Using all Sparkfun parts (yay!)

Arduino: ... cts_id=666
Motor driver: ... ts_id=8905
Motors: ... cts_id=319
Tank treads: ... cts_id=321

I controlled mine via Xbee but you could program it however you want.
The only hard part is wiring up the Motor driver. Picture from official sparkfun listing
ok, top/left side is all inputs. PWM+IN1+IN2 will drive one motor. Just make sure PWMs are connected to an arduino PWM line like Digital IO 10/11. IN1 & IN2 are normal digital IO lines. GND is the ground from your arduino. STBY is basically your on/off switch, i use Digital IO pin 13 because of the built in led.

Bottom/right side is mostly outputs. VCC&GND is from the arduino (power and ground). VMOT/GND is from your external power source to drive the motors, i'm using 2x 9v batteries in a series. O1/O2 goes to one motor.

Ok, on to using it. I'm going to use example pins, you are free to use whatever.

Motor #1, Direction pins 6 & 7 (6 on, 7 off = foward, switch for reverse)
Motor #2, Direction pins 8 & 9
Motor #1 Speed pin is 10
Motor #2 Speed pin is 11

So, set STBY pin 13 HIGH. Set pins 6 & 8 HIGH for forward motion. Finally set Speed pins both to 40 (mid-low speed). That's it.. you're moving.

Here's some fuzzy pictures of mine
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]