Delayed comparator output

Thread Starter

mbek

Joined Oct 30, 2011
16
Hello,

I'm working on a comparator circuit which should give out High whenever the input voltage is lower than Vref, and vice versa. It works fine with input being the inverting (-) input of the comparator, but I'd also like to add a delay to it. I did a simple RC as shown in picture, what do you think?
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
That can work, but your output will more resemble a triangle wave than a square wave - depending on how often the input is changing states.

You may need to use a 2nd comparator to square up the output.
 

MrChips

Joined Oct 2, 2009
30,621
If you can give more details about your application we may be able to provide some solutions. Usually a pair of monostables will do the trick.
 

Thread Starter

mbek

Joined Oct 30, 2011
16
That can work, but your output will more resemble a triangle wave than a square wave - depending on how often the input is changing states.

You may need to use a 2nd comparator to square up the output.
Yeah, I thought so, I just tried to make it work with a single comparator. I thought adjusting the RC so V[L-high] (of an AND gate input) would be reached in my desired time, thus setting the AND gate output to Low after predefined delay.

If you can give more details about your application we may be able to provide some solutions. Usually a pair of monostables will do the trick.
I'm using it for current sensing/limiting - in particular, driving AND gate for Enable pin of mosfet bridges. I've discussed it in another thread, SgtWookie suggested using an out-of-the-box solution L6506, but since it is not available anywhere around here (Croatia), I need to order it from abroad. In the meantime, I decided to make my own current limiter.
 

SgtWookie

Joined Jul 17, 2007
22,230
You should put Crotia in your location. Click on the "User CP" link on top, then "Edit your details". Put Crotia in the location box, and then click "Save changes" on the bottom of the page.

You're going to need to switch off the current as it passes the threshold, and then keep the current off for a fixed amount of time before turning it back on.

That's basically the way the L297 current control scheme works. You MUST use a fixed delay; otherwise due to the internal diodes, the bridge and your motors will be subjected to very significant overcurrent. Rsense only gives an output while the low-side transistor is conducting.

You really need to give some more details on how you plan to use the L298, preferably with a schematic.

If you are considering feeding the L298 both positive and negative supplies, and grounding the other side of the motor so that you can operate the motor in forward and reverse, you will have problems trying to sense the current when just the high side of the bridge is conducting.
 

Thread Starter

mbek

Joined Oct 30, 2011
16
So why do you need a delay? Sorry, I have not read the other thread.
Bridge can withstand higher peak currents for a certain amount of time, and when the motor is stationary it requires more current to get moving. This way I allow it to work a bit before turning it off.

You should put Crotia in your location. Click on the "User CP" link on top, then "Edit your details". Put Crotia in the location box, and then click "Save changes" on the bottom of the page.
Done :)

You're going to need to switch off the current as it passes the threshold, and then keep the current off for a fixed amount of time before turning it back on.

That's basically the way the L297 current control scheme works. You MUST use a fixed delay; otherwise due to the internal diodes, the bridge and your motors will be subjected to very significant overcurrent. Rsense only gives an output while the low-side transistor is conducting.
Yes, I know it can't be left running for longer than fixed time peak current is allowed, that's why I'm doing this.

You really need to give some more details on how you plan to use the L298, preferably with a schematic.
Attached. I don't have a proper L298 symbol so I created one.
As you can see, I'm using half of each bridge to drive coils - At each time one motor contact is at Vs, one grounded and one "hanging". This is the proper way to run these bldc motors, and it works fine.
Control logic is actually a blackfin processor, but for argument's sake we can consider it a black box that does comutation (and does it properly, as I said - motor works fine).
The problem arises when motor is in stall or simply overburdened, when overcurrent occurs. I wanted to make a simple circuit using comparator(s) that would use sensing resistors (not drawn on schematic), have a small delay (less than the one in datasheet) to allow peak currents, and be connected with Enable from control logic to Enable on L298 (ie. Sense A via comparator connected to AND gate with Enable1 from circuit logic, and the whole AND gate outputting to Enable A on L298).

