Small aircraft pilot reported cruising at the wrong altitude for direction of flight and while getting distracted by an overheating electronic; noticed another aircraft that was quite close in vertical distance.
Synopsis
Small aircraft pilot reported cruising at the wrong altitude for direction of flight and while getting distracted by an overheating electronic; noticed another aircraft that was quite close in vertical distance.
Narrative
Was cruising at 4500 ft. on a east-southeast heading from ZZZ to Dane County (MSN). Was originally going to fly at 3500 ft. but hit a lot of chop; so decided to climb. For some reason; when I got to 4500 ft.; I leveled off thinking it was an appropriate altitude. I remained on this heading for about 5 - 10 minutes when my ForeFlight-equipped iPad alerted me that it was overheating. While looking for a place to put it to cool without sliding around the cabin; I caught motion out of the corner of my eye and saw a low-wing Aircraft Y at a fairly close distance. Had I been at 3500 ft. or 5500 ft.; the vertical distance would have been much greater. Had my ForeFlight been running leading up to the encounter; it would have alerted me of the aircraft; and that would have triggered me to question my altitude. If I had been on flight following; I would have gotten a call-out. Near miss was a result of me being at an incorrect altitude paired with not utilizing flight following. I don't believe Aircraft Y did anything incorrectly.
Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.