A moisture sensor is configured to be deployed in soil for measuring a moisture content. The moisture sensor includes a housing; a transistor configured to interact with water from the soil; a power source configured to generate an electrical current; and a processing unit configured to receive a reading from the transistor, and to calculate the moisture content of the soil based on the reading. The transistor includes a metal-organic framework, MOF.