Hi, I have a 2008 Mazda 6. On cold idle, the rpm is fine at 800rpm. When the car warms up it goes down to like 700rpm+ which is still fine. The problem I have is that if I turn on the headlights the engine sounds like it wants to shut off and the rpm goes up and down 600+ to sometimes 580rpm. If I press the power window switch it does the same rough idle. If I press the AC it goes back up to 700+rpm. I check the battery it is 12.5v I put in another battery and it's doing the same thing. The alternator shows 13.5v when it's not under load when I turn on the heat lights I've seen it drop to as low as 12.9 but then fluctuate down in the 13.0 to 13.5 range. I checked the alternator I connect the black lead to negative and positive lead to the alternator I get 0.05 I put the positive lead on all ground and I get 0.05. I check headlights 15a fuse I get 0.02 resistance. I connect to a scan tool it shows engine load value going up higher when headlights are on. I also see vacuum value go lower. What could be my problem?