Searching \ for '[EE]: [PIC]: AC Voltage Compensation' in subject line. ()
Help us get a faster server
FAQ page: massmind.org/techref/power.htm?key=voltage
Search entire site for: '[PIC]: AC Voltage Compensation'.

Exact match. Not showing close matches.
'[EE]: [PIC]: AC Voltage Compensation'
2001\05\02@150841 by

Well, a simple description of the application is that I want to calculate the
triac firing angle (time delay after ZC), based on the incoming line voltage
(for an open looped system), so that I get "X" amount of RMS volts going out.
The PID version of this would be to initially "guesstimate" the firing angle
(first time only), measure the SCR waveform output, and adjust the firing angle
on a per cycle basis until it settles to the correct output voltage.

Here are a list of the variables that the device has to deal with:
1:  Incoming or outgoing line voltage (varys in magnitude and shape)
2:  Desired user selected power level (scale is 0 to 99, or 10vRMS to 90vRMS)
3:  User selectable load (goes to when the triac will shut off).
4.  50 or 60hz input voltage (maybe, otherwise I'll have to make a slightly
different circuit for each freq.)

Yep, I thought that a non-sinusoidal waveform would be a problem with doing open
loop in this manner.  That situation wouldn't happen often, but I don't want the
device to "throw up" if it does happen (happy to work on anything but a square
wave).  That and I've heard that most AC lines are perfectly sinusoidal per se
any ways (noise, etc).  Also, if that inverse table (taking the place of that
transcendental math) doesn't scale linearly with line voltage variations, it's
pretty much useless then (that's the whole point of this circuit).  Keep in mind
that the output power level is also user selectable (variable).  This is what is
stumped me on using this open loop table method, in that in order to make it
scale linearly, I'd have to have 100 different tables, one for each user
setting, and/or make a bunch of tables for several possible incoming line
voltages.

Hmm, I just thought of another "wrinkle" on the open loop method that would also
cause problems, the load itself.  The circuit is supplying voltage to a
transformer (inductive), and the transformer will have a "user selected"
resistive load attached to it's secondaries (which can vary how much current is
drawn, which would vary the phase angle, which then causes the triac shut off
time to vary depending on the load).

Which brings me back to looking at the SCR output again, and doing PID control.
Which has the problem of either the ADC not being fast enough to accurately read
the 1us rise times of the SCR turn on, or I'll have to stretch out the waveform
causing it to have a bunch of lag time introduced.

Is there a way to "filter" or modify that SCR waveform with an opamp (or
something), but so that it doesn't induce much lag into it (rounds the SCR
waveform spike out linearly, rather than just stretching it out, or clipping off
voltage data)???  Even a 4 or 5 cycle lag wouldn't be too bad, but 7/10ths to 1
second is way too much (because when you add that up with the PID control
settling lag, it could add up to something like 3 to 5 seconds of total reaction
time, which IS too slow for this application).  I'm shooting for under 2 seconds
of total reaction settling time.

triac firing angle?  The only drawback on that one (that I can see), is that the
transformer is inductive.  So it won't shut off at voltage ZC, but a bit
afterwards at current ZC instead (which can vary).  I'll have to look at typical
triac shut off characteristics on an inductive load to know how fast that
happens (I'm thinking it's a bit slower than rise times), but it should
typically go from something like 20~30 volts to zero (worst case) which is a lot
less bandwidth error than going from 0 to 170 in 1us (90 degree firing angle of
a 120rms ac voltage).  I could maybe get around that looking at the voltage on
the output side of the transformer instead (everything is in phase there).  But
that's kind of a hassle, as far as design and manufacturing the circuit goes.

Heh, I'm starting to feel like a dog chasing it's tail ;-).

Regards,
Bob

<<Snip>>
>I don't have code or examples. But here's an explanation that may simplify the
>concept. Separate for the moment, the incoming peak sinusoidal voltage and the
>SCR firing angle. Imagine you had a look up table that took as its input the
SCR
>firing angle and produced at its output the RMS voltage for a 1 volt sine
>wave. This is easy to produce. If you wanted to scale it up to higher voltage
>then the only "computation" required is multiplication.
>
>  rms_voltage = Vline * table[firing_angle]
>
>Inverting this table is where the transcendental math enters. You could create
>the inverse table (i.e. input to the table is the line voltage and the output
is
>firing angle), but it doesn't scale linearly with changes in line voltage.
>
>However, it's straight forward to servo the firing angle to achieve the
>desired voltage.
>
>Presumably you have a desired RMS output. A simple PID controller could monitor
>the incoming RMS voltage, calculate the outgoing SCR RMS voltage (based on the
>current firing angle), and vary the firing angle on a cycle-by-cycle basis
based
>on how much the calculated output differs from the desired (and how long it's
>been that way if you want the "integrator" portion of PID).

Um, according to this, I'd have to look at "both" the incoming line voltage, AND
the SCR output voltage.  Which begs the question:  Why not do just straight PID
control based on just the output then?

>
>I'm tacitly assuming that the input IS sinusoidal. If it's not, then this
method
>will not work.
>
>(Also, after re-reading your message, I think I have the input and outputs
>reversed... But whether you're measuring firing angle or generating it, the
same
{Quote hidden}

--

Bob <op1cwkflashmail.com> wrote...

>Heh, I'm starting to feel like a dog chasing it's tail ;-).

