PA-28 Cherokee/Archer/Dakota/Pillan/Warrior
Flight Crew Instrument; Flight Crew Multiengine; Flight Crew Flight Instructor; Flight Crew Commercial
Flight Crew Last 90 Days 46; Flight Crew Total 323
Communication Breakdown; Situational Awareness
Conflict NMAC; Deviation - Altitude Excursion From Assigned Altitude; Deviation / Discrepancy - Procedural Published Material / Policy; Deviation / Discrepancy - Procedural FAR
Flight Crew Took Evasive Action
Airspace Structure; Human Factors; Procedure
This was my first dual given flight. My private student and I were conducting landings to finish off lesson 15 at ZZZ. We came from practice area. The first 3 patterns were okay; traffic was not too busy and the flow was manageable. During these patterns; ZZZ Tower was having a conversation with [another aircraft]; about performing 360 over [a reporting point] outside the Class D airspace and how that could cause an issue with traffic coming into the airspace. When the conversation ended; at about my third pattern on upwind; I see a Skyhawk over [another reporting point]; and the controller was yelling '[Aircraft Y]; are you on frequency!' That crew replied; 'yes; we are;' Tower replied; 'you entered the Delta without contacting me.' I believe during that conversation; initially there was an Archer heading southbound outside the pattern to enter traffic pattern for [Runway] XXL. The crew's actions resulted in the pattern flow disturbed. The crew in the Aircraft Z heading south turned and climbed into the pattern to avoid Aircraft Y. We continued our upwind. By the time we were downwind; I saw Aircraft Z above right us about 100 feet. I immediately reacted and descended. [A solution is to] increase situational awareness and stop teaching if I have to due to the business of congested airspace; and fly the airplane first to maintain safety of the flight.
C172 instructor pilot reported a NMAC while in the traffic pattern.