Narrative:

Shortly after flying sbound over ZZZ1 while in the ZZZ sfr area; a burning smell appeared in the cockpit. I announced my position when I was leaving the sfr area. After this announcement; all the electrical equipment turned off. I switched the avionics master off and turned towards ZZZ2 airport. This switch; a metallic toggle switch; was burning hot. I turned off all components individually and then try to turn on some components individually. Communication #2 worked. I tuned in ZZZ2 control tower frequency and declared an emergency. After confirming my position; I was cleared to land and did. Callback conversation with reporter revealed the following information: reporter discovered after the flight that one of two wires on the master avionics switch was loose because the nut holding it on was not tight. As a result; current across the wire was increased; creating heat on the switch. That heat made the switch very hot and caused a burning smell from the wire's heated insulation.

Google
 

Original NASA ASRS Text

Title: A C172 PILOT REPORTS A BURNING SMELL. AFTER ALL EQUIP WAS TURNED OFF COM WAS REESTABLISHED. AN EMER WAS DECLARED. MASTER AVIONICS SWITCH VERY HOT.

Narrative: SHORTLY AFTER FLYING SBOUND OVER ZZZ1 WHILE IN THE ZZZ SFR AREA; A BURNING SMELL APPEARED IN THE COCKPIT. I ANNOUNCED MY POS WHEN I WAS LEAVING THE SFR AREA. AFTER THIS ANNOUNCEMENT; ALL THE ELECTRICAL EQUIP TURNED OFF. I SWITCHED THE AVIONICS MASTER OFF AND TURNED TOWARDS ZZZ2 ARPT. THIS SWITCH; A METALLIC TOGGLE SWITCH; WAS BURNING HOT. I TURNED OFF ALL COMPONENTS INDIVIDUALLY AND THEN TRY TO TURN ON SOME COMPONENTS INDIVIDUALLY. COM #2 WORKED. I TUNED IN ZZZ2 CTL TWR FREQ AND DECLARED AN EMER. AFTER CONFIRMING MY POS; I WAS CLRED TO LAND AND DID. CALLBACK CONVERSATION WITH RPTR REVEALED THE FOLLOWING INFO: REPORTER DISCOVERED AFTER THE FLT THAT ONE OF TWO WIRES ON THE MASTER AVIONICS SWITCH WAS LOOSE BECAUSE THE NUT HOLDING IT ON WAS NOT TIGHT. AS A RESULT; CURRENT ACROSS THE WIRE WAS INCREASED; CREATING HEAT ON THE SWITCH. THAT HEAT MADE THE SWITCH VERY HOT AND CAUSED A BURNING SMELL FROM THE WIRE'S HEATED INSULATION.

Data retrieved from NASA's ASRS site as of January 2009 and automatically converted to unabbreviated mixed upper/lowercase text. This report is for informational purposes with no guarantee of accuracy. See NASA's ASRS site for official report.