In one of his responses to you earlier in this thread, Olin Lathrop
suggested that perhaps you should go back to the original design
problem and start over from scratch.

I think you should take his advice to heart; 35 years of doing this
stuff for food tells me that the approach you're taking is **WAY**
more complicated than the ultimate design goal would warrant.

From your various posts, I've gathered that you have a heating
element- a short length of heavy nichrome wire- and you want to
deliver power to that heating element which is (a) user-adjustable,
(b) constant against both short-term and long-term AC line voltage
variations, and (c) protected against short circuits.  At full power,
your heating element takes roughly 2 volts at 20 amps.  It is
connected to your circuit through a pair of heavy-duty plug-in
terminals and about 4 feet of #16 or #18 wire cable.

understanding could be incomplete or faulty- then this is a job for a
switching-type voltage regulator, not a PIC.
Sure, a PIC would be appropriate for user interface (via a keypad and
some LEDs or a small numeric display, perhaps?), but the "heavy
lifting" of dealing with your heating element is a job for a
well-designed voltage regulator.  Use the PIC's PWM output as a DAC to
set the setpoint of the switcher, and let it do all the hard work.

Admittedly, switcher design is not trivial; but it's not rocket
science, either: the makers of switching regulator chips (Maxim,
National Semiconductor, and Linear Technology, to name a few) have
boiled the design procedure down to a set of cookbook calculations and
choices over a broad range of cases.  (Linear Technology has also
published many very good application notes on switching regulator
are AN54, "Power Conversion from Milliamps to Amps at Ultra-High
Efficiency (Up to 95%)" and AN25, "Switching Regulators for Poets".)

A switching regulator designed with a reasonable amount of care should
give you a VERY constant load voltage; sharp current limiting to
protect you in fault conditions; and much, much, MUCH better immunity
from line-voltage fluctuations than you'd ever be able to achieve by
the roundabout methods discussed so far.

Dave

--

Well, I've gone over the reasons of why I don't think using a mosfet/hexfet type
of device after the transformer probably won't work as well, but here it is
again.

To give you an idea of how many amperes are coming out of the secondary of the
transformer....   The transformer secondary is TWO parallel wound 14 gauge wires
on "each pole".  The wire going from the secondary to the jack is solid 14 gauge
copper wire on each pole (and it can even get warm under heavy usage, and
downright hot during a short circuit near the jack).  Under "normal" operation,
with a 16 gauge cord attached, it can flow upwards of 15 to 16 amperes.  Under
short circuit fault conditions, I would guesstimate that it flows upwards of 30
to 40 amperes (I am unable to measure that high of an amperage, it goes off the
scale on my 20 amp meter running at only 1/2 of its full power potential).

Now, "the" golden design rule for this particular type of low voltage, high
amperage device is that you absolutely, under no circumstances, put any type of
intentional amperage bottleneck between the transformer and the load (a short
nichrome 18g wire, nearly dead short).  I've seen many poorly made devices of
this sort that do that, and they have a very limited performance aspect because
of it.  This is because the heating element derives it's "heat recovery" (how
fast it reheats to temp if cooled down by an external force) from the free
flowing of amperage being supplied to it (insert a bottleneck, kill the heat
recovery).  Because your using a very weak electromotive force on the outputs
(0.3 volts to 2.0 volts max), it doesn't take very much to cause an amperage
bottleneck.  Okay then, you could up the output voltage scale to get more
"power" to the heating element, right?  Wrong, everything starts to heat up
then, bottlenecks heat up exponentially!

That being said, aren't the leads on these types of switching devices a bit on
the skimpy side?  Definitely not 14 gauge solid copper posts, at least I've
never seen one like that.  Okay, I could put four or five of them in parallel
(hexfet's presumably), but then I have to dump the heat each of those little
micro switches produce somewhere (I prefer using plastic enclosures, for several
manufacturing reasons).  Now the fact that each switcher produces more than just
a little bit of heat during operation, that throws in yet another wrinkle.  As
each power device heats up, and even if the heatsink doesn't become saturated,
you've just introduced "another amperage bottleneck" (and a variable one at
that).  Just as running high amperage through a thin wire heats it up,
conversely, heating even a thick wire will cause it to flow less amperage.
i.e., if the switcher(s) produces heat, they are an inherent amperage
bottleneck.   Unless you know of a switcher (or switcher configuration) that can
handle that kind of amperage, and still produces little or no heat, I can't see
that it would work decently.

I won't even get into how wide and thick the traces on the PCB that the
switcher(s) are on would have to be, or the headache of having to solder fill
them all.  Or the fact that this type of transformer tends to heat up (a lot of
coupled capacitance there) if left on at full input voltage with no load
attached.

Are you starting to see the vicious little circle that you get into when you try
to regulate it on the output side?  Yea, it's definitely easier to regulate the
voltage that way, but it causes severe amperage performance problems (which is
unacceptable), heat problems, and probably up's the component  and manufacturing
costs dramatically.  I am very familiar with this particular application (10
years now) using a simple analog phase control circuit to control it, and know
all the pitfalls/bottlenecks that can be potentially be introduced after the
transformer.  I have seen an analog version of a voltage compensation circuit on
a very similar device (phase control, done on the primaries side), so I know it
can be done this way.  It's just a matter of how it can be done best with a PIC,
digitally phase controlling it.

