A thermocouple is a mechanism that is made of two different metals that produce a small electrical charge when heated on one side. This small electrical charge switches on an electromagnet which opens a valve and allows the gas or water to flow through.