Driving motors directly with PIC Basic Pro

(I’m a newbie - just so’s you know)

I bought the 210:1 Micro Metal Gearmotor (item #1096) and the Qik 2s9v1 Dual Serial Controller for a wee project I’ve started (fairly simple - rotate 1 motor in the forward direction and the other in reverse, but both at the same speed which I want to set programmatically) but after seeing some sample PBP code online I’m wondering if I can do something this simple just with PWM commands directly to the motors instead of serout commands to the controller. Any suggestions/recommendations?

Also, the user’s guide for the controller shows one 0.1 uF capacitor connected between the + and - leads of Motor M1 while for M2 there are 2 0.1 uF caps between each lead and the housing of the motor. Do I need those? If I end up not using the controller and just driving the motors directly with PWM commands do I need transistors and diodes as shown on cornerstonerobotics.org/curr … ol_pwm.pdf?

Hello, Ross,

In general, the digital outputs on a microcontroller are capable of providing far too little current to drive a motor. The transistor circuit in the PDF you linked to acts as a “switch” that allows the small current coming from the microcontroller output to activate a larger current going through the motor. The disadvantage of this circuit is that it only allows you to drive the motor in one direction; to get bidirectional control, you need a more complicated circuit like the H-bridge motor driver shown on the last page.

All of our motor drivers and controllers use H-bridges. If you are interested in generating PWM signals yourself with a microcontroller, you could consider using one of our motor drivers. (Motor controllers like the qik have higher level interfaces instead, such as serial or analog.)

The capacitors you mentioned are for electrical noise suppression, as explained in section 3.a of the user’s guide under “Logic Power”. Depending on your setup, you might not need them, but you should be aware that electrical noise might be an issue if you run into any problems.

By the way, because of variations among individual motors, it can be hard to get two motors rotating at the exact same speed; depending on how precisely you need their speeds to be matched, you might have to either calibrate the speeds manually or use a form of feedback such as encoders.

- Kevin

(Sorry for the delayed response)

Thanks Kevin for your reply. I just purchased the Pololu motor drivers (SN754410 Motor Driver IC) as I think it will be easier for me to implement what I want. BTW, do you know if any documentation comes with the motor drivers which says how they’re connected to the PIC and motors?

Thanks,
Ross

You can find the datasheet for the SN754410 under the Resources tab on its product page.

- Kevin

Thanks Kevin. I had seen the TI datasheet but couldn’t work out a wiring schematic for controlling 2 motors from 1 PIC. Would you know of any sample circuit schematics I could reference?

Essentially, each of the “A” inputs on the SN754410 directly controls the state of the corresponding “Y” output. The SN754410 was used in our dual serial motor controller, which you can find a schematic for on page 15 of its user’s guide. There are also various guides to using the SN754410 available on the web, like this one. I have not looked at it closely, but there is a schematic on the third page.

- Kevin

Thanks very much Kevin!