On Fri, 4 May 2001 08:31:22 -0400 Olin Lathrop writes: > > I don't know what your talking about (Willis), about using a light > bulb to > 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. > 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: http://dl.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.