Discovered in 1772 by English scientist Joseph Priestley, N2O was made by heating ammonium nitrate in the presence of iron filings and then passing the gas .