{Original Message removed}
Bob <op1cwkflashmail.com> wrote...

[snip]

>I am very familiar with this particular application (10
>years now) using a simple analog phase control circuit to control it, and know
>all the pitfalls/bottlenecks that can be potentially be introduced after the
>transformer...

You appear to be thinking that I was talking about something that
would operate off the two-volt output winding of your transformer, and
regulate the voltage to the load.  I wasn't proposing that: I was
talking about a technique which ELIMINATES that transformer.

Buck-type switching regulators, which is what I was referring to in my
previous post, take in DC power at a relatively high voltage (12 to 24
volts is common) and low current, and output a lower voltage at
correspondingly higher current.  The design of such a device to put
out 0-2 Volts at 20 Amps or so, with current limiting and a conversion
efficiency of 80% or more, would not be at all difficult for anyone
who has designed switchers before.

The references I suggested to you, as well as other appnotes on the
Linear Technology website, contain many examples very similar to what
you need; I really recommend you read them.

Dave

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Okay, admittedly I don't know much about switching power supplies, most that
I've ever seen are inside computers (large, bulky, heavily shielded, and need
cooling).

Question, don't high power switching supplies like this (5 to 40~50 watts of
output) pretty much have to be heavily shielded to meet FCC requirements?  Or
can I get around that by staying under 9khz?  Would that 4 foot cord going to
the load have to be shielded too (ergonomically, it's already pretty darned
bulky)?  Obviously, the output would also have to be totally isolated from the
AC line.

A big concern is cost.  If you take out the cost of the digital circuitry (which
both methods would have), how do the basic components that make up a switching
regulator of this sort compare to basic guts of a phase control circuit
(basically a triac \$0.89, opto coupler \$0.35, some resistors <\$0.10, and a
capacitor \$0.28)?  My current transformer cost is around \$5.50 to \$5.75 (120 &
240v capable).  This assumes that I wouldn't need any shielding (as I don't
now).

I want to limit current, "only" when it is excessive for more than a few pulses
(an average, something like excessive for one second), and be able to relay that
information to the user by displaying an error code on the numeric LED display
(like "OC", which works on a numeric display) and also totally shutting down the
output supply at the same time.

Did you have any particular circuit(s) in mind, that I should look at in those
app notes you mentioned?  Maybe something that can be easily adapted for what I
want to do (low voltage variable output at >15 amps).

{Original Message removed}
At 11:06 AM 5/3/01 -0500, Bob wrote:
>Okay, admittedly I don't know much about switching power supplies, most that
>I've ever seen are inside computers (large, bulky, heavily shielded, and need
>cooling).

Imagine how large they'd be as linear supplies.

>Question, don't high power switching supplies like this (5 to 40~50 watts of
>output) pretty much have to be heavily shielded to meet FCC requirements?  Or
>can I get around that by staying under 9khz?  Would that 4 foot cord going to
>the load have to be shielded too (ergonomically, it's already pretty darned
>bulky)?  Obviously, the output would also have to be totally isolated from the
>AC line.

They have to be designed properly, and the PCB layout has to be right.
I've never had to apply shielding to a switcher to pass part 15.

9kHz magnetics would be pretty large, and you'd be dealing with a lot more
ripple current in your output caps.
I don't think this is going to get you out of testing though. The 9kHz
number is for digital devices using that as the max clock.   In addition to
radiated signal, there's also a test for noise up the AC line.

Thing is though, if you design and construct properly, then you're moving
all your current in physically small loops, and returning the current to
it's source, not somewhere else, so you don't have a significant amount of

You only have to shield cables that are carrying RF current.  If your
switcher design is right, there isn't any significant RF current getting
off the board. This takes some careful work on the output filters, but you
only pay for design work once :)

>A big concern is cost.  If you take out the cost of the digital circuitry
>(which
>both methods would have), how do the basic components that make up a switching
>regulator of this sort compare to basic guts of a phase control circuit
>(basically a triac \$0.89, opto coupler \$0.35, some resistors <\$0.10, and a
>capacitor \$0.28)?  My current transformer cost is around \$5.50 to \$5.75 (120 &
>240v capable).  This assumes that I wouldn't need any shielding (as I don't
>now).

What is it that you're doing with this stuff?
This sounds like maybe a battery charger?

--
Dave's Engineering Page: http://www.dvanhorn.org
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Bob wrote:
>
> Okay, admittedly I don't know much about switching power supplies, most that
> I've ever seen are inside computers (large, bulky, heavily shielded, and need
> cooling).

> A big concern is cost.  If you take out the cost of the digital circuitry (which
> both methods would have), how do the basic components that make up a switching
> regulator of this sort compare to basic guts of a phase control circuit
> (basically a triac \$0.89, opto coupler \$0.35, some resistors <\$0.10, and a
> capacitor \$0.28)?  My current transformer cost is around \$5.50 to \$5.75 (120 &
> 240v capable).  This assumes that I wouldn't need any shielding (as I don't
> now).

Bob, your triac/transformer system is fine, I just
agree that maybe you are basing the closed loop feedback
on the wrong sensor.

