Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Simple Interter Circuit

Status
Not open for further replies.

pittuck

New Member
Hi all,

Very simple circuit that i would like you to have a look over.

I am trying to make a inverter with an enable for motor control. The transistor inverter switching times are fine, but i need to be able to put both outputs to the same state at the same time (i.e. a braking state).

with the current circuit i would have to put PWM at 50% to create an average voltage of 0V across the motor, but this is a stall rather than a break and uses too much current. any ideas?

Many thanks,

- Martyn
 

Attachments

  • interter.gif
    interter.gif
    1.9 KB · Views: 607
not got the circuit, but i have this:

**broken link removed**

Pretty simple setup, its just that i dont need too much capacity in the batteries for normal opperation. BUT putting the PWM at 50% will cause the motor to be in constant stall, and technically the current the motors use in stall is about the same as the rating of the batteries!!!
 
pittuck said:
not got the circuit, but i have this:

**broken link removed**

Pretty simple setup, its just that i dont need too much capacity in the batteries for normal opperation. BUT putting the PWM at 50% will cause the motor to be in constant stall, and technically the current the motors use in stall is about the same as the rating of the batteries!!!

By using an inverter to feed the two inputs of the H-bridge, you have removed the capability of using it as a brake - in order to do so you will need seperate feeds to the two halves.
 
Ok, this should work.

I believe its a NAND gate on the second output?

By putting the input high and the enable low the outputs will both be the same, but with the enable high both signals will be different no matter what the input.

Sorry about gif size, resizing lost lines, not too sure with Easy PC AMT.
 

Attachments

  • inverterwithenable.gif
    inverterwithenable.gif
    6.8 KB · Views: 646
You cannot have three states using just one control line.

Three possible solutions:

1. If you do not need speed control of the motor, connect ENABLE to +5V permanently. Let the PIC controls input2. Use software to invert the state of input1 and outputs that on input2. If you want braking, set both imputs to same state. You can leave motor in braking mode as there is no additional current drain.

2. Leaves out inverter and use an extra pin on PIC for rotation direction control. But I guess you would not have to use an inverter if you got spare pin on PIC in the first place.

3. Use some form of external circuit logic to decode the three state of the input1 namely HIGH, LOW and PULSE and translate this into the "H,L", "L,H" and "H,H or L,L" for the L298.
 
Lol, mesa over complicating things again ;)

Code:
NAND Gate logic table

A   B  Out
0   0   0
0   1   0
1   0   1
1   1   0

Is exactly what i want, i will just use a little logic IC from TI or something ;)

A is enable and B is the PWM/IO input. I am controlling 2 motors using the pwm outputs from a pic, of which there are only 2. I can easily (a few lines of code) dissable the pwm and make the output any logic i need, which in this case is A low and B low to make a 'brake' state.[/code]
 
pittuck said:
A is enable and B is the PWM/IO input. I am controlling 2 motors using the pwm outputs from a pic, of which there are only 2. I can easily (a few lines of code) dissable the pwm and make the output any logic i need, which in this case is A low and B low to make a 'brake' state.

Are you OK for spare I/O pins on the PIC?.

A simple way to do it is to feed the ENABLE pin from the PWM output, then use two I/O pins to feed the two H-Bridge inputs. So the ENABLE input sets the speed, and the two h-bridge inputs set either forwards, backwards, or brake.

If you remember Pittuck?, this was proposed years back on the Robotbuilder site!.
 
if you remember i made this article:

http://www.robotbuilder.co.uk/Resources/Articles/152.aspx

It explains how bad that system is for controlling the motors, instead of having the motors breaking you are actually running them in freewheel mode.

Also speed is not easy to control, you can put the voltage to be at 90% of full but the speed will be something like 95% of that of full speed due to the motor coasting in freewheel mode.

I would prefer to use the nand gate even though i have pleanty of i/o pins, its just more controllable in the long run.
 
pittuck said:
if you remember i made this article:

http://www.robotbuilder.co.uk/Resources/Articles/152.aspx

It explains how bad that system is for controlling the motors, instead of having the motors breaking you are actually running them in freewheel mode.

I don't really see the problem?, that's how PWM normally works, the method you're proposing where you continually reverse the power to the motor is causing much greater strains on all components (both electrical and mechanical), plus it greatly increases power consumption.

I would prefer to use the nand gate even though i have pleanty of i/o pins, its just more controllable in the long run.

In that case you will have to add a fair amount of extra hardware, and either use the enable line to operate a braking system (when it's disabled), or add an extra specific brake line from the PIC. I would also suggest that you design hardware logic into the design, the more complicated it gets the more likely you are to inadvertently apply the brake and full power at the same time.
 
I have used this method before and it does not impact much on the current consumption of the motors. It allows much more control, expecially at low speeds.

As for external hardware, i will need 3 PIC lines for each motor, 1 with the PWM, one for the bridge enable and one to allow for 'idle' mode when both inputs to the driver are the same potential.

two of these: https://focus.ti.com/docs/prod/folders/print/sn74ahc1g00.html in a SOT-23 package and i am fine.

Much, much, much smaller than the 7404 i was using before.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top