Heavy metal contamination of oceans, lakes, and other water resources can occur by both natural and human-related processes. Human exposure to heavy metals such as mercury is known to cause a number of serious health problems. Due to its high toxicity and bioaccumulative properties, the maximum toxic level of mercury in drinking water is set to be 10 nM or 2 parts-per-billion by the US EPA. Therefore, detection of mercury at such a low concentration poses an analytical challenge. While analytical instruments such as ICP-MS are still very widely used for heavy metal analysis, biosensors, are emerging as a cost-effective alternative allowing on-site and real-time detection. We herein describe a protocol for preparing polyacrylamide hydrogel-based biosensors functionalized with a thymine-rich DNA that can effectively detect mercury in water. Detection is achieved by the selective binding of Hg2+ between two thymine bases inducing a hairpin structure where upon the addition of SYBR Green I dye, green fluorescence is observed. In the absence of Hg2+ , the addition of the dye results in yellow fluorescence. This hydrogel-based sensor can easily detect 10 nM Hg2+ using the naked eye, can be regenerated using a simple acid treatment, and can be dried for storage and easily rehydrated. This sensor is also used to detect Hg2+ from Lake Ontario water samples spiked with mercury. In the case where a cationic gel formulation is used, the background fluorescence can be effectively suppressed to increase sensitivity. The future research directions of using such gels to detect other metal ions and to detect metal ions in ocean water are also discussed.