Narrative:

At cruise altitude (FL280); near ZZZ1; our plane entered a cloud; requiring us to turn on anti-ice. Within seconds after turning on engine heat; the flight attendants chimed and reported 'an odor' in the cabin. There was also an odor in cockpit. Nothing visible; just a smell. The smell was described as a 'burning electrical' smell. I decided to declare an emergency and divert to ZZZ. We landed safely. Arff inspected the aircraft before we taxied to the gate.it is very possible we flew through a smoke cloud that was from the massive forest fires in the region. If I had been aware of the possibility of that smell entering the aircraft; I could have done something to prevent an unnecessary divert. On the return trip; I made a PA that alerted the passengers and flight attendants that we may get an odor inside the airplane. While flying over the forest fire area; it is very possible to get that smell in the cabin. Armed with this knowledge; I believe there would be far less fear and panic.

Google
 

Original NASA ASRS Text

Title: In cruise at FL280; MD-82 flight crew detected 'burning electrical' odor after turning on engine heat. Flight attendants reported same odor in the cabin. Crew declared an emergency and diverted to ZZZ where odor was attributed to massive forest fires in the area.

Narrative: At cruise altitude (FL280); near ZZZ1; our plane entered a cloud; requiring us to turn on anti-ice. Within seconds after turning on engine heat; the flight attendants chimed and reported 'an odor' in the cabin. There was also an odor in cockpit. Nothing visible; just a smell. The smell was described as a 'burning electrical' smell. I decided to declare an emergency and divert to ZZZ. We landed safely. ARFF inspected the aircraft before we taxied to the gate.It is very possible we flew through a smoke cloud that was from the massive forest fires in the region. If I had been aware of the possibility of that smell entering the aircraft; I could have done something to prevent an unnecessary divert. On the return trip; I made a PA that alerted the passengers and flight attendants that we may get an odor inside the airplane. While flying over the forest fire area; it is very possible to get that smell in the cabin. Armed with this knowledge; I believe there would be far less fear and panic.

Data retrieved from NASA's ASRS site as of July 2013 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.