DC to AC converter - Page 1
Forum section: electronics / projects

author: Simon
author_rank: Unknown
timestamp: September 02, 2010, 04:17:33 pm
content: I've been tasked with designing a DC to AC converter, basically a driver circuit followed by a H bridge,Naturally my first thoughts fell to a PIC but i will have to "manually" program the 50 Hz square wave in as on a 4MHz clock the lowest PWM output is 245 Hz unless of course there is a pic with less than 4MHz internal clock ? 12F683 maybe ?before I go design happy is there something I'm missing ? perhaps a chip dedicated to this without the hassle of programing a PIC ? can you get adapters to program SOIC parts ?Their talking about having the thing made for us so all i have to do is design (and presumably prototype). I did suggest making it ourselves but that scares them (it's nice to be able to blame your supplier !)

author: Time
author_rank: Frequent Contributor
timestamp: September 02, 2010, 04:27:02 pm
content: A DC to AC converter is called an inverter. They are pretty well documented. Maybe you should try to find out about inverter topologies.

author: Zero999
author_rank: Super Contributor
timestamp: September 02, 2010, 04:34:37 pm
content: I have a few questions:Input/output voltage/current?Does the frequency need to be accurately controlled?Is isolation between the DC and AC side required?If it's just a standard inverter i.e. 12VDC to 230VAC then it's probably more economical to just buy an off the shelf unit.I assume square wave is fine but you need to beware that it can destroy some appliances or just make them behave erratically.If it's very low power and the frequency isn't important, you can configure an h-bridge to form an astable multivibrator which is very simple, no MCU required, just four transistors, two capacitors and some resistors.

author: Simon
author_rank: Unknown
timestamp: September 02, 2010, 04:46:45 pm
content: this is just 24V DC to 24V AC basically a H bridge plus driving circuitry and MCU power

author: Zero999
author_rank: Super Contributor
timestamp: September 02, 2010, 05:14:36 pm
content: Care to mention the current and the application?It's possible that DC might work fine.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: September 02, 2010, 05:24:40 pm
content: Quote from: Simon on September 02, 2010, 04:17:33 pmJust use a timer interrupt.

author: TechGuy
author_rank: Regular Contributor
timestamp: September 02, 2010, 05:45:14 pm
content: Quote from: Simon on September 02, 2010, 04:46:45 pmSquare Wave OR Modified squarewave (usually referred as Modified Since) or Sinesoidal output?Square wave and Modified squarewave are fairly easily. Getting a sine wave output gets complex.For Low frequency output you can use the built in timer and an interrupt routine to output a 50 hz\60hz squarewave form. Look for real time clock source code for a starting point. Usually most RTC code uses the timer and a interrupt routine.FOR MCU power look at simply switchers like the LM2575 Buck regulator. You need to add a PI filter (ie CLC filter) for the MCU to operate reliably. But it will work better than a Linear regulation since 24V to 5V\3.3V is really too large for a linear regulator.

author: Zero999
author_rank: Super Contributor
timestamp: September 02, 2010, 05:59:18 pm
content: As I said before, if it's low power, squarewave and the frequency stability isn't important, there's no need for a microcontroller or any semiconductors, other than the h-bridge transistors.Here's an astable-multivibrator which will deliver a squarewave to a load up to 800mA. I've built this circuit before and it's rugged, very reliable, will tolerate more abuse than an MCU circuit and is much cheaper too.It obviously has its shortcomings but if you just want an approximately 50Hz squarewave delivered to a load it's the simplest way of doing it.The only thing you need to bear in mind, is that if the load is inductive, you'll need to add some protection diodes which is pretty easily done.You can of course use higher power transistors for higher current loads but you'll need to reduce the resistor, and increase the capacitor values.R1 to R4 need to be rated to 0.5W minimum, more if the values are lower.

author: Simon
author_rank: Unknown
timestamp: September 02, 2010, 09:51:00 pm
content: I think it is well under 1 amp that is required and it is a square output, the original controller uses 4 N channel mosfets in a bridge formation. the circuit drives a reciprocal pump, presumably the original one uses a switched capacitor boost circuit to produce the drive for the N channel mosfets on the positive side.The frequency does not have to be spot on but cannot vary that much, I suspect problems with similar pumps in the past were due to them being driven at 130% the speced frequency (67 Hz instead of 50).Strangely the original controller does not have flyback diodes but then if it does it will short out the supply as it would with the circuit you posted. heat dissipation best be as small as possible as I guess they will go and put it in a confined space.I'll probably use IRF540 and IRF9540 mosfet pairs as i already have them and i'm not spending money on more parts for a work project I'll hardly get recognition for

author: NiHaoMike
author_rank: Super Contributor
timestamp: September 03, 2010, 01:20:49 am
content: It's pretty easy to make a low frequency PWM DDS using a PIC. Here's a description:Code:; oscillator frequency (MHz) * 15 = output frequency (Hz); 4MHz oscillator for 60Hz output; 4 clock cycles = 1 instruction; RA0 - neutral drive (square wave); RA1 - hot drive (PWM, see below); RB0-RB7 - phase synchronization;; Phase Angle 0 30 60 90 120 150 180 210 240 270 300 330; Instruction 0 1389 2778 4167 5556 6944 8333 9722 11111 12500 13889 15278; RB0 0 1 0 0 1 0 1 0 1 1 0 0; RB1 0 0 1 1 0 1 0 0 0 0 0 1; RB2 1 0 1 1 0 1 0 0 0 1 0 0; RB3 0 1 0 0 0 1 1 0 1 0 0 1; RB4 1 0 0 0 0 0 1 0 1 0 1 0; RB5 0 1 1 0 1 1 1 1 0 1 1 0; RB6 1 1 1 1 1 1 1 0 1 1 1 0; RB7 pulses high for 2 instructions;; positive periods: 942-1441, 1922-2848, 2982-5351, 5485-6412, 6892-7391; negative periods: 9275-9774, 10255-11181, 11315-13684, 13818-14745, 15225-15724I haven't finished the actual code and it would probably be a while before I get to it. The basic idea is for it to drive a H bridge powered from an isolated DC/DC converter. The neutral side would be driven with a square wave (which switches the hot side of the bridge between +/0 and 0/-) while the hot side is driven by timed pulses hard-coded into firmware. (The RB port outputs logic signals that could possibly be used to synchronize multiple chips for 3 phase output, but it's really an "Easter Egg".)That would actually produce a 10PPC (Pulse Per Cycle) modified sine wave, but it's easy to filter into a true sine wave. The losses in the power electronics are kept low by keeping the operating frequency low.

author: Zero999
author_rank: Super Contributor
timestamp: September 03, 2010, 10:26:42 am
content: I didn't think he needed modified sinewave or PWM, just basic squarewave which it sounds like the pumps are designed to operate off anyway.Quote from: Simon on September 02, 2010, 09:51:00 pmHow would adding fly-back diodes short out the supply?The whole point is they don't conduct unless there's back-EMF.It's possible to build the circuit with MOSFETs. The extra resistors (R3 to R10) are required to protect the gates from the full supply voltage, the typical maximum gate rating is 16V to 20V but your power supply voltage is 24V. I haven't built the MOSFET version, it works in LTSpice but it's a good idea to breadboard it first. I've added a small inductor to help tp suppress the current spikes created when both the top and bottom MOSFETs turn on for a short length of time per cycle.It might also be possible to use N-channels for the high side, I'll have a look into it.

author: Simon
author_rank: Unknown
timestamp: September 03, 2010, 11:43:29 am
content: Quote from: Hero999 on September 03, 2010, 10:26:42 amyea I just got confused, replied quickly as I was rushing out the door. I was wondering though as the load is never disconnected from the supply maybe the flyback diodes are not necessary ? but then there will be a dead period so looks like I should put them in

author: Simon
author_rank: Unknown
timestamp: September 03, 2010, 11:46:19 am
content: you can use all N channel mosfets but you need a boost circuit to get a higher than supply voltage to drive the high side gates

author: Zero999
author_rank: Super Contributor
timestamp: September 03, 2010, 02:51:10 pm
content: Not if you use a bootstrapping capacitor, the trouble is I can't remember how to do it with discrete components.

author: Simon
author_rank: Unknown
timestamp: September 03, 2010, 03:08:18 pm
content: how do you do a bootstrapping capacitor ? this sounds like something that might work easily using a pic ?at the end of the day for 300 mA I can't see why they went to all that trouble, from what I understand their main concern is small size so the less parts the better. the IRF540N is 77 mR the IRF9540N is 117 mR so thats just under 0.2 ohms which at 300 mA is 0.18 watts dissipated. the original F540NS mosfets are 44 mR again possibly overkill but if your bulk buying on the cheap and already use them in a more powerful model I guess you don't really care

author: Zero999
author_rank: Super Contributor
timestamp: September 03, 2010, 03:54:41 pm
content: Quote from: Simon on September 03, 2010, 03:08:18 pmNo, you can't do bootstrapping with an MCU and drive low side MOSFETs simultaneously, you need a separate bootstrap circuit.The simplest way of doing bootstrapping I know of is to use a transistor but that's an additional component is not worth it - see attached.By the way for an explanation for the astable circuits I posted previously, look up astable multivibrator on Wikipedia. The bottom transistors form the astable which drives the top transistors.The bootstrap circuit attached should be easy enough to figure out for yourself but I'll post more plots of the waveforms if you like.

author: Simon
author_rank: Unknown
timestamp: September 03, 2010, 05:02:57 pm
content: presumably the higher than supply voltage appears over RL ?

author: Zero999
author_rank: Super Contributor
timestamp: September 03, 2010, 05:34:08 pm
content: Quote from: Simon on September 03, 2010, 05:02:57 pmNot quite, the voltage across RL is always lower than the supply voltage, albeit by a small voltage when M1 is on.Oh well, I'll explain it to you, if you want the waveforms, simulate the .asc file I posted previously.It's basically a capacitive voltage doubler (a charge pump). When Q1 is on, M1 is off because its gate is shorted to its source, allowing C1 to charge to near the supply voltage via D1 and RL. When Q1 is off, M1 will be on, C1's anode will be connected to M1's gate via R1 and the cathode to M1's source which is now near the supply voltage, so the gate voltage will now be near double +V.R2 limits the base current to Q1, C2 is an AC coupling capacitor and D2 allows C2 to discharge when the signal goes negative.

author: Simon
author_rank: Unknown
timestamp: September 03, 2010, 05:41:40 pm
content: so the double voltage is across the positive of the capacitor

author: Zero999
author_rank: Super Contributor
timestamp: September 03, 2010, 07:38:00 pm
content: Yes, but only when M1 is on, when it's off the voltage on C1 will be near the supply voltage.

