Need Current Reduction in SMPS Circuit

Status
Not open for further replies.

bobledoux

Member
I have a 9 volt battery charging a capacitor to 90 volts. It takes about 2 seconds from startup to full charge. This is a pulse application with fresh startup on each pulse. But with little use the battery drain pulls down the 5 volt voltage regulator so the microcontroller running the system browns out.

I’d like to improve battery life by slowing the rate of charge. I can give the circuit up to 12 seconds to charge up.

What’s the best way to do this?

My current ideas include,

ramping up the duty cycle of the switch mode power supply,

ramp up the feedback voltage limit.
 
What are you using to charge? Generally capacitors chargers use boost, or flybacks, since this appears as a current source to the capacitor. Increasing the off-period of the switching would do it, or if your controller chip uses peak current limiting for the on-time, then a larger value inductor would take longer to reach the current threshold.

It all depends on how your SMPS chip/circuit behaves. A feedback line usually just measures a voltage. For a constant output voltage/current, this is compared to an internal reference. But for charging a capacitor, surely the FB line is used to stop charging once the caps voltage has reached a threshold? In this case, by increasing the feedback voltage limit... you'll be charging the capacitor at the same 'rate' but to a higher voltage.
 
I'm using a boost circuit with pwm controlled by a PIC 12F683. The PIC provides PWM and the comparator controls voltage using PWM on/off. My duty cycle calls for one discharge pulse from 100uf each 45 seconds. The boost coil is 100uh rated for 0.7 amps. I'm using a 6usec pulse with an 8usec period. It is charging too fast. Power is a 9 volt battery. Simulation suggests the instantaneous current draw is measured in amps.

Currently, I'm wiring up a test circuit to try longer period and shorter duty cycle. I'm considering a 1usec pulse for testing purposed. If I can reach charge level in 15 seconds its good.

The current draw browns out the PIC when battery voltage falls to 8 volts. This occurs after about 20 pulses. By smoothing out current draw I hope to get at least 100 pulses before battery condition becomes an issue.

Adding a large cap before the coil has little impact on current draw.

Another possibility is to reduce PIC voltage to 3.3 volts, moving brown out voltage down. I haven't tried a large cap at the PIC.
 
In that case, I guess modifying software is easier than using a larger inductor. The inductor is rated at 0.7A you say? I'll assume thats saturation as opposed to RMS (RMS is generally lower though), so with 9V across it, it'll take..I*(L/V) seconds. Where I= 0.7, L = 100u, and V = 9. I make that 7.8uS. That should be your maximum ON time for the given inductance, peak current, and power supply voltage.

You don't really want constant off time, as the lower the voltage across your charging cap, the longer it takes for the current from the inductor to discharge into it. Switch your mosfet back on before the inductors current has fallen to 0 and without sensing current you risk ramping up the inductors current beyond 0.7A... so it just increases. This is the trouble with cap charging circuits as opposed to constant voltage/current ones At the start, the current steps up each time the switch is on, adding to any residual current left over from the last one = saturation. Have you measured the efficiency?

I'd say, fix your ON time to something less than 7.8uS. Can of course be lower, lowering the peak current, which would require more switching cycles to charge the cap. And then you can vary your off time. That said, if you just want to reduce the charging time (as such, reduce the power input) you shouldn't have to vary your duty cycle at all, provided its long enough to allow the inductors current to fall to 0 (or at least very low) before turning the switch on again.

Seems like your feedback voltage is just sensing the capacitors voltage, and so, unlike many converters, it's just waiting to be tripped to tell it to fire the output spark switch. Raising this voltage would just determines what voltage the cap gets to...therefore how many pulses per second, but would still draw the same ammount of current form your supply.

I believe linear technology has some wonderful app notes on their 'photoflash' capacitor chargers which explain things much ebtter than I can. I used them as a basis for a nice little 555 cap bank charger.

Btw, looks like a taser to me
 