If you are considering feeding the L298 both positive and negative supplies, and grounding the other side of the motor so that you can operate the motor in forward and reverse, you will have problems trying to sense the current when just the high side of the bridge is conducting.
As said above, I'm driving a brushless motor with it, so no negative supplies are given, just positive ones.
 

Attachments

MrChips

Joined Oct 2, 2009
30,621
Bridge can withstand higher peak currents for a certain amount of time, and when the motor is stationary it requires more current to get moving. This way I allow it to work a bit before turning it off.
So we are talking about a delay much longer than a few microseconds?
 

Thread Starter

mbek

Joined Oct 30, 2011
16
So we are talking about a delay much longer than a few microseconds?
Well, non-repetitve high current is allowed for 100us. Repetitive current is allowed in 80% off, 20%on cycles, with "on" cycle lasting 10ms.

I think I'll make a few versions of the driving circuit. One version allowing high current for just less than 100us, one version allowing the repetitive current in on-off states (I'll need multivibrators for this, right?).

So, let's focus on the on-off repetitive circuit. I need to meet following requirements:
When 2.5A current is detected, wait for 10ms, and then turn the output off for 40ms. After that, turn the circuit back on.

I'll need to use 2 comparators for this, right? One with a RC circuit that will trigger the other one after 10ms, and then the other one will turn off the output for 40ms.

What is the best course of action?
 

SgtWookie

Joined Jul 17, 2007
22,230
The L298 won't take more than 2A current per half-bridge; you'll fry it even if you're underwater.

I don't know what you're using to power the circuit with, but you're going to lose 4v or more across the bridge; the more current you try to push through it, the more you lose.

Where do you buy parts in Croatia? Do you order from websites online? Can you give us a link?
 

Thread Starter

mbek

Joined Oct 30, 2011
16
The L298 won't take more than 2A current per half-bridge; you'll fry it even if you're underwater.

I don't know what you're using to power the circuit with, but you're going to lose 4v or more across the bridge; the more current you try to push through it, the more you lose.
Yes, I'm aware of that, but I wasn't able to find a proper half-bridge with mosfets, such as L6234 or L6235. Only thing that even slightly resembles a bridge is the L298.

Where do you buy parts in Croatia? Do you order from websites online? Can you give us a link?
There is http://www.kronos.hr and http://www.chipoteka.hr/ Both of them have no english interface, but search boxes are pretty easy to find at the top. Problem with these sites is that they have no nice categories such as www.farnell.com, nor is their online stock the real stock in stores. It is possible to order from farnell via a local company, but they are ruthlessly expensive - they charge shipping pretty steeply, as well as "handling fee" of 15$, which means that L6235 which costs ca. 7$ would cost me almost 30$, and that's really too much. That's why I wanted to make this work with L298 (which already cost me 10$ per piece). Seems I'll just have to go over the local farnell supplier.
 

thatoneguy

Joined Feb 19, 2009
6,359
What controller are you using for the L298s?

Can you make the delay in code to prevent shoot-through, or other delay problems? If it is a 555 or other discrete driver circuit, sorry. I didn't see the original thread for this, it appears you are making a BLDC controller.
 

SgtWookie

