A sensor having a nanotube grown on and supported by thermal bimorph structures. The nanotube rests on a heat sink during sensing gas or a liquid and is moved from the heat sink when the nanotu be is heated to desorb gas or liquid from it. The heatsink may function as a gate along with the bimorph structures 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.