No, its not a taser. It fires a solenoid. The application is for a replacement board for a Walther Model FP Olympic free pistol. This is a single shot .22 pistol that shoots at a target 50 meters away; the bulleye is 50mm. It is considered the most challenging of the Olympic pistol events.

Walther sold this unique design in the late 1980's. The trigger is fully electronic. An opto- interruptor trigger uses an LED and phototransistor. The firing pin is a solenoid. There are no mechanical action parts like those found in other guns.

The board used logic and analog chips of the vintage. Walther farmed out the boards and couldn't resolve ongoing electronic issues. Eventually, all support stopped and users were left with expensive door stops. Today, a similar, mechanical paper punch costs about $2200.

My intent is to develop a replacement board. I've been successful in developing a design that works and fits within the confined space. My design uses through hole components so it can be constructed by non-electronic builders. I've been working on the design for a number of months through five different boards. My intent is to make the design freely available. I have no desire to market a product because of liability issues

About 2200 of these were built. Many of them are in Europe.

My previously posted schematic left out the left side of the PIC, which included the trigger and other functions. I didn't want to complicate an SPMS question with these details.

My remaining issue is current flow.

My current pulse time is 6 usec with 9 usec for the period.

The efficiency issue is complicated because of the pulse action.

Under my current design, a loading lever is opened and a cartridge is inserted. When the lever is closed, signifying the desire to shoot, my charge cycle starts. It typically takes about 15 seconds to aim and fire after the lever is closed. The factory gun charged in 5-7 seconds; my board takes 2 seconds.

The solenoid firing pulse is about 100 milliseconds. When the trigger is pulled the SMPS is turned off and the remaining capacitor charge drains off. The remaining charge is about 75% of total charge.

This cycle repeats when the loading lever is opened and again closed.

I may get better efficiency if I keep the SMPS on. Why lose the left over charge?

These are the questions I'm trying to resolve. My goal is longest possible life from a 9 volt battery.

For entertainment, I've attached the later Walther Schematic.
 

Attachments

  • Walther.pdf
    96.7 KB · Views: 178
Last edited:
To increase the charge time and reduce power: reduce the on time a little and lengthen the off time.
 
To increase the charge time and reduce power: reduce the on time a little and lengthen the off time.