author: Simon
author_rank: Unknown
timestamp: September 03, 2010, 08:34:14 pm
content: what about the diodes in the transistors, would they provide sufficient protection ?

author: Zero999
author_rank: Super Contributor
timestamp: September 03, 2010, 09:00:47 pm
content: The MOSFETs?Well it depends.I've seen plenty of circuits where additional diodes are included because the designer has reasoned that the internal parasitic diodes might not be fast enough but the circuits I've seen work at higher frequencies than 50Hz so I think you'll be fine without any additional diodes. The IRF9540N is also pretty rugged, it's rated at 100V and can withstand 14mJ of avalanche energy (back EMF from an inductor) without being destroyed so even if there's a short delay before the diodes kick in, I don't think it will be a big problem.

author: Unknown
author_rank: Unknown
timestamp: September 03, 2010, 09:54:03 pm
content: The parasitic diodes are pretty slow. I don't think switching speed is what matters, but the time it takes for the EMF to exceed the rated voltage of the MOSFET. Probably depends on the inductance and the amount of capacitance in the circuit. I'd spend the extra few cents and include the (reasonably fast) diode, but if they add a significant amount to the costs (mass manufacturing), it might be worth spending the extra time to figure out the actual EMF.If you want a reliable product, only rely on guaranteed specs, unless you're prepared to do your own qualification. Relying that some parameter that you measured a few years ago will remain unchanged when you source from a different manufacturer or they change process is a bad idea in my opinion.

author: NiHaoMike
author_rank: Super Contributor
timestamp: September 04, 2010, 01:23:08 am
content: http://www.edn.com/file/15729-52704di.pdfLook at the last 2 pages.

author: RayJones
author_rank: Frequent Contributor
timestamp: September 04, 2010, 01:35:19 am
content: Punch through is probably your biggest concern, ie when both top and bottom switches conduct simultaneously.Using inductors is a band aid effort when the proper solution is to design to not allow punch through in the first place.It's all very noble designing from the ground up, but why bother when there are mosfet driver chips out there designed to:a/ void punch throughb/ internally generate the boosted gate drive for the hgh side switch.Linear Technology's web pages are a good place to start, I've used the LT 1158 and LT 1160 half bridge drivers, there are of course full bridge drivers available.

author: Simon
author_rank: Unknown
timestamp: September 04, 2010, 06:05:50 am
content: it needs to be as small as possible so unless the driver chip can also generate 50Hz it's a nogo, I'm hoping to show him something (on a PCB) when he comes back from holiday so have to use what I have.With regards to punch through as I'm manually programing the timings I was going to leave a few mS of dead time, the original controller I beleive has quite a large dead time which i assume is something to do with the physical spec of the pump it drives. I was going to introduce a couple of uS of dead time so that it would also help with back EMF as the pump would soon be switched on round the other way so back EMF is out of the equation again, at 50Hz I should think the diodes in the mosfets can cope ?

author: Zero999
author_rank: Super Contributor
timestamp: September 04, 2010, 04:09:22 pm
content: Well using a microcontroller to do the switching, rather than a self-oscillating circuit will totally eliminate punch-through, although it's probably still a good idea to provide some hardware protection in case the software fails, causing both the high and low side MOSFETs to turn on simultaneously.The question is what's most important?If space is at a premium and cost is critical then the self-oscillating circuits I posted earlier are best. If you opt for an MCU, then you've got to have a voltage regulator and at least two other transistors to level shift or bootstrap to drive the high side. The self-oscillating circuits require no other semiconductors than the transistors which double as the oscillator.If the current is only 300mA you could remove the 100µH inductor and replace it with a 2R2 resistor which will limit punch through to <11A. Alternatively you can use BJTs which will have a much smaller punch-through current, especially if you reduce the value of the base resistors.Looking at the BJT circuit again, according to LTSpice if R1 to R4 are 1k5 and C2 and C2 are 10µF the frequency is 46.7Hz and the punch-through current will only be 6A and will linearly decay to 3A in just 65µs.If frequency stability and minimising punch-through are more important than space and cost, then the MCU based circuit offers a better solution.

author: Simon
author_rank: Unknown
timestamp: September 06, 2010, 07:55:14 am
content: well it's for a military thing and is already a replacement for another cockup we made in supplier choice, punch through must be non existent I'd say as they're talking potting this thing or at least putting it in a box (that does into another larger box) so the dissipation that punch through would cause is a bit no no

author: Zero999
author_rank: Super Contributor
timestamp: September 06, 2010, 01:39:16 pm
content: How do you know that?Surely it depends on what the dissipation due to punch-through is?I know that with the MOSFET circuit it would've been unacceptable, mainly because the oscillator takes 200ms which could kill the transistors if it isn't limited by a suitable inductor and resistor.I've done another quick simulation on the BJT circuit with 1k5 for the resistors and 10µF for the capacitors with a 48R load. The losses in the entire circuit are 2.57W: 0.38W is in the resistors, 2.2W in all the transistors: 1.04W due to punch through and 1.16W due to saturation and switching losses.The question you have to ask is whether the transistors can dissipate that amount of power whilst embedded in resin? Thermally conductive resins are available but will probably be more expensive.If you go for the MCU option, you could probably cut the losses by a factor of 100 or more but it'll take up more space and be more expensive but that will be ofset against the cheaper resin.

author: Simon
author_rank: Unknown
timestamp: September 06, 2010, 01:49:44 pm
content: well I'm trying to do it fool proof and simple and with bits I have already so that I can do it quickly without ordering parts. The guy i'm doing it for is clueless with electronics so I'm trying to steer around potential problems particularly those caused in the practical implementation. The "instructions" he showed me show a square waveform that has a lot of dead time and I don't know why and if it is needed, I may end up asking to speak to the pump manufacturer myself to find out exactly what waveform i am to produce, I don't suppose the oscillator method will allow programmable dead times, like i said I'm going the MCU way around it so that there are plenty of back doors open for later when he says: yea but..... and then if he insists in burying it in resin (I have to hope the manufacturer he chooses gets it right) it's not a problem, I've already raised the question of SMD parts and he has no idea of his makers abilities so the first prototype will be all through hole parts and then we'll see where he wants to take it.

author: Zero999
author_rank: Super Contributor
timestamp: September 06, 2010, 01:53:18 pm
content: It looks like the MCU idea seems best then, especially as like you say, it leaves plenty of other doors open. Yes I'd get onto the pump manufacturers if I were you, it's possible that it's designed to work from a sine wave and that the controller used a square wave in a bid to save time and money.

author: Simon
author_rank: Unknown
timestamp: September 06, 2010, 02:03:10 pm
content: The original demo board clearly used an MCU as there are jumper settings, All i'm concerned about is that the pump can withstand an almost 100% duty cycle, the leaflet I looked at was very simplistic and may have been exaggerating the dead time on the graph to m,ake a point, basically I have to get the question asked: what is the maximum duty cycle allowed, if the thing was originally used for a sine wave 24V is a standard voltage so no doubt the pump will take an RMS of 24V (100% duty of sqr waves) with a peak of 1.414 X 24V, I'm guessing the MCU and mosfets total rise and fall time will be a matter of a uS so it's like 9.999mS positive 0.001 dead 9.999 mS negative, 0.001 dead and so forth

author: NiHaoMike
author_rank: Super Contributor
timestamp: September 07, 2010, 01:19:31 am
content: It's possible to have jumpers with a generic oscillator chip. But microcontrollers are cheap nowadays...

author: Simon
author_rank: Unknown
timestamp: September 07, 2010, 06:42:25 am
content: well I'm at work now and glancing at the bit of paper i was given it say's Microprocessor board, so there you have it.

author: TechGuy
author_rank: Regular Contributor
timestamp: September 07, 2010, 11:36:44 pm
content: Quote from: Simon on September 02, 2010, 09:51:00 pmMostly likely the problem is driving an AC motor using a squarewave AC signal. AC motors require Sine wave AC to run properly. Other wise they over heat caused by core saturation, or they will blow your bridge Mosfet when the current demand soars due to core saturation. It should be powered using a sine wave. Since the current is very low, you might be able to drive using a BTL (Bridge tied load) circuit.Quote from: Simon on September 02, 2010, 09:51:00 pmThe best option is to use a pair of half-bridge Mosfet drivers. Mosfet drivers will protect your MCU from voltage spikes that are generated by the motor. Ideally you connect the the MCU to the half-bridge drivers using a 10k resistors and a small TVS diodes to ground so that the MCU does get fried, in the event that the voltage spike exceeds the half-bridge drivers voltage rating. Most half-bridge drivers can operate up to 600V, (some up to 1200V), I have seen instances where a 36V H-Bridge driving an induction load exceeded 600V, blowing the half-bridge driver and taking out the controller when it fried.Quote from: Simon on September 02, 2010, 09:51:00 pmWow! No EMP\EMF protection, no RAD protection, using commerical components! Hope this isn't for use in NATO!Shoot-through can be avoided using half-bridge drivers that have shoot-through protection (ie will not permit the high-side and low-side from being turned on at the same time). That said its still possible to have a shoot through issue if you don't discharge the MOSFET gate fast enough. Its possible that you turn off one transistor and start turning on the other transistor before it full turns off. Dead-time is added to protect this from happening. Gate resistors should also have a parallel diode so that the MOSFET turns off faster than it turns on all four mosfets should have a 10K resistor connected between source and gate to prevent the MOSFET from automagicially turning on when you don't expect it. If the gate is not held low, a MOSFET will slowly turn itself on, usually with disappointing results!QuoteYour not going to be able to drive a MOSFET directly from an MCU, especially if its a 3.3V MCU. You might be able to get away with a logic level MOSFET, but they are more prone to failure, especially when switching inductance loads. Your much better off using a pair of H-bridge drivers. If size is a problem, there are drivers in DFN packaging. You can also use dual sided component boards to reduce PCB size. You can also use the smaller DirectFET packaging now available. If size is very restricted then you have to implement a PWM Sine wave logic drive to power the motor:BTL requires a pair of inductors and caps, which take up lots of space. Plus Electrolytic caps aren't milspec unless you get an exemption.Here is an half-bridge MOSFET driver in a LLP-8 (4 mm) packagehttp://cache.national.com/ds/LM/LM5109A.pdfQuotePerhaps to hide the design, since its not milspec. FWIW: I would not touch this project. If its for the miltary and not Milspec and quoted as Milspec, you could end up doing some serious jailtime. If he gets in trouble, than passes the buck onto you blaming you for the poor design. I think this project is over your skillset in my opinion. Hope it works out though.

