Preventing Corrosion in Printed Circuit Boards
Unprotected printed circuit boards (PCBs) corrode easily, making corrosion a major cause of failures for PCBs. Corrosion increases the resistance of copper tracks on a PCB, and when sufficiently corroded, result in the board working inefficiently or stop working altogether. Fortunately, there are some common causes of PCB corrosion and taking care of them in time can allow PCBs to work unhindered for their entire life cycle.
Oxygen bonding with a metal causes the metal to oxidize, changing the chemical, mechanical, and electrical properties of the metal. In general, people refer to the oxidized metal as rust, which flakes off, reducing the amount of metal at that point. The common name for the entire process is corrosion. Different metals corrode at different rates, some resist corrosion, while others corrode rather easily. For instance, while copper alloys, silver, gold, and graphite resist corrosion indefinitely, copper, lead, thin layers of tin and nickel are highly susceptible to corrosion. This is one reason metals such as gold and silver are also known as noble metals, while metals that corrode easily such as tin and copper, are known as base metals.
Printed Circuit Board manufacturing primarily contain copper in the form of layers and traces, and while there may be a covering of surface finish, copper, being a base metal, is highly susceptible to corrosion. 
Types of Corrosion
One can classify types of corrosion depending on the cause of the deterioration of the metal, and these are:
- General Attack Corrosion
- Localized Corrosion
- Galvanic Corrosion
- Electrolytic Dendrite Formation
- Inter-granular Corrosion
- Fretting Corrosion
- Environmental Cracking
- Flow-Accelerated Corrosion
- De-Alloying Corrosion
- High-Temperature Corrosion 
Of the above, metal on PCBs are more likely to face the first five types of corruption as discussed below:
General Attack Corrosion
Also known as atmospheric corrosion or uniform attack corrosion, this is the most common type of corrosion. Caused mostly by a chemical reaction between the oxygen in the atmospheric moisture and copper, the result is the formation of copper oxide. Although retaining the mechanical properties of copper, copper oxide has low electrical conductivity, which is the major cause of problems in PCBs. However, it is easy to predict, manage, and prevent general attack corrosion.  
Unlike general attack corrosion that affects a larger area, localized corrosion is limited to a small area and may be of one of three types:
Filiform Corrosion: Moisture entering under the surface finish causes a tiny defect in the copper, which then spreads further.
Crevice Corrosion: Stagnant micro-environments such as those under clamps, washers, and components on PCBs cause this type of localized corrosion. Left-over flux and cleaning solution within such crevices commonly cause this type of corrosion.
Pitting Corrosion: De-passivation in a small area can often form a small hole, pit, or cavity in the copper. Localized galvanic reactions cause deterioration leading to an increase in the pit diameter and depth, ultimately leading to failure. Corrosion-producing compounds often hide the pits, making it difficult to detect them.  Pitting in copper can also happen due to presence of halogens. 
In the presence of a corrosive electrolyte, two dissimilar metals, such as copper and the metal cap of an SMD, or gold and tin, can start to corrode due to galvanic corrosion. Although similar to pitting corrosion, galvanic corrosion occurs only between electro-chemically dissimilar metals when they are in electrical contact, and the metals are both exposed to the electrolyte. 
Also Read: CHOOSING THE PERFECT PCB ASSEMBLY PARTNER
Electrolytic Dendrite Formation
Presence of ionic contamination in moisture can lead to this type of deformation. Adjacent copper traces carrying different voltages start to grow dendrites or metal slivers in the presence of such ionic contamination, ultimately leading to shorts between the traces. 
Presence of chemicals on the grain boundary of the copper trace can lead to inter-granular corrosion. Grain boundaries often contain higher impurities that are more susceptible to such corrosion. 
From the above, it is clear that corrosion is primarily due to the presence of moisture or electrolytic contaminants on the PCB. Extreme environments such as industrial and humid atmosphere are liable to make PCBs highly susceptible to different types of corrosion. Preventing corrosion is possible by:
- Removing flux residues effectively from the PCB
- Keeping the PCB dry
- Preventing electrolytes from wetting the PCB
- Covering the PCB with a conformal coating 
Older flux materials were notorious for generating chlorine or other harmful halogens, which led to formation of pitting corrosion in copper traces, unless the flux material was removed after the soldering process. However, organic acids in newer fluxes do not contain halogens, and they decompose at higher temperatures such as during reflow soldering. However, boards undergoing wave soldering may not reach the decomposing temperature, and the leftover flux residue may have to be manually cleaned thoroughly to prevent crevice corrosion. 
It is largely possible to win the war against corrosion by preventing moisture or other liquids from reaching the PCB. There are many ways to achieve this, such as by placing the PCB inside an enclosure with a suitable IP rating.
In situations where it is not possible to enclose the PCB in an enclosure, conformal coatings can help. Different forms of conformal coatings, such as a simple solder mask, aerosol spray coatings, or epoxy coatings are all effective deterrents against corrosion. However, for PCBs carrying components that generate heat, such conformal coatings may have to be applied judiciously so as not to hamper heat management. 
Predicting corrosion in PCBs takes experience, and often, it is not possible to accurately predict where corrosion will occur, until the PCB actually starts to corrode. Fortunately, failure from corrosion does not happen immediately, and usually, there is considerable time available to address the cause effectively.