Heh, thats pretty much what I said,...although it took me many many more words to get there (

To the OP. Apologies about assuming it was s a taser, its just that exact sort of circuit (low voltage -> higher voltage -> cap -> discharging into coil) is exactly how some tasers work, and also how 'coil guns' work. So we get many many questions regarding these, although given your use of a mosfet driver and a PIC, I gathered you weren't just a kid who was being bullied...

Onto the problem! As Ron and myself have said, reducing the ON time of the MOSFET and increasing the off-time will increase charging time, and, more importantly, the power drain on your battery.

May I suggest that you seperate your design into the 'charger' and the 'trigger'. That is, for now, forget about everything after the high-voltage capacitor - all that is doing is shorting the capacitor across a coil/solenoid when the second MOSFET is turned on.

Also, the use of the word 'pulses' I assumed (wrongly) that this meant how many times the first mosfet was switched, rather than 'how many times the capacitor is discharged. So if I concentrate on the first part of your circuit you have a pretty standard boost converter. The difference is, you are not trying to output a constant voltage. You are charging a capacitor, to a specific voltage, which is then periodically is discharged.

Keep your on time as 6us (as this means that the inductors current will ramp from 0v to around 0.54A - 540mA. But increase the off time - as ron said, increase the period. If you want a 10 second charge time, then you will have to do some maths to work out the off time. Add the on time to the off time, and you have your period. This period then determines the value In the PR2 register, and any need for prescalers. With fixed on time of 6us you can then work out what value goes in the CCPR1L register on your PIC based on the period.

Given the capacitance, we could work out all the specifics, that is, calculate the OFF time as well as the ON time, and therefore the period, just by choosing a charge time. And this would give you the values needed for the PR2 register and CCPR1L register. But some experimentation would probably be quicker for you. The PIC12F683's internal oscillator is...8MHz or 4 Mhz? If its 4Mhz then the count period of timer2, with a prescaler of 1:1 (ergo, no prescaler) is 1us. So, with '5' in your CCPR1L register, and 255 in the PR2 register, the on time is 6us, and off time is 256-6 = 250us. See how long it takes for your cap to charge then

If it takes too long, reduce PR2 to reduce the off-time. To quickly, and decrease the ontime (CCPR1L) to 4.
 
Last edited:

75% of the charge is only 56% of the energy. However, I would have thought that you could cut down the stored energy by reducing the value of the storage capacitor or the voltage so that less power remained.

I would guess that the left-over energy is discharged for safety reasons. Half the energy could be enough to fire the weapon. Also the capacitor voltage should be low enough not to cause a shock if the weapon is then dismantled.

However it would save power if remaining energy in the capacitor was kept when the weapon is going to be fired again.
 
How quickly the power is transfered from the cap to the solenoid depends on the inductance of the solenoid, and (to a lesser extent, its resistance). A higher cap voltage will dump current into the solenoid quicker, but may not be needed (its not a coil gun after all, just a firing pin). A lower voltage will slow it down. which can be advantageousto ensure the solenoid isn't just 'kicked' but rather pushed. Seems like 90V is a pretty good value to pick.

Why would you drain off the remaining cap charge? Theres already a resistor voltage divider form the cap to GND used to measure the caps voltage - this will slowly drain the cap anyway. If there's charge left in the cap after firing, then it'll take less energy to charge it back up to your target voltage for the next pulse. Seems like you're charging up a cap very quickly (dragging your batteries current down..your original problem), then discharging *some* of the caps energy into a solenoid, and wasting the rest in a 1k resistor. Also, higher current drain on a battery generally reduces its capacity, reducing the number of 'fires' even further - I'm willing to bet you could easily double the battery life with a couple of minor modifications.

I'm not saying you should go for ultra efficiency, but you're really wasting your batteries energy here.

I know I type a lot, but if you could answer some questions I'll shut up Unless its all a bit hush hush, in which case we can only guide.

1) HV caps target voltage. (90V?)
2) HV caps capacitance.
3) How often will the solenoid be triggered? is it an auto thing like 10 times a second? or a one shot affair, with 5-10 second charge time, and a single 'pulse' ?
4) Do you know how many turns the solenoid has, its resistance, and/or its inductance (I know you probably don't know its inductance... and its not really necessary, but I'm curious!)

Such circuits are used in many area's, some I have mentioned, but also solenoid driven valves in some high performance motorbikes use cap discharge to speed up the intake/exhaust valves - as well as cap discharge ignition. The voltages/values/timings are all down to the final application as they can drastically affect the force of the solenoids output, and losses. I see that you're really after something that will take minimum current drain to get the job done, so you can use a small battery, that will last.
 
I've loaded a picture of my new, fifth board, and the early Walther board. Note the relay! The schematic I posted earlier was a later SMT Walther board. Multiple factory board designs has complicated my task.

I'm math savvy so I've used several calculation worksheets in this design.

I originally used a 14 pin PIC and varied the period and duty based on battery voltage. This went out the window because it was too complex. My third board used SMT components. Then I realized that design would limit my "market" so I reduced the pin count and went to simpler construction. My current board is even single sided with a few jumpers.

One test is worth a thousand expert opinions. So I have a set of batteries, in various states of discharge, that I can try for function.

If duty goes below 4usec, an 8 volt battery will not achieve full charge. At 2usec, I only get about 50 volts. I also note, that for any battery voltage the last few volts of charge are the slowest. Duhh, that confirms the charge curve.

Right now, it appears that the 6usec duty period appears reasonable. I don't want to go much above 7usec because the coil becomes saturated with a new battery. With my current settings none of the components show significant temperature rise.

This means lengthening the overall period, as you have suggested, appears the best way to go.