Joined Jul 17, 2007
22,230
TOG,
Yes, he's trying to build his own controller; starting off crippled due to the L298's. :(

They'd be so much better off to simply use a half-dozen N-ch MOSFETs and build their own bridge. Otherwise, the power loss in the L298s will be huge.
 

Thread Starter

mbek

Joined Oct 30, 2011
16
What controller are you using for the L298s?

Can you make the delay in code to prevent shoot-through, or other delay problems? If it is a 555 or other discrete driver circuit, sorry. I didn't see the original thread for this, it appears you are making a BLDC controller.
A Blackfin processor is the top-level driver. I could use it for current sensing as well, but I wanted to implement this in hardware, seems more reliable. And yes, it is a BLDC controller.

TOG,
Yes, he's trying to build his own controller; starting off crippled due to the L298's. :(

They'd be so much better off to simply use a half-dozen N-ch MOSFETs and build their own bridge. Otherwise, the power loss in the L298s will be huge.
I think that will be the ultimate course of action. I'll finish this L298 version as a proof-of-concept and pure act of stubborness, but the final and implemented driver will be a NMOS solution. Even more so, the final device will be battery powered, and everh mAh is precious. Only problem I see in that is the charge pump for high-side NMOS, I have to do more reading on that and will probably end up creating a thread here :)
 

thatoneguy

Joined Feb 19, 2009
6,359
Well, if nothing else, you've probably learned a lot working with Wookie.

If you'd have come here first with the question, before ordering the L298's, this could have been quick and (mostly) painless.

If you make the full parts list, and then order from Farnell, you would only be hit with that $15 fee once, correct? Shipping would be about the same unless you were ordering hundreds, as parts are generally very light, so 10x as many parts from Farnell isn't that much more in weight (unless you have an import duty on each item). What I'm getting at is to plan out the rest of the things you may need for a proper H-Bridge driver, and order enough parts for several in one go, maybe even plan the next project and roll it in as well so the fees do not drown out the actual part costs. Economies of scale and all that. Just an idea.

When you test the L298s, be sure to have your hand on the power switch to turn it off after about 3 seconds, then let them sit for about 30 seconds for the die temp to get to the outside of the package (heatsink tab), and see how hot it gets. What kills them is the driver IC die inside can't transfer the heat it generates with high currents to the heat sink tab fast enough, and will go *poof* when the case didn't even feel hot. Thought I'd add that if it wasn't mentioned in another thread so you don't ruin your investment. I'd suggest to save them for a future, smaller project, where they would work decent once you prove the concept without burning them up.
 

Thread Starter

mbek

Joined Oct 30, 2011
16
Well, if nothing else, you've probably learned a lot working with Wookie.

If you'd have come here first with the question, before ordering the L298's, this could have been quick and (mostly) painless.
Very true. If I'd known about this forum, and the amount of knowledge and well-met advice available on it before, I'd have probably finished the whole project already. I'm not an electronics engineer, but a control engineer, and my knowledge in power electronics is limited to say the least, thus the hasty L298 purchase. I simply didn't take into consideration things I didn't know poise a problem until I ran into them. No regrets though, I learnt hell of a lot :)

If you make the full parts list, and then order from Farnell, you would only be hit with that $15 fee once, correct? Shipping would be about the same unless you were ordering hundreds, as parts are generally very light, so 10x as many parts from Farnell isn't that much more in weight (unless you have an import duty on each item). What I'm getting at is to plan out the rest of the things you may need for a proper H-Bridge driver, and order enough parts for several in one go, maybe even plan the next project and roll it in as well so the fees do not drown out the actual part costs. Economies of scale and all that. Just an idea.
That's the general idea...

When you test the L298s, be sure to have your hand on the power switch to turn it off after about 3 seconds, then let them sit for about 30 seconds for the die temp to get to the outside of the package (heatsink tab), and see how hot it gets. What kills them is the driver IC die inside can't transfer the heat it generates with high currents to the heat sink tab fast enough, and will go *poof* when the case didn't even feel hot. Thought I'd add that if it wasn't mentioned in another thread so you don't ruin your investment. I'd suggest to save them for a future, smaller project, where they would work decent once you prove the concept without burning them up.
Hmpf. Wasn't aware of that, I thought cooling via tab would be enough. Oh well...
 

SgtWookie

Joined Jul 17, 2007
22,230
Have a look at the VNH3SP30-E:
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00134336.pdf
30A, up to 42V, H-bridge.

Apparently, Future Electronics will ship to Croatia, and they have them in stock:
http://www.futureelectronics.com/en/Technologies/Product.aspx?ProductID=VNH3SP30ESTMICRO9822925

You need to pay particular attention to the heat slugs on the layout diagram in the datasheet, page 6. You'll likely need to use a series of vias to conduct the heat from the top to the bottom of the board. You will need to have (a) board(s) custom made for these IC's; it would be just too difficult to make them at home.
 
Top