Narrative:

Contacted ZZZ ground requesting VFR flight following to ZZZ1. Given squawk code 4227. Depart ZZZ and at around 900 feet ZZZ tower controller instructed me to change squawk to 5523. I complied. At 1;500; I was instructed to switch to 121.1 ZZZ departure. I told ZZZ departure controller I was level 1;500. He said he did not know who I was. I told him I just departed ZZZ. He told me I should be squawking 4227. I quickly explained that I had been squawking that but got told to switch to 5523; and then I switched back to 4227. 3 minutes later; I had a near midair collision with an aircraft flying westbound while i traveled north-westbound. When I noticed the aircraft; no serious evasive action was necessary to avoid collision as he was slightly above me but i did turn slightly anyways. I attempted to tell ZZZ departure about the event but he was busy and received no answer for a few moments. I told ZZZ departure about the event again and he told me 'you should be looking out for yourself as you were never radar identified'. Although he never said 'radar contact' upon my departure from ZZZ; I believe he knew where and who I was since he had me change my squawk and I complied. He then told me to file a report on the ground. I asked for his watch manager's phone numbers and called him later that night and was told that it was likely due to the initial switch in squawk code my ZZZ tower and that they had no idea why the controller had changed my code. I understand that may have been factor but I would think that if a controller talks to an aircraft and has him change codes and the aircraft tells them where they are; the controller probably knows where they are and sees them on the radar. It seemed like a systemic failure on the part of air traffic control combined with my misunderstanding that I would be given traffic alerts. I understand that traffic alerts are given on a time permitting basis and for this reason I always remain very vigilant when flying VFR. However; this aircraft was not picked up in my visual scan and with such low separation I would hope that something would advice the controller that a traffic alert is necessary.

Google
 

Original NASA ASRS Text

Title: The pilot of a Piper PA-28 experienced a near mid collision while in contact with ATC. He had not received ATC notification of the traffic. This may have been caused by ATC confusion with transponder codes and workload.

Narrative: Contacted ZZZ Ground requesting VFR Flight Following to ZZZ1. Given squawk code 4227. Depart ZZZ and at around 900 feet ZZZ Tower Controller instructed me to change squawk to 5523. I complied. At 1;500; I was instructed to switch to 121.1 ZZZ Departure. I told ZZZ Departure controller I was level 1;500. He said he did not know who I was. I told him I just departed ZZZ. He told me I should be squawking 4227. I quickly explained that I had been squawking that but got told to switch to 5523; and then I switched back to 4227. 3 minutes later; I had a near midair collision with an aircraft flying westbound while i traveled north-westbound. When I noticed the aircraft; no serious evasive action was necessary to avoid collision as he was slightly above me but i did turn slightly anyways. I attempted to tell ZZZ departure about the event but he was busy and received no answer for a few moments. I told ZZZ Departure about the event again and he told me 'You should be looking out for yourself as you were never radar identified'. Although he never said 'radar contact' upon my departure from ZZZ; I believe he knew where and who I was since he had me change my squawk and I complied. He then told me to file a report on the ground. I asked for his watch manager's phone numbers and called him later that night and was told that it was likely due to the initial switch in squawk code my ZZZ tower and that they had no idea why the controller had changed my code. I understand that may have been factor but I would think that if a controller talks to an aircraft and has him change codes and the aircraft tells them where they are; the controller probably knows where they are and sees them on the radar. It seemed like a systemic failure on the part of air traffic control combined with my misunderstanding that I would be given traffic alerts. I understand that traffic alerts are given on a time permitting basis and for this reason I always remain very vigilant when flying VFR. However; this aircraft was not picked up in my visual scan and with such low separation I would hope that something would advice the controller that a traffic alert is necessary.

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