Date: 201410
Local time of day: 1201-1800
Location: ZZZ.TRACON, US
Flight conditions: VMC
Weather elements / visibility: 10
Light: Daylight
Aircraft: PA-28 Cherokee/Archer/Dakota/Pillan/Warrior
Operator: Personal
Operating under: Part 91
Flight plan: None
Mission: Personal
Flight phase: Cruise
Airspace: Class E ZZZ
ATC / advisory: TRACON ZZZ; Tower ZZZ
Second aircraft: Any Unknown or Unlisted Aircraft Manufacturer
Reporter organization: Personal
Reporter function: Single Pilot; Pilot Flying
Reporter qualification: Flight Crew Commercial; Flight Crew Instrument; Flight Crew Multiengine
Human factors: Communication Breakdown; Situational Awareness; Workload
Anomaly: ATC Issue All Types; Conflict NMAC
Detector: Person Flight Crew
When detected: In-flight
Result: Flight Crew Took Evasive Action
Contributing factors: Human Factors
Primary problem: Human Factors

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.




Synopsis: 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.