This paper presents the design and implementation of a low-cost spectrophotometer (LCSPM) for in-situ detection of mercury in water. The proposed device is composed of a white light emitting diode (LED), a diffraction grating (DG), a rotational positioning system, two photodiodes and a low-cost microcontroller. High-resolution angle displacement of DG allows obtaining a selective projection of the visible spectrum on the studied water and the reference during the same test. All required algorithms are embedded into the microcontroller allowing the transfer of the resulting data to a computer. The capability of the proposed LCSPM for detection of mercuric ions (Hg2+) in water was tested with the help of a synthesized coumarin and then validated by comparison with a standard device.