A thermocouple is a device 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 stops restricting the flow of gas or water