author: Simon
author_rank: Unknown
timestamp: September 08, 2010, 06:52:44 am
content: Thanks for your insight tecguy, it's only an air conditioning condensation pump, nothing life critical and you would be surprised to see what gets supplied in contracts that have the military as the end user (who is not necessarily the direct customer), our whole air con system had some interesting EMC issues due to a lack of back EMF diodes that i had to point out to them (they were clued up on diodes on relays but didn't think 300 W fan motors needed them). We do seem to have a habit of using commercial parts for military orientated units as far as i know there has never been any validation of anything like this, it's just a case of: does it work ? does it fit in with the provided specs ?, I took it upon myself to dismantle one of the old pumps, reverse engineer the driver board and point out all the fuckups (not that they listened seems stuff designed by a 10 yr old is good enough)The original driver board is supplying a square wave drive, the pump is not of the motor type but a solenoid driving a diaphragm. And yes there seems to be precious little protection on the original board but then this is just a 300 mA load and I'll be having a more thorough look at it later, i don't know what sort of back EMF I can expect although I'm sure it could be plenty. I think worse case i'm looking at a back EMF diode on each mosfet. perhaps a bidirectional TVS diode on the pump output would be beneficial ? I've put in a TVS on the supply but that's more for incomming protection from the vehicles supply that is non too smooth to start withThe idea of burying it is resin was for water protection something he picked up off the supplier of the older pump design (that is going tits up all over the place), I think a bit over the top but that's his call.

author: Simon
author_rank: Unknown
timestamp: September 08, 2010, 06:58:21 am
content: By the way I don't quite understand how the back EMF will get back to the gate ?

author: Zero999
author_rank: Super Contributor
timestamp: September 08, 2010, 07:12:14 am
content: Quote from: TechGuy on September 07, 2010, 11:36:44 pmSurely that shouldn't happen if correct back-EMF suppression is used?QuoteNot true, you can buy special millspec electrolytic capacitors - I know because I know because I've encountered them before on a timer which deployed a retarder attached to the back of a bomb and I know there was no exemption because the capacitors were mission critical, if they failed the retarder wouldn't operate because they stored a charge used to operate the actuator.The only problem I can see with your PWM solution is that the pump is designed for 24VAC operation and the circuit is run from 24VDC the peak output voltage will be lower than it would be from AC, giving an RMS voltage of just under 17VAC. In order to get 24VAC a boost converter or a transformer is required, the former is probably the best option because it'll be lightweight, a transformer will be too big and heavy and a non-standard winding will be required to boost 17VAC to 24VAC. Maybe the whole circuit could be powered from an off the shelf 24V to 36VDC converter? That will also isolate the AC from DC which will reduce the risk of a short circuit.

author: scrat
author_rank: Frequent Contributor
timestamp: September 08, 2010, 10:06:52 am
content: Hero pointed out a heavy concern. From 24 Vdc you can't get a 24 Vac rms sine wave directly (as a PWM sine). That' probably the reason why they ran the pump with a square-like wave: the first harmonic of a square wave is 4/pi * amplitude ( > sq. wave amplitude), so in this case you can get an rms value of about 4/pi*24 / sqrt(2) = 21.6 V, which perhaps was enough. I suspect that the "exaggerated" dead time was a way to get the correct amplitude for the first harmonic, or the desired effect (since this is a solenoid, even higher order harmonics could give their contribute).However, in the case a fixed-frequency sine wave was required, you could also use something different than a table to generate its values: could implement a digital "resonant" filter, and thus achieve a sine wave with only one coefficient stored and a little bit of calculation for each sample (3 sums + 2 mult).I think that using an H-bridge with p-channel MOSFETs at the high-side will simplify your circuit, avoiding the use of a bootstrap, or you can easily find integrated bridges or half-bridges with p-n couples, and even integrated driver+bridge. Some drivers, AFAIK, are secure against punch-through because they start the rise of a gate only when the opposite (high/low) has gone below a certain threshold.

author: Simon
author_rank: Unknown
timestamp: September 08, 2010, 11:38:07 am
content: As far as i know the pump is driven from a 24V square wave, I'll have to enquire as to the exact drive requirements but as far as i know thats it, no higher voltage required no sinusoid simulation required.

author: Zero999
author_rank: Super Contributor
timestamp: September 08, 2010, 12:47:49 pm
content: To be honest, I think that a pure sine wave would be overkill and don't see any reason why it shouldn't work off a square wave.It's probably just a solenoid with a permanent magnet core so will work from either a square or a sinusoidal waveform, a square wave may even be better.I agree that P-channel MOSFETs should be used for the high side and that punch-through can be eliminated using software, although there should be some safety feature in the hardware which stops it from blowing up if the software or PIC fails and decides to turn both the high and low transistors on but this could be as simple as a fast blow 1A fuse which should trip before the MOSFETs blow up. Another consideration is what happens if the PIC freezes and keeps the coil connected in one direction causing 24VDC to flow through it continuously: can it withstand such abuse? If not will the current be high enough to blow the fuse in time?If the answer to both of the above questions is no, the pump won't withstand 24VDC continuously and the current won't be high enough to blow the fuse in time, you have a problem. If this is true then you need another solution. Perhaps you could use a logic gate IC to make a couple of monostable so it's not possible for either side of the bridge to be turned on for longer than a certain length of time? But then you might consider using logic gates for the whole circuit.

author: Simon
author_rank: Unknown
timestamp: September 08, 2010, 04:15:26 pm
content: I suppose it's possible to do a two comparator astable circuit ? with a delay for turn on and each triggering the other so it's like a dog chasing it's own tail ? would also eliminate the need for level shifting mosfetsThe previous pump and drive circuit could have suffered the same fate you describe for this one, I suppose any software is a liablility

author: Zero999
author_rank: Super Contributor
timestamp: September 08, 2010, 06:23:00 pm
content: I'm not sure if that would work. I can think of a ring oscillator but that will need some gates on the output to get the desired waveform.

author: TechGuy
author_rank: Regular Contributor
timestamp: September 08, 2010, 07:49:39 pm
content: Quote from: Simon on September 08, 2010, 06:58:21 amIt will come from the Half-bridge common connection that is connected to the load (V+ - Hi Mosfet - Bridge Common - Low Mosfet - Gnd). The Solenoid will create a spike. The Bridge Common is connected to the MOSFET driver so that it can turn on the high side mosfet. Remember that a voltage beween the Source and the Gate pins (Vgs) is requrired to turn on or off the high side mosfet. There needs to be a voltage difference ~10 Volts between the Gate and Source. In a bootstrap mosfet driver, the driver uses the switching output to to charge the boostrap cap for highside switching.You can squelch the spikes with a pair of snubbers (RC filter), one on each side of the half bridge. to cull the spike. How big will depend on how large the spikes are. You have to run some tests to see how big your snubber will be. As a safety measure use a low value resistor (3 to 4 ohms) between the gate driver and the half-bridge common connection, On the driver side of the resistor, connect a SMB (600W) TVS avalanche diode. The Resistor will limit the current inrush to prevent the TVS diode getting blown. The TVS will insure the mosfet driver doesn't get blown if the Snubber fails to squelch the solenoid spike. You can also try using a PTC fuse in substitute for the resistor, A PTC fuse will have a low resistance, unless the current level is excessive, which causes the PTC to heat up and causing the PTC resistance to soar.I would also recommend including some dead time when you drive the solenoid This will prevent flux walking that could result in unexpected core saturation, blowing out one of the Mosfets caused by a current spike.QuoteMost likely excempted a very long time ago, or a grandfathered design prior to new cap designs. Most of the miltary designs require non-electrolytic caps, film, or solid electrolyte. It might also be exempt because it for a one-time-use device (a bomb), and it not used in a plane or vehicle that is carrying people. The problem with Electrolytic caps is that excessive temperature swings cause rapid loss of the electrolytic fluid.QuoteThis will do what you need. A Self-Oscillating Full Bridge driver:http://www.irf.com/product-info/datasheets/data/irs2453d.pdfhttp://www.nxp.com/documents/data_sheet/UBA2032.pdfhttp://www.irf.com/product-info/datasheets/data/ir2086s.pdfI would recommend including overcurrent detection and UV/OV lockout if you want to make sure its rock solid

author: scrat
author_rank: Frequent Contributor
timestamp: September 08, 2010, 08:05:49 pm
content: TechGuy preceded me while I was thinking and writing. Surely he has given better explanation, but since I've already wrote this post, here's itQuote from: Simon on September 08, 2010, 06:58:21 amI'm not an expert, but...One way can be through capacitance. Since gate is "connected" by means of parasitic capacitors to source (and drain), voltage changes on those terminals will reflect instantly on the gate, since (like a teacher of mine always said at school) "capacitor doesn't have voltage bounces". Just think of the effect of a commutation from OFF to ON of the high-side source for an n-channel MOSFET: even if there isn't any B-EMF, gate passes from nearly zero to nearly power bus voltage (at least some volts over this, and that's why bootstrap is needed). If there is B-EMF and a proper diode does not activate, at commutation the load inductance can make the MOSFET's source rise much above the power rail (and gate to follow it).Also, for high current transients (like those on the transistors and on their gates) large voltages are produced, and typically there is resonance on the gate voltage...Is it right or are these only bad guesses? Someone more experienced may confirm or deny what I tried to explain

author: Mechatrommer
author_rank: Super Contributor
timestamp: September 08, 2010, 08:11:52 pm
content: i'm looking forward to see a design (preferably simple) for a pure sine wave inverter. even more interesting is the possibility to generate a pure sine from mcu pwm as TechGuy has presented. Pure Sine Wave Inverter or UPS cost thousands in our currency.

author: Simon
author_rank: Unknown
timestamp: September 08, 2010, 08:57:02 pm
content: that is relatively simple for someone good on software, just generate a PWM model of a sine wave, this will require preferably something like 20 times the frequency of the signal you are replicating, not sure how you do it in software but bet it can be done.

author: scrat
author_rank: Frequent Contributor
timestamp: September 08, 2010, 09:02:53 pm
content: Unfortunately, I can only speak for the MCU side of the thing...Well, at each switching period (interrupt) you generate a numerical value for the sine [0, sin(2*pi*fgrid*Tsw* 1), sin(2*pi*fgrid*Tsw* 2), ... , sin(2*pi*fgrid*Tsw* n) ] properly scaled according to your PWM register length. Here fgrid is the frequency of your grid AC voltage (50/60 Hz) and Tsw is the desired switching period.To make things better, at each switching period you normalize the value (without offset) taking into account the measured value of the bus voltage (preferably low-pass filtered). This isn't needed if you're sure that the bus voltage is well regulated to a known voltage.If you want to use 3-level PWM, you will need generate a half period of the sine and then reverse polarity of the switching (making only one switch to commutate, alternatively on the right or left side of the bridge). With Enhanced PWM in PIC18F, for example, this only costs changing a bit in a register (forward/reverse).Generating those sine values is usually done by means of a look-up table containing pre-calculated values for the sine. The way I posted above (a resonant digital filter) also works (implemented on an ATmega48), but could be more useful if different frequency values are required, or the MCU has very little EEPROM.