From a practical viewpoint, I want to use a fixed period/duty arrangement that will achieve the largest number of firing pulses. This may mean saturating the coil with a new battery in order to continue function at a lower, used battery voltage.


Thanks for the feedback
 

Attachments

  • Balloon 001.jpg
    716.1 KB · Views: 205
Looking good!

And yes, a fixed period, with fixed duty cycle (basically, fixed on period, fixed off period) would give constant power draw from the battery over the charging time. So ultimately, its not really PWM since there's not modulation

Here's the deal. With a 6us on time, your inductors current gets to 0.54A as stated. Remember though, that current is coming form the battery - and a 9V PP3 (if thats what you're using) really doesn't like anything over 200mA. Even though the input waveform will be smoothed by an input capacitor, you'll need a fairly large one. So instead of drawing 500mA very quickly, then a big pause (long off time) then drawing the 500mA again, it would be more prudent to reduce the peak current in the inductor, to say 200mA, and reduce the pause. With the 100uH value, and a power supply of 8-9V, thats going to be <2uSec. And you've mentioned that takes a long time to charge. The lower limit for the ON time comes from your PIC, since it can only run so fast, the minimum on time is 4/Fosc. And with Fosc =4MHz, the minimum on time is 1uS. Changing it to 2uS doesn't really give you much variation.

Only way to slow down the current rise (so you can have a longer on-time, without drawing more power) in the inductor is to either: lower supply voltage (use 6V instead of 9V), or raise the inductance to say 200uH, or 330uH. You can reduce the peak current, but also reduce the off time.

As you said you were maths savvy, I'm assuming you have these equations.

Energy in a capacitor (joules) = 0.5 * C(capacitance) * V^2
Energy(J) = Power(W) x Time(s)

So plug in your desired charging voltage, and the capacitance and thats the energy storage. Then divide that by your desired charging time and thats the average 'power' you're putting into it over the charging cycle. For a 10 second charging time, a 100uF cap to 90V really doesn't draw much current from a 9V battery (5mA for 100% efficiency, only 10mA for 50% efficiency). Of course I'm assuming the capacitor is larger than that Of course, thats the average current draw from the battery, it'll actaully be large current spikes followed by nothing - the point I'm trying to make is, you want to reduce these spikes, but make them more frequent, and the only real way to do that, is use a larger value inductor.

One more idea: (EDIT: I just read that you've tried this already....left it here anyway)
Use your PIC to measure the battery voltage, so it can change the ON time accordingly (increasing duty cycle of PWM). A lower battery voltage, will result in a lower peak current in the inductor, so with a fixed period, you're dumping less energy per cycle into the cap. Increasing the ON time as the battery voltage drops, will compensate to some extent, and make sure it reaches the same peak current - but still the best approach is current sensing

You still didn't answer my questions btw Although I understand if you wish to market this, you don't want to give away absolutely everything.
 
Last edited:
Blueteeth: Good points! Keep talking. Our postings are crossing each other.

I really looked past the power costs in the voltage divider. The PIC has a recommended comparator input impedance of 10K so I can increase the divider component values significantly

In competition there is a two hour window in which 60 shots for score must be fired. This can be preceded with practice shots. Once “shots for score” begin, all shots count.

So 45 seconds to a minute between shots is a reasonable estimate. Few competitors go the full two hours. Even with much larger voltage divider components there may not be much charge left in the capacitor after 45 seconds. This assumes my current strategy of turning off the switcher when the trigger is pulled.

I wonder if leaving the switcher on might contribute to more shots/battery if it saves the remaining capacitor energy.

The solenoid coil consists of about 726 turns of #29 wire. Open air inductance is estimated at 6700uh, with DC resistance of 4.7 ohms. It is .675 inches wide with a .508 inner core diameter and a .790 outer coil diameter. The firing pin is about .50 diameter. It is designed as a “pull in” action with a stroke of about 1/8th inch. The firing pin contact point is a dome with a diameter of .052 inches.

The factory uses a firing voltage of 90 volts. My test board delivers a light “click” at 60 volts and a full power impact at 100 volts. This is with a 101uf measured capacitor taken from a photoflash unit. So the impact power is non-linear with respect voltage change.

I haven’t yet tested to see what voltage/firing pulse length is minimally required. I have to be conservative because different ammunition brands have different primer impact requirements.

My software can vary the length of the firing pin pulse. I don’t need a pulse more than about 90 milliseconds to deliver the required energy to fire.
 
Oh wow, you've really thought out the triggering part eh?!

I'll confess, I think I'm a bit out of my depth when it comes to calculating force from a solenoid, but I will simulate the current waveforms of the solenoid in LTspice anyway and see what happens. The reason I've been typing so much (sorry btw..) is mainly for the charging circuit. I've designed a number of low voltage (3-15V) to high voltage (100-800V) capacitor charging circuits for various apps, and it is a nice feature to have constant current draw from a power supply. Many schems/designs on the internet rely on a fixed power supply voltage, and component limits meaning the charge time and efficiency vary greatly - handy for a quick and dirty approach, but not very elegant and often try to charge up a cap as quickly as possible.

Ok, so here's my understanding of the specs of what you require from this charging circuit (note, I'm not talking about the triggering specifications like pulse width.. sounds like you have that in the bag!)

