Let's Make Robots!

Simple motor control for Mr. Basic

I have seen a few people asking questions about controlling Mr. basics motors. One problem is that they draw more current than an L293D can handle. A L298N will do the job but you will want at leat 6V. Below is a schematic of the simplest way I know of to control your motors. Using a 5V relay you can run from 3.6V to 6V. I suggest a 9V relay if you want to use 7.2V.

The relay is a DPDT (double pole double throw) with the motor connected to the common terminals. The forward/reverse signal turns the relay on or off via the BC548 transistor. The diode across the relay coil is wired reverse polarity and only conducts when the coil de-energises to protect the transistor.

You will see in the diagram that with the relay off and the motor connected to the NC (normally closed) contacts that one side is connected to the positive of the battery and the other to ground via another transistor (BD681). When the relay turns on then connections to the motor are reversed and so is the direction of the motor.

Simple_motor_controller_Schematic_0.jpg

The BD681 is a darlington transistor (basically two transistors in one package) that allows a small signal from the processor to drive up to 4A. A heatsink should be used on this transistor! This is your on/off switch. A high to the base of the transistor turns your motor on. A low turns it off. If you are working at 3.6V or trying to drive more than 2A then the 1K resistor could be reduced to as little as 470 ohms.

Because the transistor is working as a highspeed switch you can drive it with your PWM outputs if you want speed control. The diode across the transistor is to protect it from any reverse polarity spikes that can occur when driving an inductive load.

It is documented in the manuals that on powerup or reset that the output pins may temporarily go tri-state (open circuit). To prevent your motor turning on unexpectedly when this happens the 27K resistor pulls the base to ground.

As mentioned below in a reply to Mintvelt. A FET could be used if you are using higher voltages or if you can find a FET designed for low voltage applications.

DAGU is now going to produce a dual version of this for opperating two motors.  


This is the new board that has been designed with this circuit.
New_Mr__Basic_board.jpg

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
That is fair enough, I was busy at the time and thought the schematic was self explanatory. I will edit the post for you.

Of course the simplewst method is to use two '293 hbridges. either side by side in parallel or stack them.

http://www.acroname.com/robotics/info/ideas/stacking/stacking.html#c 

 

Relays are great for turning a motor on and off, but not appropriate for pWM use. There are a number of issues, including the speed of the mechanicals, and wearing out of the the contacts.

Can you get by it using a relay with PWM, of course, but be aware of the short life and limitations. 

For a full discussion (and to save me from retyping) see http://www.electro-tech-online.com/electronic-projects/21834-pwm-controller-4.html 

 

Oddbot is not suggesting to use the PWM signal to drive the solenoid in the relays. He suggests to drive the relays with a straight on/off signal (amplified to satisfy the coil's hunger for current).

The PWM signal is first amplified to satisfy the motor's need and THEN transported through the DPDT switch to the motor. The switch happens to be operated by a solenoid. The switching only functions to reverse polarity and thus direction of the motor.

Really good job and great timing!

I will be attempting to build something like that next week, so im sure it will come handy. 

so Odd, you cooking up a cure for Cancer yet?
But I was drunk at the time and now I appear to have misplaced it :(
this is exactly what i need! What is the difference between those two transistors? (and why the 27K resistor?)

Hi

How did you calculate the value of the resistors at the base of the switching transistors, and at the transistors handle pwm?

G'day Mintvelt.

The BC548 is just a small switching transistor. It can handle up to 100mA and is ideal for opperating a relay coil. You can use almost any NPN transistor for this. 

The BD681 is a darlington transistor that can handle up to 4A with a heatsink. Darlington transistors are really two transistors in one package and have a higher HFE (gain) than normal transistors. This is important as it allows a few mA of current at the base to drive large currents through the collector-Emitter junction. This circuit should drive at least 2.47A of current when the picaxe is running on 4.5V.The1K resistor could be reduced to 470 ohms if more current is required or if you are running on 3.6V.

The 27K resistor ties the transistor base to ground to prevent the motor running accidently if the picaxe output pin goes open circuit Which can happen briefly during a reset or on powerup or if the output is changed to an input.