author: Zero999
author_rank: Super Contributor
timestamp: September 08, 2010, 09:40:01 pm
content: Quote from: TechGuy on September 08, 2010, 07:49:39 pmSorry, what I meant to say is that if the correct clamping diodes are used (they always should be) how could that happen?QuoteI think size was the issue, there were two 40V 470µF capacitors and film/ceramic would've been too large.Can you point me to a defence standard that states electrolytic capacitors are unsuitable for military applications?I don't believe this to be the case after working for a defence contractor for nearly 10 years and used electrolytic capacitors in numerous designs which have been approved by other engineers with over 40 years of experience in field.Maybe some old electrolytic couldn't hack it and a crappy commercial grade Chinese capacitor would obviously fail fast but there are capacitors with a temperature range of -55°C to +125°C and rated to 2000h at the top end of the temperature range available in Farnel. I can't see why such a capacitor would be unsuitable.http://uk.farnell.com/vishay-bc-components/2222-118-18102/capacitor-electrolytic-63v-1000uf/dp/1692350QuoteThose ICs look good but there doesn't seem to be an easy way to set a long dead time, for example, if he requires 5ms what could he do?

author: TechGuy
author_rank: Regular Contributor
timestamp: September 10, 2010, 05:35:25 pm
content: Quote from: Hero999 on September 08, 2010, 09:40:01 pmInduction leakage spike, not reverse recovery. When you switch on an inductor it can cause large spikes:How large depends on the inductor, and how much parasitic capacitance it has. Usually low frequency AC solenoids have a lot of turns, which increases the parasitic capacitance, leading to large spikes.Quote from: Hero999 on September 08, 2010, 09:40:01 pmNo, I have read many app-notes and published articles about issues with electrolyte caps in milspec designed.Here are some links about mil-spec caps:http://www.dscc.dla.mil/Programs/MilSpec/listdocs.asp?BasicDoc=MIL-PRF-39003http://www.dscc.dla.mil/Downloads/MilSpec/Docs/MIL-PRF-39018/prf39018ss3.pdfhttp://snebulos.mit.edu/projects/reference/MIL-STD/MIL-STD-202G.pdfQuote from: Hero999 on September 08, 2010, 09:40:01 pmI would recommend you check with Vishay and ask if the caps you've choose have are mil-spec certified and what applications they are certified for use (ie weapons, ground, naval, aerospace, etc) . I believe usually you need to document all of the components used and provide testing data the shows MTBF, enviromental tests (ie corrosion, temperature swings, radiation, etc) to prove that the components used are reliable. I believe your design also needs to be tested under OV/UV high EMI noise, to obtain certification. To my knowledge you can't just slap together a circuit and sell it to the Miltary without any certifications. There should be a specification for the requested system provided by the DoD, that lists all of the requirements they require. The engineers must follow those requirements and provide documentation that proves that the design meets all minimum requirements, which is than certified by the DoD.Quote from: Hero999 on September 08, 2010, 09:40:01 pmHe will have to use an oversized timing cap. If you read the datasheet there should be an explaination, or formula to calcuate deadtime. Perhaps one of them has programmable deadtime using a deadtime resistor. There might be other self-oscillating full bridge drivers available too. I just did a quick search in Digikey to find a few examples.

author: Simon
author_rank: Unknown
timestamp: September 11, 2010, 09:05:09 am
content: well if what you say about military certification is true I'm pretty sure it is not happening now for all systems. We supply a company with air con units who build the bare military vehicle (I'll let you guess where they are made) the vehicles are then shipped to the UK where proper military speced companies install all of the real electronics and another company (or maybe the same not sure) puts all the amour on. So by the time the army get these wonderful machines of destruction and defence it does beg the question as to if they even know half of what is in any system and many other parts of the original vehicle baring in mind that they will not inspect or test anything but just want to see a humungus paper trail that suposedly ties all parts back to the original suppplyer, and this will not be questioned until a problem occurs.I had to carry out tests on our aircon system to prove that we were not generating the back EMF that was destroying our electronic thermostat (that is commercial grade), ok by the skin of our teeth's i was able to demonstrate that the thermostat was not blowing up in just our system but i had some stiff recommendations for our technical department. having concluded that although our design was not too clever it was surviving it remained to listen to the rumours that the asian vehicle maker was indeed having issues on their alternator system, this supposedly a fully fledged top of the line company, a company that want's everything supplied in lego sets because they are not clever enough we have to supply the bolts that will bolt the aircon system into the vehicle (and we change then more for the service than it's worth for a few standard bolts in packets).of course if your working on weaponry you are going to be designing to the top specs and are being checked for it but there is so much going into military machinery as there is into any complete vehicle that there will be things in it you will never know about. it would be simpler if the whole thing was made in the UK but really I'm pretty sure we would still cock it up, at the end of the day although quality in military stuff is higher spec than commercial it's everything is never as dandy as it should be in an ideal world and cost plays a high role in many decisions

author: Zero999
author_rank: Super Contributor
timestamp: September 11, 2010, 05:23:43 pm
content: Quote from: TechGuy on September 10, 2010, 05:35:25 pmSurely you mean high current spikes not high voltage spikes?QuoteThere are different levels of radiation hardening, EMC noise and over voltage. .All manufacturers state that their components shouldn't be used in critical life support situations but it's nonsense really. What one has to do it look at the component, its MTBF and what the different failure modes are, their consequences and formulate a design which contains no single point of failure and if it does fail the person signing off the design must take responsibility, they can't just blame Vishay or whoever.Just saying that an engineer should not use a certain type component for military/aerospace use full stop is wrong. Really it depends on how mission critical the design is and what the consequences of it failing are: will it endanger life or will it just be a nuisance and can easily be fixed back at base?The same actually applies in a commercial setting to some degree too, for example mains RF suppression capacitors have to meet specific criteria depending on whether they bridge functional, basic or reinforced insulation because it's safety critical.To be honest, I didn't get too much involved in calculating the MTBF of the entire design, we had a reliability engineer for that who could be a pain because he would keep asking me the MTBF for different components used and ask me to change them if it wasn't could enough. All I remember is that plain old aluminium electrolytics are used liberally in military designs and they get past the approvals system just fine.

author: Simon
author_rank: Unknown
timestamp: September 11, 2010, 05:49:20 pm
content: the circuitry that I'm replacing was an absolute joke, enough of a joke to warrant a six page report ! not that they listened very hard. a 25v electrolytic cap on a 28V supply, this is what gets into military stuff if it's not mission critical, then again a fire in your aircon system is not a joke

author: Unknown
author_rank: Unknown
timestamp: September 11, 2010, 06:54:24 pm
content: Quote from: Simon on September 11, 2010, 05:49:20 pmWith some luck, that (aluminium?) electrolytic will be replaced by tantalum in the future. Even more fun/fireworks.

author: Simon
author_rank: Unknown
timestamp: September 11, 2010, 06:57:47 pm
content: you would probably have to trust to luck, I'm still trying to figure if the ditsy company that we got them from made them or had them made in china in which case: good luck and bang!

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 07:36:41 am
content: Quote from: Simon on September 11, 2010, 09:05:09 amIn theory it would be better if the whole thing was designed by one company, although that can't possibly happen as no company will have experts in everything from semiconductors to air conditioning.QuoteThere's a lot of commercial grade equipment which goes into military systems. One of the reasons why vehicles are designed to have such robust environmental control systems is because some of the components used in the cabin won't operate over the full temperature range, for example try finding an LCD monitor which will work from -50°C to 50°C? You can't, even a ruggedised military spec' one wont' do that, so it's better to make sure the temperature range in the cabin ranges from 15°C to 25°C. Of course there are other options such as a CRT or plasma but then there are other things to consider such as weight, space and reliability. Even if you then found a monitor which will work down to -50°C, human factors would tell you to find a keyboard with large enough keys to be operated with someone wearing thick gloves. It's better to just buy a monitor and keyboard with a standard working temperature range of 5°C to 40°C, make sure it can survive being stored at -50°C and ensure the ambient temperature is suitable before using it.Quote from: Simon on September 11, 2010, 05:49:20 pmYes, if it's not mission critical then commercial grade is often used to save cost.What's the point of it costing ten times the amount when nothing bad is going to happen when it fails and it can be replaced easily?Did you have the schematic for the 28V PSU or did you look closely at the PCB to see how the 25V capacitor was being used? Could it be that it was on a part for the circuit running at a lower voltage? For example a microcontroller running from a 5V supply.

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 07:52:11 am
content: Quote from: Hero999 on September 12, 2010, 07:36:41 amno it was the input cap for the 78L05 reg coming off a 24V automotive supply, everything we supply for 24v is speced up to 28 (battery under charge)I'll email you the circuit let you have a giggle too. In my view this was a very dangerous setup: an under spected cap which if blown (lots of spikes on power line) would cause the 5V reg to fail (which was already unstable and had 500mVpp output spikes due to lack of output cap) this could destroy the MCU which would could them leave the 50Hz driven solenoid pump frozen with 28VDC through it. The pumps must function in order to keep cool as the water they pump keeps them from over heating. so you have a very hot pump in a plastic case..... fire !We regularly receive units back with slightly melted cases from commissioning attempts. The jerk that made these even tried to dupe us into believing that he was upgrading the software through the sensor port which was impossible because it was a 2 pin line and not the minimum of 4 i'm not sure they have understood this at work as I'm the only person thatunderstands. Really to think that such a heap of junk designed by such an incompetent person ended up in a military machine is hair raising

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 09:53:01 am
content: Agreed, it was designed by an idiot, either that or the unit is only rated to 25V maximum and was really designed for a 12V to 18V supply which still wouldn't surprise me. It also might not be the design engineer's fault, purchasing could've ordered the wrong capacitor and the production engineer didn't notice, still someone's dropped a bollock somewhere and the lack of a 100nF capacitor across the LM7805's output is inexcusable.More detail for everyone else: it's just an LM78L05 with a 1N4007 diode and 10R resistor in series with the input and a 10µF 25V 85°C capacitor from the input to 0V, I'll redraw the relevant part of the circuit if it's all right with you Simon?I don't see who failure of the capacitor could likely cause the MCU to fail other than by some shrapnel breaking off ,when it explodes, an shorting between some of the pins which isn't likely. I think there's more chance of the 10R resistor burning up and the circuit just shutting down. I also imagine the PIC may have kept resetting itself thanks to the unstable power supply due to the lack of a decoupling capacitor.The person you spoke to may have been marketing and was obviously trying to fob you off with some bullshit , don't stand for it!

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 10:12:30 am
content: yea sure post a portion of the diagram should not be a problem, I just don't want to upset anyone by revealing all but it don't really matter, the guys a twerp anyhow. I made the mistake once of not using an input cap and it kept blowing the 78l05, so my guess is that if that cap goes the 78L05 will be next and then it all goes real wonky.As far as i know BLE (the manufacturer) was possibly bough 4 years ago (their website stoped updates in 2006) and the electronics side of things is a minor part of what they do. the guy supposedly designed those himself and he has been coming out with all sorts of bullshit, I think the boards were made and assembled in china as i have seen a prototype that he must of made it was that bad and again he used a 25v cap, the unit is meant for 24V as that is the voltage of the pump. my lot were non the wiser until things went quite wrong and i was very quickly unimpressed with him when i first started talking to him about failures. He tried to tell us these are used in military boats, nobody believes that any more.I think the hope is that the pumps are all replaced and the old ones all sent back but i doubt we will be getting all of our money back which is why I took it upon myself to provide my report for ammunition in a payments row.

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 10:20:26 am
content: attached is my design, probably crude and I've omitted the back EMF diodes for the minute I'll probably go with an output TVS diode at 40v if need be. There may yet be changes after i test it tomorrow, if anyone wants the software (in mikroe basic) or layout I'll post that too.

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 11:40:21 am
content: I think a few mods are in order.I've added some protection against all the MOSFETs from turning on simultaneously.I think 3k3 for R1 was far too high, you probably forgot the quiescent current drawn by the LM7805, which could be as high as 5.5mA.Putting C1 after D5 will improve ripple by preventing the capacitor from discharging back into the power supply and other circuits being powered by it.I think there should be a fuse, unless you're certain it's being run from a current limited supply: a PTC resistor (polyswitch) would be ideal and should even protect against reverse polarity, ideally I'd recommend 2A but you may want to go low to avoid meltdown but note the tripping current at higher temperatures will be much lower so beware.

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 12:07:17 pm
content: yea protection against both sets going on at once is a good idea, the idea of C1 was to provide decoupling to the H-bridge load, the diode will stop ripple on the bridge affecting the pic's supply.I'm playing around with the input resistor values and may just go with an input resistor and 18V zenner to protect the reg properly and be able to raise the voltage of input TVS to say 40V

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 12:12:57 pm
content: I've just tried swapping the 3.3K for a 100R on the breadboard and the output ripple of the reg is the same (and the diode is not in the circuit as this was just to prove the principle but the bridge only has a 10K load), bear in mind i'm dropping 25-30V down to 5V with 7V on the regs input. i probably need to look at the caps on the output of the reg

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 01:01:23 pm
content: the pic is using 4.15 mA so even 3.3K gives a wide margin while forming a robust filter from spikes

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 01:38:25 pm
content: Quote from: Simon on September 12, 2010, 01:01:23 pmThat's not right, you can't test it unloaded, if the LM78L05 is only drawing 3mA the voltage across R1 will only be 9.9V so of course it will be fine, until you connect a microcontroller to it.The LM78L05 could be using as much as 5.5mA, which is 9.65mA in total so the voltage drop could be as high as 9.65*3.3 = 31.845V, even with the typical figure of 3mA for the LM78L05, the voltage drop will be 23.595V, which leaves <1V left for the LM78L05.You need to budget for a voltage drop of 13V maximum, meaning it'll be guaranteed to work down to 20V (flat batteries or vehicle starting).If your maximum current (including the regulator's quiescent current) is 9.65mA, call it 10mA, then the maximum value for R1 is 1k3 but you might as well to round to 1k.

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 02:04:47 pm
content: I measured the 78L05 with the pic connected ie: as it will run in the circuit, it's running fine right now (whole circuit on a breadboard)

