We describe a novel sensor of ammonia based on a planar optical waveguide made of a thin film of polymer polyimide doped with indicator dye bromocresol purple. The film of dye-doped polyimide demonstrated reversible increase of absorption with a peak near 600 nm in response to presence of ammonia in ambient air. Coupling of input and output optic fibers with the waveguide was done by means of coupling prisms or coupling grooves. The latter configuration has the advantage of low cost, less sensitivity to temperature variation, and the possibility of coupling from both sides of the waveguide. Special experimental setup was built to test the sensor. It included test gas chamber with sealed optic fiber feed-throughs, gas filling line, laser source, photodetector, and signal processing hardware and software. The sensor was capable of detecting 100 ppm of ammonia in air within 8 seconds. Further increase of sensitivity can be achieved by adding more dye dopant to the polymer, increase of the length of the waveguide, and suppression of noise. Overexposure of the sensor to more than 5000 ppm of ammonia led to the saturation of the polymer film and, as a result, significant decrease of sensitivity and increase of the response time. The sensor can be used as low cost component of a distributed optical network of chemical sensors for monitoring presence of hazardous industrial pollutants in air.