Have you considered measuring average current in the
secondary? This is what will control the heat in your
element, it's easy to measure and removes all the
nasty calcs you are trying to do on the primary side.
Just a simple feedback loop to adjust and regulate
secondary connections, secondary faults (shorts) and
any mains variances. That's how I would be doing it.
:o)
-Roman

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Imho you are trying it backwards. As someone else suggested a switching
PSU will handle your heater fine. You can even avoid running heavy gauge
wires by using a two-transformer design with the second being a small
autotransformer near the heater. Your max power is 2V @ 30A -> only 60W.
Did I get this right ? Even four times as much is not a serious problem.

You can build a switcher using very few parts and a standard core for this
power. It will likely be smaller than a computer psu. You do not need to
rectify the output from the switcher. Switchers are short proof (if so
designed). I think that you could take a computer switcher and modify it
for a one off. Take your output voltage from before the 5V rectifiers and
use short wires, then modify the control circuits.

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Bob <op1cwkflashmail.com> wrote...

[snip]

>A big concern is cost.

Ah, OK.  Back to the drawing board...

>If you take out the cost of the digital circuitry (which
>both methods would have), how do the basic components that make up a switching
>regulator of this sort compare to basic guts of a phase control circuit
>(basically a triac \$0.89, opto coupler \$0.35, some resistors <\$0.10, and a
>capacitor \$0.28)?  My current transformer cost is around \$5.50 to \$5.75 (120 &
>240v capable).

A switching regulator is going to be significantly more than that:
several dollars each for the switching regulator chip, the power
MOSFETs, low-ESR filter caps, and most especially the inductor.

The main advantages of the switcher are its precise regulation against
both line and load variations, its high efficiency, and its behavior
during current limiting (when done right, power consumption drops to a
very low level when the output is shorted; after all, 0V x 20A = 0
watts).  These come at a cost, though, as the components would be more
expensive than the triac-related stuff you listed.

Take your pick: if the performance of a switching regulator would be
worth the extra bucks, do it that way; you'll get excellent results.
If not, it's back to the PIC and some sort of sensing scheme, as we've
been discussing.

Here's an idea.  What better way to sense the power being delivered to
a hot wire heating element than with another hot wire?

Connect a small light bulb (like the bulb out of a two-cell
flashlight) across your 2V heater output at the transformer secondary.

Position the light bulb so it shines on a cadmium-sulfide photocell.

Connect the photocell and a fixed resistor (you'll have to experiment
to find a good value to use, or use an adjustable resistor) as a
voltage divider between your PIC's +5V supply and ground, with the
photocell at the +5V end.
Connect the photocell/resistor junction to one of the PIC's A/D
converter inputs, and you're in business.

Here's how it works:

The more RMS voltage that's delivered to your heater load, the more
light the lamp puts out (and they both respond to RMS, by the way,
without regard to the waveform).  As the lamp brightens, the
resistance of the CdS photocell drops.  As the photocell resistance
goes down, the voltage at your PIC's A/D input goes up.  The PIC
measures this voltage and compares the reading with the value it knows
it "should" be reading for the selected power level, and adjusts the
triac firing angle accordingly.  As to how often to do the A/D
conversion, once per line cycle would suffice; no need for high sample
rates here.  You could do it on an interrupt triggered at the line
zero crossings.

I think that's about as cheap as it can be made, Bob: a flashlight
bulb, a CdS cell, and a resistor.

Dave

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

Yea, that was I kinda thought after I looked up prices forsome of those
components.

load output (sounds pretty "Rube Goldberg'ish" to me).

ADC timer to take a sample 20us after the triac is turned on seems like a pretty
good idea.  As long as the triac turn on times don't vary much, I should get
pretty accurate readings.  I'm still looking around for that waveform of a triac
turning off that drives and inductive load (to see how fast they turn off).

Heh, reminds me of when I used to go up to my old programming instructor, ask
him a question, and then say "never mind, I just figured it out" ;-).

{Original Message removed}

