Turn Up the Heat
Designing a feature-rich tankless water heater based on a dsPIC® digital signal controller.
Theta Engineering was established in 1993 as an engineering consulting firm with an emphasis on economy and quality. It has been a Microchip Design Partner since the program’s inception in 2008. An early project that Theta Engineering developed was a one-year timer based on a PIC16C54, one of Microchip’s earliest and simplest microcontrollers (MCUs), that was programmed in assembly. The timer’s only job was to flash an LED a year after the batteries were inserted to alert the user that it was time to change the filter on their reverse-osmosis water filtration system. Since then, Theta Engineering, Microchip and technology in general have come a long way. Microchip’s support has been extremely valuable for creating many additional projects in the ensuing years.
Theta Engineering has developed a tankless water heater for commercial and consumer applications that showcases the capabilities of the dsPIC33EV256GM006 Digital Signal Controller (DSC). This application uses 62 of the device’s 64 pins, along with many of the basic and advanced features of the dsPIC DSC such as the internal high-speed clock, Pulse Width Modulator (PWM), multi-channel 12-bit Analog-to-Digital Converter (ADC) with capacitive sensing support, internal analog op amps, input capture timers, Digital Signal Processing (DSP) support, UART and I2C communication ports, and flexible general-purpose I/O. Thanks to the extensive range of useful features built into the dsPIC DSC, it was possible to minimize the amount of external circuitry needed, addressing the client’s need to keep the Bill of Materials (BOM) cost low. Indeed, the business strategy for the client is to enter the market with this patent-pending, high-performance, feature-rich product that remains cost competitive with the competition’s much more basic products. Offering 5V operation, the dsPIC33EV DSC offers high noise immunity and a range of hardware safety features, helping to create a robust design.
One of the highlights of this design is diagnostics. Low-cost circuitry is implemented to monitor voltage across, and current through, each of the three heating elements so that software can detect and announce faults such as shorted or open triacs or broken heating elements via the user interface. Each voltage monitoring circuit converts the instantaneous voltage across a heating element into a frequency that is transmitted through an optical isolator to the dsPIC DSC as a pulse train. The monitoring circuit starts running at 20 volts and continues to increase in frequency as the voltage increases up to 400 volts, giving the dsPIC DSC a picture of the line-voltage waveform using its capture/compare on-chip peripherals while keeping it safely isolated from the high voltages involved. The voltage-to-frequency converter circuits were designed for reliability at low cost, not for linearity, on the premise any non-linearity would be compensated using a Piece-wise Linear Interpolation algorithm previously developed by Theta Engineering that is easily supported by the dsPIC DSC’s processing power.
A novel feature of this design is the technique used to monitor current through each of the triac/heating-element circuits. A common approach to line-voltage and current sensing is to use a small current-sense resistor in series with the line and a special chip intended to amplify the small voltage drop across the current-sense resistor while tolerating the large common-mode voltages. This would then need to be converted to a digital signal that could be sent across the isolation barrier to the dsPIC DSC in a manner similar to the voltage monitoring circuit. While the voltage monitoring circuit described above is self-powered, the chip that amplifies the signal from the current-sense resistor typically requires a power supply, adding to the cost. This complexity motivated a search for a better solution. A current transformer or a Hall-effect sensor could greatly simplify things, providing an MCU-compatible signal voltage while at the same time providing isolation from the line voltage, but these are expensive components. The final solution was to implement a current transformer using just the Printed Circuit Board (PCB) traces, essentially creating an air transformer built into the PCB itself.
With no ferrous material around to enhance the inductive coupling, the on-PCB current transformer was not very efficient. It produced a weak but usable signal, given enough amplification and careful filtering. A very-low-cost quad op amp was added to the design but getting sufficient gain and bandwidth from it turned out to be a bit of a stretch. The on-chip op amps in the dsPIC DSC came to the rescue. By implementing a second stage of gain between the external amplifier chip and the on-chip ADC, the demands on the external chip were greatly reduced, allowing for a more robust design with better noise margins.
The DSP power of the dsPIC DSC makes it possible to monitor and combine voltage and current waveforms in real time to determine Root Mean Square (RMS) power. Using information from the flow monitor and the water inlet and outlet temperature sensors, sophisticated control algorithms can use a combination of feedback and feed-forward techniques to maximize performance—which, for a water heater, means coming up to temperature quickly—while minimizing overshoot and maximizing safety. The dsPIC DSC’s ability to do this while running a complex user interface and a daisy-chained serial communication protocol for adding on more slave units provides many options for maximizing flexibility in various installations, broadening the product’s potential market.
Located in Costa Mesa, California, Theta Engineering provides the technical resources to help bring a variety of projects, like this tankless water heater, to life. Visit www.thetaeng.com to find out how to contact us if you have any questions. You can also browse our website to learn more about our services and to see a gallery of some of the projects we have developed over the years.