- 45 seconds MAX charging time. Assuming worst case battery voltage of 7V and the charger constantly being 'on' between shots.
- 100uF HV cap charged to 90V or 60V - final charged voltage configurable via the PIC (maybe a pot to an ADC to set it?)
- 50K resistance from HV cap to GND, used as a voltage divider to monitor cap voltage for the PIC.
- Power supply is a 9V battery, with a variation of say 9.6V max, and 7V when fully depleted.

Ideally, current draw from the battery should be steady (no massive current spikes), and as low as possible (for efficiency/batt life). So obviously that means not charging the cap at full blast within 1.5 seconds, then waiting 30-45 seconds before its actually discharged (when the trigger is pulled). With a 50K (47K + 1K) voltage divider to monitor cap voltage, it'll discharge through that 'fairly' quickly anyway (RC time constant RC = 100uF * 50K = 5 seconds, 60% of cap voltage lost in 5 seconds..)

My suggestions:
1. Use a larger inductance, but with a lower peak current. So say a 330uF inductor, but only rated at 0.4A - doesn't have to be physically bigger. This will give you more control over peak current, since it'll rise slower, meaning your PIC can vary the on time from 1uS (peak current = I = Vt/L = 27mA) to say 20us (Ipeak = 545mA). It'll give you more room for experimentation, so you can adjust it accordingly - either to compensate for battery drain, or just to optimize it in field testing.

2. Pick an off period so that the capacitor can fully charge within the minimum time required. You said 45 seconds, but maybe for room for error you might want it to fully charge within say 20 seconds? This means you won't have to wiat the full 45 seconds, but also means that it'll draw more current (charges quicker) and that the cap will need 'topping up' because every 5 seconds you're not charging it - it'll be discharging via your resistive divider. which leads me to....

2a. Even though its an extra chip, you could buffer your voltage divider with an opamp voltage follower. An LM358 will provide the lower input impedance to the PIC, draw little power, but with a massive input impedance meaning your voltage divider can be 10x its value (470K instead of 47k). This will greatly slow down the natural discharge of the cap when its idle.

2b. I would up the value of the resistive divider anyway - without an opamp. The input impedance specs of the PIC's comparator is for optimum speed. That is detecting voltage changes in the uS range. As your cap is charging over a period of many seconds, the difference in input impedance just means the comparator will take a few mS to trip. So your cap will 'over charge' by a tiny amount. Its less accurate, but also less wasteful