Um, you measure the current half cycle RMS waveform, so that you can adjust your
triac firing on the following half cycles (it's called PID control).  I'm not
looking for "instantaneous" control, or 100% perfect control, just "reasonably"
fast, accurate, and cheap.

I did some experiments earlier today, and found that I need to have a "total"
system reaction time of at least one second or less to make on the fly AC
voltage regulation worthwhile, 1/2 second would even be better.  To give you an
idea, some of these little elements can heat up from ambient room temp, to
2000F, within five seconds.....

{Original Message removed}

sense
> load output (sounds pretty "Rube Goldberg'ish" to me).

I thought his lightbulb idea was brilliant.

Incandescent bulbs respond to the RMS voltage applied to them, and you get
the information transmitted from the secondary to the primary with isolation
for free.  Just make sure you run the bulb somewhat below its rated voltage.
The lifetime of these bulbs is inversely proportional to something like the
12th power of the voltage.  You want to run it just above where it starts
producing visible light.  It might be a good idea to use a near IR
photodetector.  There are many of these available for detecting the output
of IR LEDs.  The light output of the bulb will be very non-linear with
respect to the average RMS input voltage, but that should be fine if you are
regulating to a predetermined set point.

A lot of people have made suggestions in responses to your various posts on
this topic, but you dismiss them all out of hand.  You seem to be stuck with
a particular notion of how this should be done, and anything that doesn't
match that is no good.  That's your business, but don't waste everyone's
time asking for suggestions if you aren't actually open to new ones.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2001\05\04@085331 by
> I did some experiments earlier today, and found that I need to have a
"total"
> system reaction time of at least one second or less to make on the fly AC
> voltage regulation worthwhile, 1/2 second would even be better.

That's about what I expected since heating elements don't change that fast,
but it's good to know for sure.  This gives you plenty of opportunity to do
some filtering of the feedback signal and still damp the PID controller well
to eliminate hunting or other instability.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

On Fri, 4 May 2001 08:31:22 -0400 Olin Lathrop
<olin_piclistEMBEDINC.COM> writes:
{Quote hidden}

Brilliant Indeed!  Very punny! Anyway, I tried an analog regulator
circuit using a lightbulb and optodetector for feedback. I also liked the
RMS to DC conversion with isolation.  I was running proportional
feedback. As I increased the loop gain, the whole thing started
oscillating. I couldn't get tight enough control without oscillation. I
could've added an integrator to bring it in, but finally took a different
approach.
In my triac regulator, which has been discussed extensively on the list
already, I use a 16c716 to measure the full wave rectified voltage on the
isolated secondary of the power transformer (which as a 30V tap on the
primary which drives a triac driving a 250W 24V lamp). The FW recitifed
voltage is measured about 200 times each half cycle. Since the 16c716 is
controlling the triac (through an MOC3023), it "knows" whether the triac
is on or not, so we don't really need to measure the phase controlled AC.
Instead, if the triac is not supposed to be on, we throw out the A/D
reading. If the triac IS supposed to be on, we square the 8 bit A/D
sample to 16 bits and add it to a 24 bit accumulator. At the end of the
half cycle, we divide the 24 bit accumulator by the number of samples
(including those "thrown out", since they represent 0 volts samples) back
down to 16 bits, , then take the square root, back down to 8 bits. This
is compared with the desired RMS voltage. If the desired RMS is greater
than the measured/calculated, the compare register that is turning on the
triac is bumped down one count, turning on the triac earlier in the half
cycle. Otherwise, it is bumped up one count, turning on the triac later
in the half cycle. This results in pure integral control (no proportional
or derivative). It takes about 500ms for the lamp to come up to full
voltage. This is documented as a feature (soft turn-on) extending lamp
life.
The clever ideas that made this work are:

1. The transformer secondary voltage pretty much follows the primary tap
voltage that the load is connected to. This is especially the case with a
constant load (the lamp). Sampling the secondary saves us from other
parts to get an isolated sample.
2. The PIC knows when the triac is on, so we again don't have to sample
the actual waveform driving the lamp. Instead we just throw out samples
when the PIC says the triac should be off.

We've now shipped about 2,500 of these.
Thanks to PICLIST members for ideas on all this. I pulled code for the
24/8 divide and square root from the archives.

Harold

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

>         Brilliant Indeed!  Very punny! Anyway, I tried an analog regulator
> circuit using a lightbulb and optodetector for feedback. I also liked the
> RMS to DC conversion with isolation.  I was running proportional
> feedback. As I increased the loop gain, the whole thing started
> oscillating. I couldn't get tight enough control without oscillation.

Two sources of oscillation with the lightbulb approach is that the feedback
response is very non-linear with respect to the control output, and that the
light bulb has some lag.  I would think both these could be overcome by
sufficient damping and twiddling of other parameters in the PID control
loop.  Since the lightbulb's response is still faster than the heating
element under control, there should be room to slow down the over
corrections without cutting into the ultimate desired control response.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

Bob <op1cwkflashmail.com> wrote...

>bulb to sense load output (sounds pretty "Rube Goldberg'ish" to me).

"Rube Goldberg'ish"???  Jeepers creepers, Bob, that circuit has only
THREE flippin' parts in it, and they're all passives!!!  What's to not
understand?

Alright, let's make it simpler: I'm going to knock it down to TWO
parts for you.  Hang on to your hat, and read slowly and carefully.

As in my previous suggestion, connect a small light bulb across the
transformer winding that feeds your heater; select a lamp with a
voltage rating such that when your heater is at full power, the lamp
glows reasonably brightly (but, as Olin pointed out, not TOO bright or
the light bulb won't last very long).

Now, take a  small silicon photovoltaic cell (e.g., a "solar cell")
and connect the (-) wire to circuit ground at the PIC chip.  Connect
the (+) wire to one of the PIC's A/D converter inputs.  [Use of a
silicon photocell also addresses Olin's recommendation to use a sensor
with more infrared response- i.e., a better match to the lamp's
spectral output- and also gives you a component that'll be easier to
obtain than a CdS cell; those things aren't as widely available as
they once were.]

Position the photocell so that the light from your light bulb shines
on it, and you're good to go (except for programming, of course).

Any voltage fluctuation that makes your heater hotter will also make
the light bulb brighter.  This will make the voltage coming out of the
solar cell larger, and you can measure that voltage with the PIC's A/D
converter.  The rest of the job is in the PID control which will
adjust the triac's firing angle (as Hallikainen indicated in his post,
mere proportional control won't suffice to give you both precision and
stability; you'll need P, I and D to get good results).

You should keep in mind one shortcoming of this "World's Simplest
Implementation of the World's Most Complicated Voltage Regulator":
that solar cell won't be putting out much voltage, perhaps a half-volt
or so.

I'd suggest amplifying its output (gain of somewhere around five) so
the PIC's A/D converter has more signal to work with, but that'd bring
you up to six components (opamp, supply bypass cap and two resistors
in addition to the lamp and photocell) and we don't want THAT.  Plus,
you indicated earlier that opamps are still somewhat of a mystery to
you, so let's nix that idea.  Use as low a VREF for the A/D converter
as you can get away with, so you get the maximum resolution in
measuring the photocell's output.

So there it is, Bob.  Two components.  I can't make it any simpler.
If anyone else can, a doff of the hat to 'im.

BTW, who the heck is "Willis"?

Dave

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

On Fri, 4 May 2001, Dave Dilatush wrote:

> Bob <op1cwkflashmail.com> wrote...
>
> >bulb to sense load output (sounds pretty "Rube Goldberg'ish" to me).
>
> "Rube Goldberg'ish"???  Jeepers creepers, Bob, that circuit has only
> THREE flippin' parts in it, and they're all passives!!!  What's to not
> understand?
>
> Alright, let's make it simpler: I'm going to knock it down to TWO
> parts for you.  Hang on to your hat, and read slowly and carefully.

A "zero" part solution (the way you're counting parts) would be to glue the pic
directly to the heat source and configure it to run in "RC" mode. The internal
RC oscillator has a strong, but repeatable temperature coefficient - you only
need to calibrate it.

Not too practical perhaps, but it is fewer parts!

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

Its a very practical solution. See
http://www.piclist.com/techref/microchip/temp.htm

---
jamesnewtonpiclist.com 1-619-652-0593
PIC/PICList FAQ: http://www.piclist.com or .org

{Original Message removed}
Scott Dattalo <scottDATTALO.COM> wrote...

{Quote hidden}

Heh.  It'll have fewer still, after he powers it up for the first
time: the OP said these little heater tips of his get up to 2,000
degrees.

Dave

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

The lightbulb optocoupler cannot be used in a loop control that depends on
time because the time constant of the light output vs. voltage change in a
bulb also depends on the actual voltage applied. This means, that the time
constants in the loop (PID or PD) will have to be changed together with
this to compensate otherwise the Barkhausen conditions will be satisfied
(probably by phase margin) and the loop will oscillate.

The lightbulb oc. works well for diy rf milliwattmeters. Using bulbs for
LCD wristwatches in a self-compensating bridge (bulb power is about 50
mW) and Ri when lit is 50 OHms (!).

Peter

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

1.  It's non linear.  And I wonder just how much that curve changes from bulb to
bulb, and light sensor to light sensor?  And how much over time does it
change/drift from initial values?  I can't be reprogramming a new curve table
for every unit.
2.  It has to be calibrated.  Something I'm trying to get away from as much as
possible.
3.  Um, What Peter just said ;-).

If it were a PCB mounted solid state optocoupler (in a 4 pin dip), that had
really tight specs, I would think differently.  This setup probably works great
for a one unit project, but I can't see soldering a light bulb to the
secondaries and somehow mounting a light sensor a given distance away from it
(so it can't be moved by vibration/jarring after being built and calibrated) for
each and every unit I make.  Yes, I could probably board mount both components,
meaning I'd have a socket for the light bulb.  What happens if I run into a
batch of flaky sockets (bulb doesn't work, or changes output, when the unit is
jarred in shipping)?  I don't like putting anything together that isn't solidly
soldered and mounted onto a PCB (wire nuts are for people who don't know how to
solder ;-).

I got a buddy who was putting together a 15 to 20 part 555 PWM circuit, without
a circuit board, by soldering the component leads together, and then using hot
glue to keep them from moving around (and he was even shipping these as
commercial units).  Yea, it worked, but it's hardly something I would use in a
production environment.

Hey Harold (Hallikainen)!

Hi there.  I tried to get a hold of you the other day, but you were out at the
time.  I seen your post on this, but was wondering about one thing which
pertains to my original post.  Do you, or "how do you", deal with the 1us triac
rise times?  I.e.: there is a "possible" 20 to 41us of lost signal, right after
the triac is turned on.  Or is that loss so negligable, that it doesn't make
much of a difference?  What kind of accuracy are you getting?

Regards,
Bob

{Original Message removed}
I am sorry if I missed something, but why go to  the trouble of squaring and
square rooting?

-----Original Message-----
From: Harold M Hallikainen [haroldhallikainenJUNO.COM]
Sent: Friday, May 04, 2001 1:16 PM
To: PICLISTMITVMA.MIT.EDU
Subject: Re: [EE]: [PIC]: AC Voltage Compensation

On Fri, 4 May 2001 08:31:22 -0400 Olin Lathrop
<olin_piclistEMBEDINC.COM> writes:
{Quote hidden}

Brilliant Indeed!  Very punny! Anyway, I tried an analog regulator
circuit using a lightbulb and optodetector for feedback. I also liked the
RMS to DC conversion with isolation.  I was running proportional
feedback. As I increased the loop gain, the whole thing started
oscillating. I couldn't get tight enough control without oscillation. I
could've added an integrator to bring it in, but finally took a different
approach.
In my triac regulator, which has been discussed extensively on the
list
already, I use a 16c716 to measure the full wave rectified voltage on the
isolated secondary of the power transformer (which as a 30V tap on the
primary which drives a triac driving a 250W 24V lamp). The FW recitifed
voltage is measured about 200 times each half cycle. Since the 16c716 is
controlling the triac (through an MOC3023), it "knows" whether the triac
is on or not, so we don't really need to measure the phase controlled AC.
Instead, if the triac is not supposed to be on, we throw out the A/D
reading. If the triac IS supposed to be on, we square the 8 bit A/D
sample to 16 bits and add it to a 24 bit accumulator. At the end of the
half cycle, we divide the 24 bit accumulator by the number of samples
(including those "thrown out", since they represent 0 volts samples) back
down to 16 bits, , then take the square root, back down to 8 bits. This
is compared with the desired RMS voltage. If the desired RMS is greater
than the measured/calculated, the compare register that is turning on the
triac is bumped down one count, turning on the triac earlier in the half
cycle. Otherwise, it is bumped up one count, turning on the triac later
in the half cycle. This results in pure integral control (no proportional
or derivative). It takes about 500ms for the lamp to come up to full
voltage. This is documented as a feature (soft turn-on) extending lamp
life.
The clever ideas that made this work are:

1. The transformer secondary voltage pretty much follows the primary
tap
voltage that the load is connected to. This is especially the case with a
constant load (the lamp). Sampling the secondary saves us from other
parts to get an isolated sample.
2. The PIC knows when the triac is on, so we again don't have to
sample
the actual waveform driving the lamp. Instead we just throw out samples
when the PIC says the triac should be off.

We've now shipped about 2,500 of these.
Thanks to PICLIST members for ideas on all this. I pulled code for
the
24/8 divide and square root from the archives.

Harold

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

Bob <op1cwkflashmail.com> wrote...

>1.  It's non linear.  And I wonder just how much that curve
>changes from bulb to bulb, and light sensor to light sensor?
>And how much over time does it change/drift from initial
>values?  I can't be reprogramming a new curve table
>for every unit.

>2.  It has to be calibrated.  Something I'm trying to get
>away from as much as possible.

>3.  Um, What Peter just said ;-).

Oh, good grief...

Bob, have you considered the option of simply contacting a nearby
engineer, technician or experienced hobbyist and having him design
this thing **FOR** you?  Really- it'd save you a lot of needless
fretting and hand-wringing over trivial details and imaginary
problems.

This is NOT a difficult design task.  You should easily be able to
find some one who'll do it for the price of a case or two of their
favorite beer, and they can probably get the job done for you in a
couple of evenings or over a weekend.

If you don't want to do that, then I'd suggest you get busy and
**TRY** some of the many good suggestions that have been given to you
here on the PICLIST; most of them ought to work just fine, provided
they're implemented with a little bit of skill, knowledge and
inventiveness.

Best of luck with your project,

Dave

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservmitvma.mit.edu with SET PICList DIGEST in the body

> The lightbulb optocoupler cannot be used in a loop control that depends on
> time because the time constant of the light output vs. voltage change in a
> bulb also depends on the actual voltage applied. This means, that the time
> constants in the loop (PID or PD) will have to be changed together with
> this to compensate otherwise the Barkhausen conditions will be satisfied
> (probably by phase margin) and the loop will oscillate.

What you are saying is that the lightbulb to optocoupler is not a linear
system, which I totally agree with.  However, that doesn't mean it can't be
controlled with a PID controller.  The simple method is to set the damping
so that it still works with the worst case light bulb delay.  Another more
sophisticated approach would be to add some extra logic to the PID
controller.

I have a PID controller working very well in a product to control the speed
of a gasoline engine.  These engines are also far from linear systems.  The
response near idle is very different from the response near max speed, and
the throttle control is very non-linear with respect to no-load steady state
speed.  Also, the engine takes longer to slow down than to speed up given
the same but opposite step.  Not all that different from the light bulb case
really.  By the way, this PID controller runs on a 16F876 and updates the
PWM output to the motor driving the throttle position every 10mS.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> I am sorry if I missed something, but why go to  the trouble of squaring
and
> square rooting?

This has been beat to death over the last week.  Check the archives.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> This is NOT a difficult design task.  You should easily be able to
> find some one who'll do it for the price of a case or two of their
> favorite beer, and they can probably get the job done for you in a
> couple of evenings or over a weekend.

Sure you could get your wife's cousin's brother in law's drinking buddy
named Vinny to do it in his spare time while watching the ballgame for real
cheap.  Go ahead.  After that maybe you'll understand why a real engineer
charges real money.

You'd probably be surprised how often I get hired to pick up after Vinny.  I
love those jobs because by the time the customer has been to Vinny and back
I never get any argument about my rates.  It's usually "We've had Vinny
working on this for the last four months and he's 90% done, but we have a
demo next week and need it working on Monday.  Please, we'll pay whatever it
takes, just get it working".  Of course Vinny is really only 10% done with a
flawed design, so it's far quicker to start from scratch and do it right in
the first place.  So I end up spending a very busy but lucrative weekend at
50% over my normal rate.

So yeah, go ahead, make my day, go find a Vinny who can do this for a case
of beer.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

> 1.  It's non linear.  And I wonder just how much that curve changes from
bulb to
> bulb, and light sensor to light sensor?  And how much over time does it
> change/drift from initial values?  I can't be reprogramming a new curve
table
> for every unit.

If you spent as much time trying to prove it won't work instead on making it
work you'd be done now.  If you try hard enough you can prove bumblebees
don't fly either.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestmitvma.mit.edu

On Sat, 5 May 2001 10:35:12 -0400 "Scott M. Thomas" <scottDBT.NET>
writes:
> I am sorry if I missed something, but why go to  the trouble of
> squaring and
> square rooting?
>

Cuz that's the definition of RMS...  It's the squre root of the mean of
the squares.

Harold

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

--

I was probably at the National Association of Broadcasters convention.
My wife went along to help. We have cards with her title listed as "Booth
Babe."
Anyway, I don't believe the rise time is an issue. I just take about 200
samples per half cycle. If the triac is on, the A/D conversion gets used
in the RMS calculation. If it's off, the A/D gets thrown out. I don't
believe that what happens between samples is important (unless we got a 5
kV spike in there or something, but the sine wave power line is pretty
well behaved).
I'm generally holding the voltage driving the lamp at 24.5V +/- 250 mV.

Harold

On Sat, 5 May 2001 08:48:06 -0500 Bob <op1cwkFLASHMAIL.COM> writes:
{Quote hidden}

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

--

Bob, if you're so worried about that RMS just go ahead and build TWO of
them bulb couplers. In theory you can do the same with normal O.C.s. Mount
them near each other on the PCB, add a small piece of aluminium glued to
both to make temperatures equal, and build a small circuit using a 358
opamp (or whatever you have). The phototransistors form the inputs of the
error amplifier and its output drives the LED of the second o.c. (the
first LED is driven by the voltage to be measured). The error amplifier
needs to be an integrator of sorts but the output measured on the opamp
output will be a reasonable facsimile of the RMS at the input.

With LEDs it will be non-linear but reasonable (make sure you do not
saturate the input o.c.), with bulbs it will not be nice and also not
linear, but with tiny resistors and thermistors (instead of optos) it will
be dead accurate (assuming it is built right). None of this enters the
'cheap' category. Two o.c.s will set you back about \$2 each in small
quantity.

In general, I'd aim for precision class 3% which is most
industrial/semipro equipment. That would relax your requirements enough,
that you could get away with a smallish lookup table and just measure
input peak voltage (in theory the max distortion of the input mains is 10%
more likely 2%. This translates to the respective error squared in RMS
(because P=U^2/R and distortion represents that part of the mains sine
that is not at baseband). So 1.05*1.05 = 1.1025 ~= 10%) if you measure
peak voltage only. I'd recommend a 'perfect' rectifier using two opamps
measuring the output voltage of the transformer. This will automagically
fix the dialed power wrt. transformer loss, plus give insulation.

If you use an iron transformer you will probably have less error than that
due to the transformer getting rid of the harmonics (that's what mains
distortion is after Fourier analysys - your transformer is a lowpass
filter that removes higher harmonics). Just make sure you stay away from
transformer saturation (i.e. it should be slightly oversized and of good
make).

good luck,

Peter

--

> What you are saying is that the lightbulb to optocoupler is not a linear
> system, which I totally agree with.  However, that doesn't mean it can't
> be controlled with a PID controller.  The simple method is to set the
> damping so that it still works with the worst case light bulb delay.
> Another more sophisticated approach would be to add some extra logic to
> the PID controller.

No. I am saying that the time constant associated with the lamp depends
heavily on its filament temperature. A lamp will cool down MUCH faster
when it is very bright than when it is just barely lit and the opposite
effect (brightening) slows down with increasing filament temperature. This
makes for some assymetrical 'rounded' triangle shapes that change in shape
for dL/dV at any given V. Compensating for this in a tightly designed PID
loop is usually a no-no so it needs to be overdamped. Unless you run the
lamp very bright (not a good idea).

Peter

--

> > What you are saying is that the lightbulb to optocoupler is not a linear
> > system, which I totally agree with.  However, that doesn't mean it can't
> > be controlled with a PID controller.  The simple method is to set the
> > damping so that it still works with the worst case light bulb delay.
> > Another more sophisticated approach would be to add some extra logic to
> > the PID controller.
>
> No. I am saying that the time constant associated with the lamp depends
> heavily on its filament temperature. A lamp will cool down MUCH faster
> when it is very bright than when it is just barely lit and the opposite
> effect (brightening) slows down with increasing filament temperature. This
> makes for some assymetrical 'rounded' triangle shapes that change in shape
> for dL/dV at any given V. Compensating for this in a tightly designed PID
> loop is usually a no-no so it needs to be overdamped. Unless you run the
> lamp very bright (not a good idea).

I think we are both saying the same thing and both agreeing that the simple
solution is extra damping.  All the characteristics you describes make the
system non-linear.  Linear simply means that scaling the input by a constant
will also scale the output by the same constant.  As you pointed out, this
is definitely not the case with a light bulb.

********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...