author: batee
author_rank: Newbie
timestamp: September 12, 2010, 02:24:21 pm
content: Here's what I learned with my inverter project:0) I initially used the IR High/Lowside FET drivers, but blew up some FETs before I read the datasheet fine print that said they're not usable around 0% or 100% (they're switched capacitor devices and rely on output transitions to charge the caps). So I found the optoisolated Agilent part and went with that. It probably wasn't necessary on the bottomside FETs, but I used them anyway for symmetry purposes. The DC-DC converters are cheap ($5) and are isolated (necessary for the topside FETs, as the gate voltage needs to be 15V above the DC link voltage when the FET is on). The converters output 15V, and the higher voltage helps the FETs turn on faster. So each FET driver has its own isolated power supply.1) Initially I blew up a lot of FETs. I went to 600V FETs for a 170V DC Link design (the peak value of 120VAC). The diodes in FETs aren't enough to protect them, even from resistive loads. I used some On Semi Ultrafast diodes with 200A surge capability as flyback diodes. I added MOVs at the input (the HV DC Link voltage) and the output. I replaced the TVSes shown in my schematic with discrete 15V zeners back-to-back. This stopped the FET damage.2) I used all N channel FETs for the bridge. More dev has been done here, and N ch FETs usually have lower on resistance. Also: The idea was to design something that I could use with the larger FET modules by Powerex. I added gate resistors to limit the gate current to a value less than that specified by the FET datasheet, and added an "antiparallel diode" to reduce the time it took to turn the FET off.3) I connected this to a PIC running at 40MHz. I tried Don Lancaster's Magic Sine Waves, but couldn't make it work immediately. I calculated the duty cycle at each of the 360 degrees for a sine wave with 100% modulation (duty cycle is 1 at the peaks and 0 at the zero crossings), then wrote a script to output PWM of that duty cycle to only the bottomside FET to minimize the switching losses. The topside FET only needs to switch at the time when the polarity changes. I can alter the firmware to output higher or lower frequencies and different wave shapes.4) There isn't any hardware protection against shoot-thru. There is a programmable delay for dead time (all FETs off around the zero crossing). I haven't had any problems, but the possibility of a programming error destroying FETs isn't something I like, so I might add some logic to the next design to do this. That would add gate propagation delays that would reduce the overall speed.5) This has been tested to about 15A, and no problems so far. The traces on the board need to be reinforced for higher currents. This design totally works to power high current AC motors (I used it on a 1HP drill press, fan, and some other things). None of the MSW inverters, even the commercial ones, would do this at all.http://batee.com/projects/electronics/fet_high_side_gate_drive/fet_high_side_gate_drive_v_3.5.html

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 02:26:28 pm
content: Quote from: Simon on September 12, 2010, 02:04:47 pmIt's basic Ohm's law, V*I, do the calculations yourself, if it's working, something is certainly wrong with your measurements, it must be drawing less current than you think or you've put the wrong resistor value in there.What's the supply voltage, have you actually measured it?How much current is really drawn by the whole thing?What's the input voltage to the LM78L05?Have you actually measured the resistor value?Try using a different meter, are the results the same? Try measuring the current using a 'scope or an RMS meter.Is the output from the LM78L05 stable?My guess is that the power supply voltage is somewhere around 30V and the total current is about 7mA so the voltage across the LM78L05 is 6.9V which will still give 5V out, as long as the current is low.

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 02:38:04 pm
content: Thats a beefy project Batee, of course for 120V creation you needed a much more complex design, for 24V 300mA I think it's overkillHero,I'm running off 23 volts at the moment (my 13.8V power pack with a tampered feedback trimmer - must get around rebuilding into that case a variable votlage reg) and the 5V part of the circuit uses 4.15 mA so thats 4.15mA * 3.3 K = 13.7V 23-13.7 = 9.3 and the regs minimum input requirement is 7V so thats 2.3V clearance

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 03:36:04 pm
content: Quote from: Simon on September 12, 2010, 02:38:04 pmYou've not understood what I've being saying, all along.The LM78L05 will also consume some current, look at the datasheet.Measure the current going into the LM78L05 not the output current, unless this is what you've been doing all the time, in which case you haven't made it clear.

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 03:37:18 pm
content: yep i measured the total in current, that's the safest way, I was actually surprised that the pic used so much, I think the reg is supposed to be using like 100uA

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 04:12:26 pm
content: I still don't think you understand, the PIC isn't drawing 4.15mA it's the LM78L05.Now disconnect the PIC and you'll see that the current drops a bit and the current consumption of the PIC depends on what you're doing with it.Look at the datasheet for the LM78L05.http://www.national.com/ds/LM/LM78L05.pdfThe LM78L05 can draw as much as 5.5mA so you need to design for that in addition to what the circuit connected to it uses, which is what I've being trying to tell you.

author: Simon
author_rank: Unknown
timestamp: September 12, 2010, 04:20:02 pm
content: ok would that be quiescent current on the datasheet ? in the case of the reg I'm using its 3-6 mA so yea i may have to make some careful calculations there.looks like worst case for 20v in is 1.8 K

author: Zero999
author_rank: Super Contributor
timestamp: September 12, 2010, 05:19:40 pm
content: Quote from: Simon on September 12, 2010, 04:20:02 pmYes that's what I've being saying: look at the maximum quiescent current and add the maximum possible current consumption of your circuit and design for the minimum power supply voltage you need it to work from.QuoteThat seems more sensible.