3. Perhaps using a clever bit of software, use the ADC of your PIC to directly measure the voltage from the resistive divider. Or perhaps change the comparators reference so you can detect when its over a certain voltage. So if your battery's voltage is sagging, and its taking longer to charge, you can periodically check if the caps voltage is at a point where it should be during a charge cycle. Say you check it every 200ms. If its lower than it should be at that time, then you can reduce your 'off period' so it charges quicker. Essentially, speeding up (or slowing down) the charging so its guaranteed to reach its desired voltage after a certain time. This is a crude but effective way of compensating for battery voltage variation.

3b. Related to above. If you spend 10-20 charging it, but don't fire for 45 seconds, then even with a high resistance voltage divider, the caps voltage will still droop. So using the above 'checking every 200ms' you can determine when to top it up, by turning the charging PWM back on until its voltage is reached, then turning it off again. Ultimately, from a cold start (cap = 0V) it'll do a full charge. to 90V..wait until the caps voltage has dropped below say 80V (be it because you've pulled the trigger discharging the cap, or just left it) it'll start charging again.

4. Probably should have been #2 but I'm still going with it. Use a low peak current for the inductor, say I dunno, 100- 200mA. So your PWM period is shorter (fixed on time for the peak current, but shorter off time). It'll reduce resistive losses in the inductor, reduce the strain on the battery, but it will mean a higher switching frequency which increasing losses in turning your MOSFET on and off. Its all a balance. As you've realised (me too in fact) its very easy to charge caps as quickly as possible, but difficult to slow the process down without losses.

I was dubious about the use of a microcontroller. But I see it gives you great control over all the timings and voltages - very handy not only for development, but also in-system changes, like modifying the pulse voltage to change the power of the solenoids firing pin. The downside being, software development, and the fact micro's are rather slow in switched mode power supply control loops. But as you're not trying to charge the cap in 100mS, or using a switching frequency of >50kHz, its more than fast enough to monitor things and make adjustments. In fact you've inspired me to try this myself!
 
This project is going open source. I have a very limited audience and I don't want to deal with liability. The original users of the Walther pistol were disciplined, professional shooters, operating within a very structured shooting range protocol. My design has emphasized methods that might be used by someone has little experience with circuit board construction, who needs to replace a dead board, of which there are many.

I simulated the SMPS using LTspice and a 330uh coil reduces the current to about 100ma, but after a 1millisecond period of over 2 amps. I'm using the MuRata 200R series inductors so I can get a 330uh coil rated for 0.38 amps in the same dimensions. I can even go larger inductance.

I'll replace the voltage divider with 470K and 12K. But, as noted, the cap discharge curve still leaves it flat before the next charging cycle starts. I don't have room for the opamp and I want to see if I get reliable operation with just changing the divider.

I need to give some thought to use a window of charge level, within which the switcher is turned off.

The comparator is used to control the switcher. I'm using the internal voltage reference which provides 16 steps, each representing about 6 volts of variation. It would be possible to increment through the steps to see where the stepper turns off and use this state change to control charging. But the step voltage range is pretty broad.

Originally, I wasn't using the built in 10-bit AD. My early trigger test suggested the open/pulled voltage variation met logic standards. But after building the current test board I found an open trigger voltage of 0.78 and closed at 1.47 volts. So I test the state of the 9th bit in the AD. (It sets at 1.25 volts on a 5.00Vdd, which is its reference.) If it is clear the trigger is open. If it is set, the trigger is pulled.

If I build another board I'd reverse comparator and AD functions: comparator for trigger and AD for charging control.

The PIC runs on 4mhz internal clock so each instruction takes 1usec. The PWM runs in the background so I just command it on or off by setting one byte.

The AD reads the current voltage input and then takes about 24usec to load the output registers. I run the AD in continuous mode. After turning it on it takes several usecs to charge up the sensing capacitor, after which it seems to follow voltage changes in a timely manner.

This Microchip Application Note describes my methods:

**broken link removed**

This Instructables took the Note ideas and based calculations on a chosen inductor. It includes some good spreadsheets:

**broken link removed**
 
Hi again,

That microchip app note is one I have viewed a few times myself Its for constant voltage output, so they use PWM to maintain the voltage when the load varies in current draw. Your application is a bit different as you're not after a constant voltage - the capacitor determines the output voltage, the inductor just pumps current into it in pulses. They also try to keep the inductors current non-zero, so its current ripple is as small as it can be giving a nice clean DC output - you don't need that at all. So even though the equations for inductance and current are all the same, the idea of 'duty cycle' based on voltage in and out doesn't mean anything in this app (but mandatory for a step up DC power supply).

Good call on designing it so that less experienced folks can build - that can be a tough spec to meet, but for the few 'open source' things I've done, as you said, its prudent to go with a simpler layout, and perhaps less than ideal parts that are much more readily available. (no special linear tech IC's, or magic mosfets with an RDSon of 5miliohms).


