C172 pilot reported a NMAC while departing an airport under the shelf of a Class B airport.

Date: 2022-06 · Aircraft: Skyhawk 172/Cutlass 172 · Phase: climb

Anomalies: conflict-nmac|deviation-discrepancy-procedural-published-material-policy|deviation-discrepancy-procedural-far|inflight-event-encounter-weather-turbulence

Synopsis

C172 pilot reported a NMAC while departing an airport under the shelf of a Class B airport.

Narrative

I contacted the ZZZ ground controller and informed them of my intentions to depart to the North West on a flight to the X area and then continue north to ZZZ1 airport; and then gave the current ATIS info. I was cleared to taxi to runway ZZ. Upon contacting the tower for a takeoff clearance; I was cleared for takeoff and given instructions for a right turn to the North West. I cleared the runway and turned right to the North West per clearance instructions. After clearing the horizontal and vertical limits of the delta airspace I requested permission for a frequency change. The tower controller approved my request for frequency change. I then changed frequency to ZZZ approach to request flight following and permission to fly a sight seeing path over the X area. Upon switching channels; I attempted to contact the ZZZ approach controller three separate times; between other aircraft transmissions; with no response. The approach controller responded on the fourth attempt. There was never any concern with my position. After I was given a squawk code; I instructed to remain outside of the Bravo airspace; but I was not given a clear clearance into the X [area] airspace ('not approved or denied.....') per the controller.At this point I had a large cloud to my left; Bravo above and to my right and a layer of clouds in front of me that I could not climb above without violating the Bravo airspace. I could not turn left without violating VFR cloud clearance spacing. The only option left was to descend below the clouds in front of me before breaching cloud clearance. My descent apparently put me near the path of inbound traffic; that was on the other side of the clouds to my left which blocked my field of vision. I never saw the traffic. Nor did I feel any wake/turbulence. I was never in the clouds. The air continued to be smooth. Upon my return I was informed to contact the tower. I was then informed of a possible deviation. I wasn't given a restriction to deviate from.For topics relevant - I was never given a heading; an altitude restriction; or informed of inbound traffic (at any point); by the ZZZ tower. I was on a climb and still below three thousand feet at the time of incident; therefore plus 500 did not apply.Prevention of recurrence - Aircraft departing airports that sit under a busy airspace should be given more attention; particularly when the departure direction keeps them engaged with multiple airspaces/special use areas; i.e. issue squawk code before clearance to takeoff. Tower controllers should be informed of inbound / handoff traffic earlier.

Source: NASA Aviation Safety Reporting System (public domain). Reports are voluntary submissions and are not verified by NASA.