Skyhawk 172/Cutlass 172
Flight Crew Private
Flight Crew Last 90 Days 30; Flight Crew Total 140; Flight Crew Type 130
Airspace Violation All Types; Conflict NMAC; Deviation / Discrepancy - Procedural FAR
Flight Crew Took Evasive Action
Human Factors; Airspace Structure
I had reached my cruising altitude of 7500 ft; 500 ft below the class B shelf that I was flying under. I was visually scanning for traffic when I looked down to scan the instrument panel. When I looked up again; I noticed another plane approaching very quickly from my 2 o'clock position; and from what I could tell; was starting to descend. It looked apparent that they had not seen me; so I put in full power and pitched up so that I would climb above their flight path. The other aircraft continued on their original track underneath me; and when I looked at the altimeter; I was at 8050 ft; in the class B. I immediately pitched down to regain my original cruising altitude of 7500 ft. My mind was preoccupied to the resolution of the issue when it arose; and while I was taking action; I was not thinking about how close I was approaching to the bravo airspace.
A C172 Pilot reported inadvertently flying into Class B Airspace after a NMAC.