An inductor of 0.38A is fine, if you keep far away from saturation (say an Ipeak of 0.2A) and a higher inductance might even be better. This slows the switching frequency down, again giving you more 'resolution' to work with.

I too simulated the discharge of the cap via a 470k+10K divider - its a big loss of energy which if its a problem has a few solutions (aside from using an opamp, which you said cannot fit on the board - understandable).
1. Slow the charging even further to give the minimum time between 'end of charging' and 'firing'. Minimizing idle time.
2. Use a PNP transistor to switch the top of the voltage divider to the cap's V+. It'll need an NPN to switch this on (level shifting) as well as another I/O to control it. Also of course, you would have to turn this on every time you need to check the capacitors voltage. But... the (only) advantage being, when not turned on, the capacitor will sit at its charged voltage, and can only discharge via the PNP's and diodes, leakage current, which is nA.
3. (possibly), attach the voltage divider to the anode of the diode. When the mosfet turns off, the voltage on the diodes anode shoots up until the diode is forward biased, when it conducts, and goes to the caps voltage + 0.6V (diodes forward voltage). If you're using a comparator to check for the caps voltage, it will trip, but as its fluctuating from HV to GND (~0V when the mosfet is on) it has to remain high long enough to trip the comparator - and that length of time is how long the inductor takes to discharge its current to the cap. Even for 10uS that should be more than enough to toggle it. This completely removes the resistance across the cap, but means if you wish to discharge it for safety purposes, you'll still have to use that 1K to do so.

An ADC is great as you get resolution, but also means you have to constantly sample, so its significantly slower at detecting voltages (as you know). But switching the ADC and comparator for voltage control and trigger sounds good. I suggested an ADC at first because I thought (wrongly) that the pin you used had both those functions - which would mean software change, rather than hardware. Also, agian as you've noted, the input impedance of the ADC has to be low (<10k) in order to get relatively accurate results when sampling continuously.

Considering you're using constant on/off times, your ADC is just looking at a slow rising voltage, so its not actually in the main control loop, and so speed isn't of paramount importance.

I guess you've got a lot of testing to do Once again, sorry for typing so much. I tend to just flood idea's out, never really knowing what level people are at, so if I came across as patronizing, apologies. That and I don't seem to be able to explain my idea's very well without writing a book....
 
Last edited:
As you know that the capacitor can only charge slowly, there is no need to have a fast response time on the ADC. You can increase the potential divider resistance to way beyond 10 kohms if you put a large enough capacitor directly on the ADC input of the PIC.

If you use an 0.1 uF capacitor, that will basically provide enough charge for the ADC. The resistance of the potential divider then only needs to be low enough that the voltage on the 0.1 uF capacitor doesn't lag the storage capacitor too much. You could certainly have 1 Mohm resistors. In fact leakage could become a problem. The time constant will be less than 0.1 s which is pretty quick compared to the charging.

The circuit that has a 47 kohm in the divider will have a time constant of 5 second for discharging the 100 uF capacitor. That means that it will loose as much charge in 5 seconds as is in the capacitor. If you go to a 1 Mohm resistor, the time constant is 100 seconds.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…