Let's Make Robots!

Motor drivers?

I really didn't know which forum this should be in. To start, let me say my head almost exploded after Chris el Carpintero on Live Show 007 casually mentioned his use of a i2c servo controller. Sweet Hey-suess, that means two wires can control a grip of motors right? Just making sure before...

So I marvelled on that for awhile. Then I started looking up what components are on one of the salvage boards I found. A hex schmitt inverter, 2595 volt reg, some monostable vibrators, and this A3977SLP. Thankfully it's in 28 pin TSSOP packaging so I can extract it easily. It only drives one motor but it seems to have some interesting features. I don't know, I haven't had to deal with PWM motors yet. I know it's worth ~$8 on Digi-key. These pass through the dumpster now and again. Does it look like a useful IC? Would anyone find these useful?

The common thread here is this motor controller can get 1, 1/2, 1/4, etc step out of a pulse on one wire. CtC's servo controller (and feel free to send me more info on that gem, thanks :D ) only needs the two i2c pins to power multiple motors. Amazing to me how much you can milk out of a couple wires.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hey Jax, good chip - good find! Microstep, PWM current control, simple step and dir control pins. They only drive stepping motors not normal DC motors, but they would be ideal for them.

If you end up pulling a few from equipment I`m sure I could paypal you some cash for them.

I'll keep my eyes and wirecutters open for you. I'm trying to get the motors that they drive as well. To remove them from the bulk of the equipment they need some crazy off-sized metric hex wrench that isn't in my multitool, bah. I'll get them though...

Alright... Servos are not motors and motors are not servos. Consider a motor, it is a dumb machine -add power and it spins and you can vary the power in different ways to make it faster and slower and stronger and weaker. This is done with a motor driver chip (A small robot would use a L293, for example). This motor driver takes a small signal from the robot brain and turns on/off a much bigger amount of juice that goes to the motors. There are step motors as well, but still you are just sending power to a motor and it turns now, with the steppers, just in a different way.

Now a servo (and the i2c servo driver) is a diffferent thing. A servo does not spin, rather it can rotate usually 90-180 degrees. It does have a brain in it, as well as it's own motor driver (there is after all a motor inside the servo, as well as some gears). The servo gets constant power as well as one signal wire. This signal wire (connected to the microprocessor, and RC reciever or a servo driver chip) sends a signal to the servo that the servo decodes and uses to know what position we want it in. I.e. tell it to goto center, and it will every time.

More complicated: The robot brain uses an internal timer that it uses to control the signal going to a servo or to control the PWM (speed control) of the motors. In the case of the picaxe chips, these two things can not be done at the same time with the same internal timer. Bottom line is that with a picaxe, you can have servos or speed control of your wheels, but not both. In my case, a i2c servo driver solved the problem. This is an external chip that connects to the picaxe with the i2c lines and can control up to 20 servos. Servos, not motors. The one I use comes as just a chip without a board but there are a ton of different serial and i2c servo drivers out there.

On top of that, there are also motor drivers that speak i2c or spi or uart serial. Some of them have provisions for encoders on-board, speed control, braking and other kinds of stuff. Again, there are a ton of these out there as well.

I2C-- The nice thing about i2c in general is the fact that everything on those two lines has an address so you can stack up almost unlimited doo-dads on the same two lines with no probems. In my case, my i2c lines are attached to servo drivers, eeproms, BlinkM leds and my LCD screens. All attached to the same 2 wires, all work fine.

One more: Both voodoo and I are working on our own versions of serial motor driver boards. There is another forum thread on the subject, BTW. I don't like how any of the serial motor driver boards work (the ones I can buy) so I/we are just making our own. The forum post is to start getting ideas about features we want to code in.

Hope that helps.

I should mention that there are continuous rotation servos as well --The accept servo commands/controls just like a regular servo, but they rotate like motors. Sending different "position" commands will vary the speed of the rotating.

Nice info, thanks. I didn't even think of a servo driver in a servo driving sense. I immediately thought "servo, i2c driver servo driver, gut servo, acheive i2c protocol continuous rotation servo." I guess if you just plug in a number 0-359 or something like that through servo_pos it should work in picaxe? I got a manual, I'll do some more reading :) Thanks for the leads.

I'm pleased to hear of you working on a custom serial driver board. I'll have to track that post. I'm curious why you don't use i2c lines to speak to a motor driver instead of going serial if they are readily available.

There are many serial interfaces. The usual is the UART that implements the TTL (5V logic) version of the RS232 computer standard. But then there is RS485 (this is used on the Dynamixel servos), I2C (or TWI how it's called in Atmel chips) One Wire and others.

The standard UART interface lets you connect only 2 devices per bus, so you need 2 wires for each device you need to talk to. You may use only one wire if the device doesn't need to report back. But RS485 and I2C lets you connect in theory 256 devices on the bus, so you use only 2 wires for multiple devices. This is why people start to use more and more the I2C interface for robotics. There are already available lots of sensors and other peripherals that use this interface, so why not take advantage of it?

I used the I2C interface on my MiniEric robot and made 4 modules, each with an Arduino compatible board. One module is a servo controller, one is a motor controller, one controls the voice and the last one is the main brain. Each module runs independently and can receive commands from the other modules in the background. Nice and easy.

Once was in a book on PIC programming with JAL and the other was just a quick search to see if I could find the suggestion elsewhere.


Are the two examples I have seen breaking rules?

I should have said that we usually call Motor Drivers a board that has an H-bridge on it to drive a couple of DC motors. The driver is controlled by a microcontroller using one of the several control methods, usually 3 wires: one for Enable, and 2 for Direction. There are methods that use 2 wires or only one wire.

A Motor Controller has a driver and a microcontroller on the same board. For example look at the Sabertooth controllers. The onboard microcontroller takes serial commands and use the usual 3 wire control method to turn the motor. If you want to make your own controller, chose your favorite microcontroller and a proper H-bridge for your motors and design a board for them. Then you will program the microcontroller to get serial (UART, I2C, etc.) commands and you're done. I have used a Mega168 and a SN754410 h-bridge to make my I2C motor controller (with encoders). The command syntax is: I2C_send(Address, Command, Value1, Value2), for example I2C_send(MotorController, Forward, Speed, Distance). Every variable is one byte for easier transmission. If you want to take a look at the code, it's attached to my robot's page here. I can provide the schematic if you need it.