4
\$\begingroup\$

I'm helping out in a project to convert an electric rice cooker into a sous vide cooker with a PID control. For those unaware, this is a precision-controlled water bath at "low" temperatures (setpoint at between 50 and 80 degrees Celsius).

The AC load is switched by means of a TRIAC, triggered by a TRIAC optocoupler with zero crossing detection (MOC3063).

I'm sensing temperature using 7 NTCs, distributed in various points of the cooker, all connected to a TI LMP90079 A/D converter. This part has a few fixed sample rates, and the one I'm thinking of using is 6.71 Hz. Actually, due to differences in the crystal frequency and the use of a calibration mode available in the part, there may be a very slight (~0.2%) discrepancy to this nominal rate. Since I sample 7 channels at a time, my sampling rate is divided by 7, so it's approximately 0.959 Hz, which is the rate at which I run my PID loop.

My initial plan for actuating the rice cooker's heating element was to generate a 1 Hz PWM wave that is input to the TRIAC optocoupler. The duty cycle would be given by the controller output obtained from the PID loop. Each time the PID loop is run, I would update the duty cycle.

At this point, it occurred to me that I could feed the controller output to a delta-sigma modulator, but first resampling the controller output signal to a frequency of 120 Hz (since I'm using a TRIAC optocoupler with zero-crossing and there are 120 semicycles in a 60 Hz mains waveform.) The output of the delta-sigma modulator would be used to actuate the TRIAC, synchronized to the zero-crossings of the mains waveform.

A sigma-delta modulator requires a low pass filter to be applied to the output of the modulator, but my reasoning is that the physical system itself serves as a low-pass filter: The rice cooker has a capacity of 4.5 liters/1.2 US gallons of water, and a 700 W heating element, which means I need at least 27 seconds to heat the contents of the cooker by 1 degree Celsius.

So here's what I'm wondering:

  • Is this idea fundamentally sound?
  • What's the equivalent number of bits of this DAC? For the 1 Hz PWM waveform solution that I was previously going with, I reckon accuracy is ~7 bits since I can choose between 0 to 120 semicycles for each 1-second period, and log_2 120 ~ 7. As for the sigma-delta DAC, according to this Maxim application note, using a second order modulator with 128x oversampling (120/0.959 ~ 125 so that's close), I should expect a 90-95 dB SNR, which works out to ~15-16 bits of resolution. Is this correct?
  • That said, should I expect to see any kind of real-world improvement if I used this sigma-delta DAC, compared to the original 1 Hz PWM waveform solution?
  • Is a second order sigma-delta modulator a good choice? The ADC that's reading out data from the NTCs has a 16-bit ENOB and noise free resolution at the choice of PGA gain and sampling rate that I'm going to use. From my calculation above, I'm getting out the same resolution from the DAC using a second-order modulator, so anything above that would be overkill, in my understanding.
  • There is no integer oversampling factor that takes me from the 0.959 Hz sampling rate to a 120 Hz sampling rate exactly. So say I get to a 119.8 Hz rate; then there will be a beat frequency of 0.2 Hz between the mains waveform and my waveform. What effect will this have on the accuracy of the conversion process?

I'm aware that I could use a non-zero-crossing TRIAC optocoupler to perform phase control of the AC waveform, but I'm doing this as an intellectual exercise, so I'd like to pretend that solution is not available.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Why 7 sensors when you have only a single control output? One good sensor might be better (or combine a slow accurate sensor with a fast sensor eg. RTD and thermocouple) using a Kalman filter if you want to get fancy. The sigma-delta thing has been done, there's a good paper if you can find it. Using half cycles is not ideal- it puts DC current into the distribution transformers. \$\endgroup\$ Commented May 8, 2014 at 15:09
  • \$\begingroup\$ I need the temperature to be homogeneous across the cooker, so I have these sensors in different points of the cooker. I intend to control a water pump to circulate water based on the spread between different temperatures (after calibrating the NTCs). \$\endgroup\$
    – swineone
    Commented May 8, 2014 at 16:09
  • \$\begingroup\$ Why not just run the water pump all the time? I don't see the reason for the complexity unless you want to just monitor it. \$\endgroup\$ Commented May 8, 2014 at 16:10

1 Answer 1

3
\$\begingroup\$

You are way over-thinking this. Given the long thermal time-constant of the system, there's no need to worry about high-order modulators, or how the sample rate of the sensors relates to the sample rate of the output.

Yes, delta-sigma is a good way to control the heater power, but a basic first-order implementation will be more than enough for your purposes. One side comment: it would be friendier for your power company to switch based on whole cycles, rather than half-cycles.

Your control loop produces an updated power setting at a 0.959 Hz rate. Let's assume that this setting is an integer between 0 and 255, representing 0 to 100% power.

You want to update the triac gate at a 60 Hz rate. Let's assume you have an interrupt that's synchronized to the rising zero crossings of the power line.

Set up your interrupt handler so that it has an 8-bit accumulator. On each interrupt, add the power-setting value to that accumulator, and if there's a carry out from the addition, turn on the triac for that cycle.

It really is that simple. The overall average duty cycle of the heater will match the power setting exactly. If you really feel you need higher resolution, you can use 16-bit values for the power setting variable and the accumulator in the ISR.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.