author: scrat
author_rank: Frequent Contributor
timestamp: September 13, 2010, 10:28:39 am
content: Quote from: Hero999 on September 12, 2010, 11:40:21 amSince I'm a beginner at hardware tricks, I'd ask a few questions:-why a 10k resistor in series with only one of the two PIC's output to gate? Then why such a high value? I'd have used the highest current possible, since slower gate turn-on means higher switching losses, isn't it? If PIC's outputs are typically 25mA capable, 5/25m = 200 Ohm (PIC consumed power is not so much different, since you only have to charge/discharge a gate at each cycle). Even R4/R5 partition values seem swapped (and again, I'd have put lower resistor values).-is the added diode a sufficient solution to avoid shoot-thru? In the case GP4 is high and GP2 low, MOSFET Vgs will go to Vbus-Vlogic = 24-(5 - Vdiode) = 19.5 V (about), which I suspect means turn-on. However, I guess it is needed on the two low-sides of both legs. I think that the red-linked diode in the attached drawing could solve this issue.

author: Zero999
author_rank: Super Contributor
timestamp: September 13, 2010, 11:33:47 am
content: Quote from: scrat on September 13, 2010, 10:28:39 am1) A resistor is required because the PIC's output would be short circuited to 0V when Q5 is on.2) You're right that a higher resistor value will slow down the turn on time but it's only operating at 50Hz so the switching losses are negligible. I think the power losses in the lower resistor value would probably be higher than those incurred though higher switching losses.QuoteYes, the diode is a solution to shoot-through.When GP2 is high, the source of Q5 goes low, pulling the signal from GP4 via the 10k resistor low and cutting off the signal to Q1 and Q6. The diode will have a voltage drop of under 0.6V at the low current used which is below the threshold voltage of the MOSFETs used.QuoteLol, your diode is just placed on the opposite side of the bridge to my schematic and works in exactly the same way, the only difference is when GP4 is high GP2 id effectively disabled.#Using no resistor or a very low value on the dominant output also ensures that the associated transistors turn on first which makes the shoot-through protection more robust and avoids a race between transistors.For example, on my schematic, Q5 will turn on first and short Q1 and Q6 to 0V before they have chance to turn on. In your schematic there will be a race because Q6 will turn on at the same rate as Q2 and Q5, although it's unlikely to result in too much shoot-though as Q6 should be fully on before Q3 starts to conduct.Note that this not a perfect solution to the problem, for example in my circuit: if GP4 is high and GP2 is low, Q1 and Q4 will both be on, then if GP2 is suddenly made high, Q2 will start to turn on for a bit, before Q4 is shut off. I think a resistor should be placed in series with Q2's gate to ensure it doesn't race with Q4, Q5 and Q6, I'd recommend 47k as the delay should be longer than the switching time of the other transistors.

author: Simon
author_rank: Unknown
timestamp: September 13, 2010, 11:48:29 am
content: ah yes i did get the resistor values back to front for the high side mosfets

author: Zero999
author_rank: Super Contributor
timestamp: September 13, 2010, 12:41:47 pm
content: No, the resistors were the right way round, whether it was intentional or not.The IRF9540 is specified with a VGSof -10V, with a supply voltage of 20V the gate voltage will only be -6.25V if you exchange the 10k and 22k resistor positions, at the moment it's 13.8V which is fine.You may want to go up to 12k though as with 10k and a power supply voltage of 30V, VGSwill be -20.6V, which is above the maximum rating of 20V.

author: scrat
author_rank: Frequent Contributor
timestamp: September 13, 2010, 12:46:33 pm
content: Quote from: Hero999 on September 13, 2010, 11:33:47 amAlthough it would make a perhaps negligible difference, I think power loss will be less in the case of high-speed driving.At each cycle the switching occurs at the same time (and with the same duration of) a gate charging/discharging. Energy loss in gate charging is (for each complete charge+discharge) Vdrive*Idrive*Tturn_(off/on). Each complete turn ON+turn OFF dissipates on a power MOSFET Vbus*Ioutput*Tturn_(on/off) . Since Vbus and Iout both are much higher than Vdrive and Idrive, I guess reducing the more possible T_turn(off/on) would reduce losses. This could be interesting only for the purpose of enclosing the inverter in a small case.Quote from: Hero999 on September 13, 2010, 11:33:47 amYes, my circuit is the same as yours. Sorry, really didn't understand your solution at first, but the fact that "independently" we arrived at the same guess (only reversed) certainly means it's rightQuote from: Hero999 on September 13, 2010, 11:33:47 amYes, even if one tried to put the same "shoot-trhough prevention" diode on both PIC outputs, a different delay should be put on the two paths to prevent a race.

