Saturday, January 27, 2024

Fail Safe

Recently a 15-year old gas water heater stopped working; the pilot could be lit and would not stay on.  It can found on the internet a diagram of the gas water heater controller.  It becomes clear that the thermocouple is the issue.  Commonly, we use thermocouples as temperature measuring devices, but here it is actually a fail-safe device, which seems ingenious.    The thermocouple is an electricity generating device.  The thermocouple is in contact with the flame of the pilot and generates electricity (rated for 30mV) for a solenoid coil to open a gas valve.  So in case the flame is out, the gas value is automatically closed.  When we light the pilot, we push down a switch to bypass the solenoid to get gas flow and once the pilot flame is lit and the thermocouple is heated sufficiently to open the valve we can release the switch.  

The whole thermocouple assembly costs less than $10.  It can be appreciated the simplistic yet robust and rugged solution.  It is self powered and the very thing energizes it is controlled by it.  When the thermocouple fails, it closes the valve to keep the system in a safe state.  It is amazing that it has lasted for 15 years bathing in the flame constantly.  The life time is longer than the average life of water heaters.  Ultimately, oxidation probably claimed its life.  It is relatively easy and inexpensive to replace.

Monday, January 22, 2024

Wireless Remote Control Switch

Wireless remote control switch modules can be purchased for a few US dollars (around $7 for one pair).  They come with coil antennas.  They controls 4-channel output with Learning Code 1527, and can be programmed (using button presses) to operate in the momentary, toggle and latched mode.  The Learning Code 1527 has 20-bit identifiers(for over 1 million possibilities) and followed by 4-bit button code (for 16 states).    Most of the inexpensive modules have no marking on the ICs, so there is little information about the circuitry.

We can capture the RF wave using a oscilloscope with a loop antenna.

It appears the modulation is OOK.  Every burst is about 30ms.  It continuously transmits as long as the button is pressed.  It can be observed that the last few bits change depending on which key is pressed.  It appears that the bits are decoded according to the pulse duration or PWM encoded.  The bit 0 is a short duration of 0.3ms, and the bit 1 is about 0.9ms.   The total bit time is 1.2ms.  I counted total of 25 bits instead of expected 24 bits. Possibly the first bit is for synchronization only.

Something is also interesting about the 20-bit identifier code.  I was able to turn on and off using a key FOB from a different vendor and the code pattern is clearly different, but the receiver decodes it nevertheless, so it may not actually enforce the code or only subset of the code, or there is a master code.


Wednesday, January 10, 2024

Carbon Composition Resistors

I got a box of carbon composition resistors which are perhaps 40 or 50 years old.  They are things of past, having been replaced by carbon film and metal film.  They are probably made by Allen-Bradley, which were the main supplier of discrete resistors.  They have the distinct dark brown base color with 4 to 5 color rings (some have a visible 5th ring for temp coeff, yellow for 25 ppm/C, most are probably 100ppm/C which is brown same as the background), and are of straight cylindrical shape with sharp ends.  (The carbon film resistors have light brown base color and have end-cap bulge then tapered shape at the end).  The most common ones have 1/4W power rating, with body length 0.25", diameter 0.090",  lead length 1.5", diameter 0.024".   The 1/2W has body length of 0.385", diameter 0.140", and 0.032" lead diameter; and 1/8W body length 0.150", diameter 0.062" and lead diameter 0.015".

One thing I noticed is that how badly they are out of tolerance.  There are 5% resistors as indicated by the gold color ring.  But a lot of them are more than +5% of the nominal values.   All resistances are larger than the nominal value.  Aging or environment conditions (such as moisture) might have a large influence, which causes at least +5% resistance value shift.  But carbon composition resistors, which are not film construction, are more robust and have good surge performance, low inductance, and good high frequency capability.

Thursday, January 4, 2024

Low Power Design

Here we discuss a few techniques that are useful in low power designs.  As an example, we design a remotely operated switch which upon detecting a button push transmits a RF signal to turn on or off a remote device.  This switch is powered directly off a small 110mAh lithium ion battery, whose discharging characteristics is shown in a previous post.  We use the 8-pin PIC16F17115 microcontroller, which can operate over the voltage range of a single cell lithium ion battery, no voltage regulator is needed.

The switch is inactive most of the time, so the microcontroller is placed in the sleep mode, drawing less than 1uA.  The microntroller is waken up on an I/O change interrupt.  The peripherals that operate on the system clock which is stopped during are not drawing much power, but it is necessary to explicitly disable some of the peripherals, such as the fixed voltage reference, brown-out reset, comparators, which have significant current draw.

The battery voltage needs to be monitored.  To minimize part counts and reduce power consumption, we use the battery voltage as the voltage reference for the ADC and do the analog to digital conversion on the reference voltage, to back calculate the battery voltage; no external connection is needed and no power is wasted on a resistor divider.  When the battery is low (around 3.6V),  a warning is issued with a low duty cycle LED blink or a piezo buzzer beep.

We can eliminate the quiescent power consumption of the RF transmitter by powering the transmitter with an I/O pin (saving a power switch).  Note that the output drive is stronger when driving low.  So we set the I/O pin to open-drain and power up the transmitter by driving the output low.   This works for 10s mA; for larger current, a  power switch is needed.

For the button press detection, we use an external pull-up resistor of 1MOhms, instead of the internal pull-up which is about 30KOhms.  Pressing the switch on triggers a negative edge, which wakes up the microcontroller to transmit a turn-on RF signal.   And pressing the switch off triggers a positive edge, which powers up the RF transmitter to send a turn-off signal.    Here 4uA current is consumed.  The leakage current is 125nA (85C); the pull-up resistor can be increased to 4MOhms, reducing the current to 1uA, which would be.  We must be mindful of the slow rise time (with pin capacitance of 5-10pF), and use the Schmitt trigger input. 

In the awake state, after the microcontroller sets up the ADC to check the battery voltage, drives an output pin high to turn on the transmitter and drives another open-drain output low to transmit.  Here to save power, we put the microcontroller in the IDLE mode, so the microntroller CPU is halted but the peripherals continue to run.  We set up the timer to interrupt in 200ms, which would bring the microcontroller out of the IDLE state to turn off the transmitter.  Then the microcontroller goes into the sleep mode

If it is necessary to wake up from sleep periodically,  the watchdog timer can be used.  Here it may be necessary to wake up periodically to check the battery and beep when the battery is low as reminder to charge the battery.