Wednesday, May 30, 2012

Mumbai Monsoons and Misbehaving Appliances

I am an electronics engineer and I live in Mumbai.
Atleast I used to, until I shifted to Pune, but since my parents live there, I visit Mumbai very often. Of the major cities I have been to - Mumbai, Delhi, Bengaluru, Chennai, Pune - I find Pune's climate among the most pleasant of them all. Bengaluru's would have been comparable had it not been for the pollution.

Mumbai (and Chennai's) humidity levels are always unbearable to humans as well as machines. No matter how well you design a machine, it will always die out a lot earlier in Mumbai as compared to its exact same counterpart put to use in a dry city like Pune. No wonder cars used in Mumbai have a lesser resale value - who wants a second hand car which has been tortured by humidity for many years!

I am a fan of mechanisms. The word mechanism has two definitions:
  1. A system of parts working together in a machine; a piece of machinery.
  2. A natural or established process by which something takes place or is brought about.
I am referring to the second one. Biochemistry and Genetic Engineering are full of amazing mechanisms or life processes. The good thing about these fields are that they are pretty neat and tidy. They are one of the newer fields as compared to electronics, mechanical and other kinds of engineering. Being new, by the time revolution took place in these fields, scientific processes, tools and attitudes were already well developed. The result of this was that these fields have very little flotsam and jetsam of initial unorganized forays into them. For example consider the signs of electrical charge and the direction of flow of current. It was thought that the current was formed of positive particles and so the direction of positive current was the direction of these charges. Later when it was found out that current was formed of negatively charged electrons, we refused to change the convention - retaining time bombs of confusion which would blast every individual of successive generations to come atleast once. There are many such examples - like when the actual values of universal constants like speed of light was measured exactly, we should have been wise and designed a new system of units in which atleast one of the important constant was a whole number. I still hope that a day would come when we would grow 16 fingers instead of just 10 to allow us to interact with/program computers better and easier.
But I deviate from the topic.

So why is it that many of our appliances - music systems, televisions, computer monitors - misbehave during highly humid months?
Different erratic behavior have different reasons or failure mechanisms behind them. But lets look at a particular phenomenon: you try to press some button on your TV, but the TV, instead of performing the function assigned to that button, carries out a different function. i.e. you press the program+ button, but instead of the channel changing, the volume increases.

What causes this behavior? The answer is intimately tied to the topology used by the appliance manufacturer while designing the switch panel. The appliances which fail in the above manner use the following topology for reading the states of the switches: 

A microcontroller repeatedly reads the voltage appearing at one of its ADC channels. After filtering and debouncing the signal, the value read from the ADC channel can be used to decide which button was pressed. Such a topology is beneficial because a single pin is all that is required to read all the switches (as opposed to multiple pins being required when a matrix layout is used). Each switch shorts all the resistors below it - therefore different switches will cause a different voltage to appear at the ADC pin of the micrcontroller. The microcontroller would determine which switch was pressed by passing the ADC value through an if, if else, if else structure to determine what "voltage range" the value lies in.

A unique feature of the circuit is that if someone tries to press two buttons, only that button which is physically placed higher in the chain (closer to the ADC pin as per the above schematic) will be detected - the priority is built into the hardware itself. 

The ADC (Analog to digital Converter) of the microcontroller can be left running in the free running mode, the ISR of which can continuously evaluate if a switch was pressed and would set a flag if it was. The switches used are usually tactile switches

The reversed biased zener diode is intended to protect against ESD surges.

Sony and Samsung are a few manufacturers which use this topology in their audio/video appliances. Like the "first robin of spring" my LCD computer monitor and LCD television 's misbehavior marks the beginning of monsoon. 

The reason for this peculiar failing behavior can now be understood:
During the rainy season, the elevated humidity causes a drastic increase in rate of formation of oxide layer on the switches. Due to the formation of thin film of oxide layer, the switches develop an internal resistance. Whenever these switches are pressed, instead of shorting out the resistances below it, they apply their own internal resistance in  parallel to the resistance chain they are supposed to short and hence a mis-read occurs - usually the microcontroller detects the voltage to be in a different range than the one corresponding to the switch that was pressed. Regular use of the switches usually breaks the oxide film and returns the device to normal behavior, but during high humidity months, this layer can form overnight and the device can appear to have failed the next morning. [this explanation is not yet confirmed by experiment]

Original photo taken from here.

Further Reading: