A sensor (14) having a nanotube (15) grown on and supported by thermal bimorph structures (11, 12). The nanotube (15) rests on a heat sink (13) during sensing gas or a liquid and is moved from the heat sink when the nanotube is heated to desorb gas or liquid from it. The heatsink (13) may function as a gate along with the bimorph structures (11, 12) as the other terminals of a transistor. Current-voltage and current-gate voltage characteristics may be obtained of the nanotube as a device like a transistor. These characteristics may provide information on a gas or liquid absorbed by the nanotube.