author: Simon
author_rank: Unknown
timestamp: September 13, 2010, 04:52:29 pm
content: well i now have the fun of coping with back EMF, while not dangerous it seems to be upsetting the pump.It turns out that the pump is 12V not 24V as it is only a sample (duh I've never known such a dumb lot) so my gate resistors are not optimized for 12V but it coped, I suspect the abrupt fall off of pump performace at 12V was because the mosfets were not driven hard enough.if i used 2 X 10K resistors I should be good to 40V ? and 30 is our limit

author: Zero999
author_rank: Super Contributor
timestamp: September 13, 2010, 07:00:37 pm
content: Quote from: scrat on September 13, 2010, 12:46:33 pmBut then the power dissipation due to the ridiculously low resistor values would be higher so you gain nothing. I think you've forgotten that the circuit works by shorting the MOSFET gates to 0V to turn them on.Reducing the gate resistors to Q5 and Q6 shouldn't increase the switching speed much because of R2 to R4 will slow things down too much. Incidentally the gate resistor of the submissive input will only cause high power dissipation, when both PIC outputs are high, so it's not a problem.R2 to R4 need to be reduced as well, to have any effect. Suppose you set the values so the current it 25mA (a total resistance of 960R), the power dissipation due to them would be 0.6W.Although the instantaneous power dissipation will be quite high (12W, assuming a current of 1A and a power supply voltage of 24V) that condition will only occur for a short time each cycle so the average power dissipation will be tiny.What do you think the switching speed of the MOSFETs will be?I've never done this calculation before so I'll guess.The maximum gate capacitance of the IRL540 is 1.96nF, with a resistor is 10k, the time constant is only 19.6µs for the bottom MOSFETsThe maximum gate capacitance for the IRL9540 is 1.3nF so with 22k the discharge time constant is only 28.6µs and the charging time constant will be 10k|22k = 6.67k*1.3nF = 8.67µsI don't see how such short gate RC time constants can slow the MOSFETs down enough to cause significant power dissipation.Even if the MOSFETs took 100µs (over three times the longest RC time constant) to both turn on and off the power dissipation should be under 0.6W.I = 1ATswitch = 100-6sF = 50HzV = 24VP = 0.5I*V*Tswitch*2FThe current is halved because MOSFETs are current controlled so act like constant current loads when operating in the active region.The frequency is doubled because it swichs twice per cycle.So it can be simplified to P = I*V*Tswitch*F100*10-6*24*100 = 0.24W and don't forget that's spread over four transistors in TO-220 packages not mostly in an LM78L05 which is in a tin TO-92 package.I don't see how it could switch any slower than that, the chances are it'll be faster, if you know the correct calculation and think it'll be slower then please demonstrate it.QuoteThe diode method won't work on both outputs, it only works with one being the dominant and the other being submissive.The best way of doing it is to logic gates so if both inputs go high, the output will be low, even then there's a risk of race so there should be the correct number of gates, have them clocked or use RC time constants to make sure the inputs change when they should.You could use a quad NOR gate IC, Schmitt trigger is probably best, I'll post the circuit if you or Simon are interested but I don't see the point: it's an extra IC to provide protection against an unlikely catastrophic event.

author: Simon
author_rank: Unknown
timestamp: September 13, 2010, 08:37:18 pm
content: Well I've changed the 22K resistors for 10K ones and the circuit is working much better, the pump not works (actually pumps water) on 12V as the high side mosfets are being driven properly, it's a pity I can't get more voltage to the low side mosfets but that would mean introducing another pair of signal mosfet drivers.I have the pump (that i borrowed from work) running now on my board and the mosfets are quite cool with the 300 mA loadThe back EMF problem is pretty much gone but there are signs of it in the switchover points, I've also borrowed the original driver board and from what I can tell there is on each output point a reversed based diode with a 47 ohm resistor in series connected to the negative

author: TechGuy
author_rank: Regular Contributor
timestamp: September 13, 2010, 09:51:22 pm
content: Quote from: Simon on September 12, 2010, 10:20:26 amSome red flags:1. No gate pull down resistors. Each MOSFET should have a 10k pull down resistor.2. Driving MOSFETs with Vgs of 10V with a 5V TTL output. Your not turning on the MOSFETs all the way when you only apply 5Vs to the Gate. You should use MOSFET drivers for this circuit!3. No Gate resistors on the low side MOSFETs4. No Snubbers to disappate inductance leakage spikes & reverse recovery. Add two RC snubbers on both sides of the bridge.5. Your P-Channel Gate resistors are awfully high a gate resistor should in in 10's of ohms not 10,000's of ohms. Having such a high resistance will take for ever for the gate to fully turn on or off. MOSFETS gates are essentially capacitors. You should use MOSFET drivers for this circuit! if your VInput is 24V, your will also exceed the VGS for the P-Channel MOSFETs.6. You need a low value ceramic decoupling cap between Vdd and ground on the PIC. and the leads should be very short. You want a ceramic cap that is about 0.1uf with a voltage of 25V or less so that it has very low ESR. Otherwise internal switching to the MCU can cause the VDD to drop too low causing erratic behavior or abruptly reset the MCU.7. MCLR should have a pull high resistor (10K) so that noise doesn't cause it to trip, unless you disabled it using the PIC control register ( not sure if this is an option with the PIC12 series).8. There should be a PTC fuse between the J1, pin1 and the 100uf/TVS diode. A large power surge could blow the TVS diode. the PTC will provide some protection. TVS diode will get fried if the user connect the input backwards (PTC fuse would prevent that)9. No Overvoltage\undervoltage lock out. This is very simple using the PIC. Just use one of the ADC with a Resistor-Resistor voltage divider to drop the input voltage below 5V, and measure the input voltage. Two resistors is and a zener to prevent overvoltage from exceeding the ADC voltage range. a small cap (0.1uf) across the low side resistor would be helpful to avoid false readings (ie because of a temperory input voltage change when a large load is suddenly turned on or off)10. Should include a Rsense resistor to measure the current. Use the other ADC channel to measure the bridge current.If your going to do this project, do it right!

author: Zero999
author_rank: Super Contributor
timestamp: September 13, 2010, 10:48:33 pm
content: Quote from: TechGuy on September 13, 2010, 09:51:22 pmThat's right, if the MCU's output acidentally gets configured as an input, the MOSFET's gate will float, potentially biasing it into its active region causing a high power dissipation.QuoteI think it will probably be all right, the current is only 1A (see the graphs on page 3 of thedatasheet) but yes I know the datasheet gives typical not wore case so using drivers would improve things. I wouldn't bother though, I think it would be better to swap them for logic level MOSFETs such as the IRL540.QuoteYes, it's always a good idea to include them.QuoteThat will work or he could use diodes.QuoteSo what it's only running at 50Hz?Theswitching losses will be negligibleeven if the switching times are 100µs or worse, see my previous post:using resistors with such low values will cause a much higher power dissipation.QuoteAt 24V no, do the potential divider calculations, the VGSis only -13.8V with the supply voltage at 24V.The supply voltage has to exceed 29V before the maximum VGSof the IRF9540N (20V) rating is exceeded so yes, change the values if it needs to run off such a high voltage.QuoteYou're perfectly right, you should always put a ceramic capacitor in parallel with the PIC's power supply rails, the 10µF capacitor on the LM78L05 will have much to high an ESR to be effective.QuoteYes, there is an option to disable MCLR, even on the basline PICs (12F508) so I'm pretty sure it's possible with the more advanced 12F629.QuoteYes, always include a fuse, it's also possible that some idiot could connect the power in the reverse directionQuoteYes, I read about this in one of the PIC tutorials I've been studying, not sure if the zener is needed though: surely if the voltage exceeds the ADC's maximum rating, the PIC would already be toast? And that shouldn't happen unless the LM7805 fails which is unlikely.QuoteAre you talking about short circuit protection? If there's a short, the power supply voltage is likely to fall so quickly that the PIC resets before it has chance to turn both MOSFETs off and if that happens both inputs will default to high impedance and the MOSFETs will turn off anyway, providing the appropriate pull down resistors are used of course.Why not get rid of the 2N7000s altogether and use the bottom transistors to pull-down the top?Attached is an example circuit I designed to illustrate this point to someone else so would need to be changed for your application

author: Simon
author_rank: Unknown
timestamp: September 14, 2010, 06:47:29 am
content: all points noted and many of them are planned changes (like gate resistors), my aim was to get something running first and show him how small it will be, I think if it grows 50% he won't have a problem with that. the original driver uses some sort of diode and resistor snubber, 2 off from the output to ground, i may just copy this but back EMF has pretty much been resolved now that I'm driving the top mosfets correctly and the mosfets with the intended pump run quite cool (I can't actually say they were getting even warm). I've now made both resistors 10K so thats -6V on 12V and -12 on 24V, at worst case of 30V thats -15V which is well withing the 20V spec but I may readjust that later when we go into 24v production.The MCLR is dissabled in software.the idea of using the low side mosfets to drive the high side ones is a very good idea for space constraints, in fact if i can get rid of the high side driving mosfets i could use them to drive the low side mosfets so keeping the same part count (well couple more resistors) and driving everything properly.Yes it's only 50Hz so the on/off times of the mosfets are really not worth worrying about.As for voltage and current sensing: err, this is meant to be fairly simple, I'll implement some sort of fuse but I'm not bothering with voltage protection, I'm afraid if they want to screw it that's their problem, provided it gets reasonable supply voltage nothing bad will happen.Using a high side sense resistor for current will just introduce the need for another chip and that's going too far

author: scrat
author_rank: Frequent Contributor
timestamp: September 14, 2010, 08:57:01 am
content: Quote from: Hero999 on September 13, 2010, 07:00:37 pmPower MOSFETs' datasheets report gate charge curve, which shows how gate behaves. Because of the Miller effect (between gate and drain), on the gate at switching you see a much larger capacitance than the Cgs+Cgd, since Cgd get multiplied by voltage gain. In fact, it is easy to calculate turn ON/OFF time when considering a constant current source on the gate (you simply take the charge required at the desired gate voltage Qg @ Vgs and divide by the current charging/discharging) while it is a more complex if you consider a constant voltage source (in fact, equivalent capacitance changes when Vgs changes).

author: scrat
author_rank: Frequent Contributor
timestamp: September 14, 2010, 09:06:26 am
content: Quote from: Simon on September 14, 2010, 06:47:29 amThat seems a good idea, but as TechGuy pointed out, your driving voltage (5V) is quite low, a driver IC won't be so bad, but even a SOT-23 transistor could be a low-cost and low-space consuming solution.Quote from: Simon on September 14, 2010, 06:47:29 amIf voltage would be higher, you could also put a zener there to be sure max Vgs gets not exceeded.

author: Zero999
author_rank: Super Contributor
timestamp: September 14, 2010, 09:54:39 am
content: Quote from: Simon on September 14, 2010, 06:47:29 amHave you actually measured what the conduction losses are for the top and bottom transistors using a 'scope?Don't forget that the lower transistors have a lower resistance anyway.Maybe you could just use the IRF540s for the prototype and switch to IRL540s, which are logic level and are designed to work from 5V inputs, for production?What about the switching times/losses?Quote from: scrat on September 14, 2010, 08:57:01 amAll right, so what sounds like a reasonable estimate of the switching time?I'll have a play with LTSpice.Quote from: scrat on September 14, 2010, 09:06:26 amI don't think it'll be too bad, the datasheet says the conduction loss is only 0.1V with a VGSof 5V and an IDof 1A, even at 175°C. I know datasheets tend to only give graphs for typical devices but the ones he's using seem fine, he's only using the IRF540s because he's already got loads of them and he can switch to logic level devices for production.

author: scrat
author_rank: Frequent Contributor
timestamp: September 14, 2010, 10:58:48 am
content: Well, in this case power is perhaps so low with respect to the huge transistor used that it makes not much difference.However, it is interesting to see how gate charge happens.If you look at fig.6 of the datasheet (http://www.irf.com/product-info/datasheets/data/irf540n.pdf) you can see that starting from zero, until about 4.5V voltage is linear with charge, which means (Q = C*V) that on the gate there is a simple equivalent capacitor. Its value should be Ciss = Cgd+Cgs, and if you look at fig.5 you will see that for a Vds above 20V Ciss = 2nF, that matches the fact that at Vgs=4.5V you have about 9nC. If you think of the superimposing principle, you short DC components and see what happens at a variation on the gate voltage. Drain and source are constant, so all voltage variations on the gate go charging the parallel of the two capacitances like drain and source were both to gnd.Now, above 4.5V the transistor starts counducting, so drain is no more constant. The curve above that threshold becomes almost horizontal, since a voltage increase on the gate makes the drain to lower (because reduces rds resistance), so the Cgd cap gets bounded to an almost constant value (there's a sort of feedback that "amplifies" capacitance, called the Miller effect). In practice, gate equivalent cap is very large, one can assume it is infinite until charge reaches the other value (here about 23nC) where the transistor is really in triode region. This last curve segment, above 4.5V and 23nC, is characterized by an equivalent cap of about 4.4nF (from the graph).So, for each of the three segments:- 0 to 4.5V : RC charge at constant voltage source -> T = 2.3 * R*C = 2.3*10k*2n = 46us- 9 to 23 nC : C charge at constant current -> I = (Vhigh - Vg) / R = (5-4.5) / 10k = 50uA , T = DeltaQ / I = (23n-9n)/50u = 280us- 4.5 to 5 V : RC charge at constant voltage source -> T = 4 * R*C = 5 * 10k*4.4n = 176usOf course in this case the charge to 4.5V will be sufficient and is quite short, but if we had a larger output current, and then we really needed to charge our gate to at least 5V (the graphs show that there is a big difference in resistance between 4.5 and 5V), the turn on/off time will be quite long.

author: TechGuy
author_rank: Regular Contributor
timestamp: September 14, 2010, 05:51:57 pm
content: I've got a better idea, since Current demand is low, Speed is low, and you're not aiming for high efficency. Ditch the MOSFETs and go with PNP-NPN totem pairs for the bridge. You can drive them at 5Volts. Can you can go with Surface mount packages (DFN, TO-252, or SOT224), which will be far smaller than the four TO-220 mosfets choosen.The small Vce-sat voltage drop is irrelevent in this design.QuoteYour assuming that the input voltage will always remain below 29V. We can't assume that it will remain so. There could be a power surge that causes the input voltage to rise above the limit, frying the gates. All it takes is a short voltage surge to blow them.QuoteNo, against saturation of the solenoid or some unforseen issue that is causing excessive power demand. Flux walking, or perhaps the pump becomes clogged or something I can't see or predict. I would use one of the spare PIC pins with an LED to indicate status, ie Pump is running (steady on), Under\over voltage - slow pulsing LED, Over current -fast pulsing LED,etc.

author: Simon
author_rank: Unknown
timestamp: September 14, 2010, 06:18:23 pm
content: the pump and driver will be inside an airconditioning case and the soldiers riding in the vehicle will have better things on their minds than reverse engineering their air con systemwon't there be more dissipation from a BJT ? as there is a fixed Vce of 0.2 volts ?I chose a TO-220 package so that it would not heat up at all as it is big enough to act as it's own heat sink. bearing in mind the circuit will be put into it's own little case and possibly potted which might even help dissipation ? as the compound will absorb the heat and take it to the case walls and out ? or maybe thats not the case

author: Zero999
author_rank: Super Contributor
timestamp: September 14, 2010, 07:47:48 pm
content: I agree, I would think that BJTs would give greater losses than MOSFETs.To saturate properly, the base current will also probably need to be higher than the PIC's output pins can provide.Maybe MOSFETs could be used for the low side and BJTs for the high side?The MCU could drive logic level MOSFETs which have a high gate impedance and can easily pull down the BJT transistor's bases on the high side.By the way, for production you could use the PIC10F200 to save both space and money - it comes in a tiny SMT SOT-23 package and costs very little.

author: Simon
author_rank: Unknown
timestamp: September 14, 2010, 09:57:10 pm
content: yes I'll be looking at different pics although a couple of things have been put forward that I need to have resources available for. Although he wants to ditch bothering to detect water he is considering using the difference in temp in and out to determine when the air con system is putting out cold air (as it also has a blow only function) which is a rough guide to if there is condensed water to be pumped out. I think microchips temp sensors that output 10 or 19.5 mV/C will do nicely but then I'll be needing an ADC so need to watch which pic i choose because I'm not writing software every five minutes over 20p difference.He insists on having it made by a subcontractor and my guess is such a sub contractor will not be able to handle SMD stuff or will just mess it up, he's happy with through hole, I showed him an SMD chip soldered to another circuit and I think it scared him off them, my guess it also that I'll be programming the chips and at the moment it is DIP8 in my zif socket or SMD with a header but if he's going to keep changing his mind about stuff then i might put a header in anyhow so I can modify the firmware later.I will be changing the low side mosfets for logic level ones such as the IRL540 which looks like an almost direct replacement for the IRF540 but for the lower gate threshold but I'm yet to read all of the datasheet and have found that the IRL540 seems to have different gate specs to the IRL540NPbp, I think most of the back EMF will be solved by driving the mosfets with sufficient strength, the IRF540 have a threshold as high as 4 V and I know that a pic can put out as low as 4.5V so not a good match and not a fully switched on mosfet, working off the back of experience and lessons learnt with the high side fets that will cure it.The original boards back EMF protection seems to amount to a diode and resistor in series put across the low side mosfets, essentially taking the burden off the built in diodes so really I should already be free of back EMF and guess that the on resistance needs reducing in order to drive the signal in the right direction over riding back EMF

author: Zero999
author_rank: Super Contributor
timestamp: September 15, 2010, 07:53:01 am
content: There's no difference between the Pb-free versions of the IRL540 and Pb versions, other than compliance with the RoHS legislation.http://www.vishay.com/docs/91300/91300.pdfIf your contractor are too rubbish to cope with SMT you shouldn't be using them in the first place, even if you only want to use through hole components.You can get six pin MCUs which contain an ADC.http://ww1.microchip.com/downloads/en/devicedoc/41270a.pdfI thought one of the advantages of using a high level language, such as BASIC is supposed to be that you don't have to rewrite all of you code to change from one processor to another?Yes, using in circuit programming is probably still a good idea, even if you end up going though hole, another idea is to use a socket for the PIC.Why not get rid of all the MOSFETs and use an IC h-bridge?There are plenty of different solutions available which also have shoot through protection and some even have protection diodes built-in, the SN754410, L293, L298 seem to be most common and as all the transistors are on one IC they'll be matched meaning you should be able to parallel unused outputs for more current capability or a lower voltage loss.

author: Simon
author_rank: Unknown
timestamp: September 15, 2010, 11:49:00 am
content: the L298 looks interesting as we are now looking to drive two pumps on the same circuit but using BJT's i'm wondering what sort of heat dissipation it has. at the end of the day it costs a little more than the 4 mosfets and will take just a little less space.

author: scrat
author_rank: Frequent Contributor
timestamp: September 15, 2010, 12:35:20 pm
content: L6201 will fit your needs, integrates drivers (so eliminates the need for the two MOSFETs for the high-side, has shoot-through protection (dead-time), thermal shutdown and an active-high enable input. RdsON, as a drawback, is at least 3 times the one of IRL540 (however, IRL540 is quite huge for the purpose, so you could choose something smaller and cheaper).

author: Zero999
author_rank: Super Contributor
timestamp: September 15, 2010, 01:35:52 pm
content: I suppose ICs with bootstapping have the added advantage of limiting how long the high side transistors can be on for, so if the PIC freezes the pump won't be connected to DC power for long before the bootstrap capacitors discharge and turn off the top transistor.

author: scrat
author_rank: Frequent Contributor
timestamp: September 15, 2010, 01:56:20 pm
content: Quote from: Hero999 on September 15, 2010, 01:35:52 pmFor L6201: although there is a "charge pump" in the principle schematic, recommendation for bootstrap cap lets guess that what you say is true.I have to apologize for a previous post I made about switching losses: the presence of the diode makes power dissipated during turn on negligible (soft switching), while turn off is a hard switching (e.g. voltage and current involved in the worst case are Vbus and maximum load) and then the device dissipates a sensible amount.

author: TechGuy
author_rank: Regular Contributor
timestamp: September 16, 2010, 06:50:55 pm
content: Quote from: Simon on September 14, 2010, 06:18:23 pmIt will get pretty darn hot quickly if you drive 10Vgs MOSFETs with 5volts and high value resistors. Ideally you want to use surface mount (TO-252 or TO-263), not heatsink mount MOSFETs without heatsinks, with surface mount devices, heat is disappated into PCB board. Better dissapation with a surface mount transistor can be achieved using oversize pads. A TO-220 without a heatsink is a disaster in the making. Bigger case size does not mean more effective in disappating heat. To get good efficient and low thermal disappation you need to keep switching loss very low. Thats why all commericial MOSFET designs use gate drivers and low value gate resistors.the Vce will not be as big a deal than if you drive the MOSFETs using 5V and high value resistors. Either add gate drivers, or go with BJTs.QuoteThe L6201 motor driver can remain on a switched state indefinately. The pump charge selfs renews the cap charge using a built in oscillator. I use the L6201 in a Fire Alarm controller to power 4 wire fire alarm sensors. The Fire alarms sounder is triggered by reversing the polarity of the input voltage supply.

author: scrat
author_rank: Frequent Contributor
timestamp: September 17, 2010, 12:02:27 am
content: Quote from: TechGuy on September 16, 2010, 06:50:55 pmSince I didn't read very well the datasheet, I suspected this because of the app schematic showing DC motor fwd/rev, but then thought this had to be done by PWM under current control. Why did they put the recommendation saying that bootstrap cap has to be much larger than MOS capacitance? Is it only for ensuring good driving voltage at turn on start?

author: Simon
author_rank: Unknown
timestamp: September 17, 2010, 05:56:43 am
content: well I've not tested yet but surprise surprise i asked our buyer at work for 10 IRL540N and I got them next day, these have a max gate threshold of 2V so will be well turned on by 5V, even the IRF540N did very well on 5V so with a proper logic level mosfet there should be no more triggering problems.The board will not have large dissipative pads, if your talking surface area to dissipate heat from the TO-220 case has more of that than a tiny SOT23 package with a half inch of 0.64mm trace connected, in any case at the moment the losses seem to be very very low as I've run the actual pump and the mosfets were not even warm in fact still felt cool to touch.

author: Zero999
author_rank: Super Contributor
timestamp: September 17, 2010, 01:15:23 pm
content: Quote from: Simon on September 17, 2010, 05:56:43 amIt's not that simple, you need to ensure that the MOSFET will pass the required, for exmaple, according to the IRL540 datasheet, if the gate voltage is 2.5V, the drain current will be no more than 5A to 7.3A depending on the temperature, at which the on voltage will be unacceptable.Note that the graph on the datasheet is for a typical MOSFET and the currents are higher at higher tempertures. The minimum and maximum gate threshold is 1V and 2V respectively, so a typical MOSFET will be about 1.5V so add 0.5V to the VDSon the graph for the highest threshold and subtract 0.5V for the lowest.

author: Simon
author_rank: Unknown
timestamp: September 17, 2010, 01:41:34 pm
content: The gate of the N channel mosfets will be getting 5 V (4.5 at least) so more than 7A will be available and all i need is 0.6 so there should be no problem ?

author: Zero999
author_rank: Super Contributor
timestamp: September 17, 2010, 01:58:38 pm
content: Yes, what you're doing is fine, with 5V at the gate, the MOSFET will be biased fully on with low conduction losses.I didn't mean to say that there would be a problem, just that you should be wary of paying too much attention to the threshold rating which is specified at a very low current: 250µA in this case. In other words, if you have a 1A load and put just 2V on the gate, it will get hot.EDIT:Below the saturation current, the actual current drawn will depend on the load, not the gate voltage, which is what you want.

author: Simon
author_rank: Unknown
timestamp: September 17, 2010, 02:05:04 pm
content: yes i realize that the Vgs threshold is just a start point, the IRF model works well on 5V with a threshold of 2-4V so i figured the IRL would be well biased to switch fully on.

author: jahonen
author_rank: Super Contributor
timestamp: September 17, 2010, 02:29:38 pm
content: Generally, if there is a Rds(on) figure for a gate-source voltage in the datasheet, then it usually means that the voltage is large enough for "low-ohm region" operation.Regards,Janne

author: Zero999
author_rank: Super Contributor
timestamp: September 17, 2010, 03:17:04 pm
content: It's normally specified at 10V but logic level MOSFETs are specified at 5V and some low voltage devices at 3V.

author: TechGuy
author_rank: Regular Contributor
timestamp: September 20, 2010, 07:30:22 pm
content: Quote from: Simon on September 17, 2010, 05:56:43 amThats not entirely correct. the SOT23 soldered to a PCB will have a large area to dissipate heat into. It will dump thermal energy into the PCB board. A TO-220 MOSFET package without a heatsink is a disaster in the making.As far as your test runs, don't assume that the conditions you experienced with your test setup will apply to all pumps and situations. What if the Power supply is 10% to 15% higher or lower voltage? What happens if the pump is brand new or old and has a different current load then your test pump? Lab conditions rarely are the same as real world conditions. An Engineer designing production system will always consider situations that are outside of normal/idea conditions.I don't know why you're using TO-220 instead of surface mount devices. SMT are cheaper, use less PCB real estate (smaller PCB saving $$$) and are cheaper to mount (via pick and place equipment), saving production costs.

author: Simon
author_rank: Unknown
timestamp: September 20, 2010, 07:49:33 pm
content: Quote from: TechGuy on September 20, 2010, 07:30:22 pmBecause i have to make it.....idiot proof. My company are pretty good at going and finding the worst cowboy manufacturers against all sane advice and that they use one that is SMD capable is going to be down to pure luck. And I am working under and ever more senile engineer that knows nothing about electronics and how to spec electronics and packages so I'm not getting all of the information I'd like about how it will be manufactured and how he plans to inevitably screw it all up during assembly.At the moment we are in "consideration stage" they just want to see that it is possible. I did suggest today that a D-pak is used for the mosfets as this will sit flat with the board (and is what the pumps original controller uses) I know conditions will vary that's why I have a dissipation of less than 200mW from all four mosfets combined that's about as robust as you will get. He is now looking into a case to put it in an once he has got one i will do some thermal tests.I can't use SMD until I am assured that the maker he wants to use (who is probably making them shacked up in a barn somewhere) even knows what SMD is, remember to this lot electronics is a whole new scary world, they still use high power resistors on heat sinks to drop 24V to 12V on air con compressor clutches. I've suggested that we (I) make them in house but my lot are so damn scared of making anything as having a supplier to blame comforts them but having seen the last disaster which I'm sure they will not recover their costs from I'm not too sure that's the way to do it.Again we are just looking at possibilities at the moment and all this needs to go before the MD and technical director for a final decision so maybe I can convince them to make it in house and let me do it then I know what I'm designing for and my MD loves to save those pennies, that's why the whole place is the cockup it is.

author: Thermal Runaway
author_rank: Contributor
timestamp: September 21, 2010, 06:23:03 pm
content: Quote from: Simon on September 02, 2010, 04:17:33 pmI've nothing further to add regarding your PSU design, there are others on here already giving better answers than I would give, but regarding your PIC internal clock question, the internal oscillators can usually be programmed to work at a whole range of different frequencies via an internal divider. It's possible to program an internal clock to operate as low as 32KHz. There's a table of possible internal clock values in the datasheet and these are set up via the PIC internal registers.However, assuming youwereusing a PIC to generate a square wave output; lowering the clock frequency of the device would not necassarily be the best solution to your problem. It would be better to leave the clock alone so that the rest of your PIC application runs quickly and then use time wasting methods (delay routines) to generate your output at the required frequency.Better still would be to use an internal timer which can be configured to run on a divided down version of the clock frequency. When the timer overflows an interrupt is generated, and this interrupt could be used to change the state of an output pin. You could calculate the value of prescaler to use for the timer module based on your chosen internal clock frequency (taking into account that each instruction cycle takes 4 clocks anyway) and your desired output frequency.BrianBrian

author: Simon
author_rank: Unknown
timestamp: September 21, 2010, 09:36:09 pm
content: Well for the clock I simply solved it by using delays and setting pins high and low, what my point was that with a 4MHz clock the slowest PWM output is 245Hz which was way to fast so I had to resort to manually creating the waveform