/* This code reads the 0-1 V output of the ChipCap-L T/RH sensor. The circuit: http://www.ge-mcs.com/download/moisture-humidity/920_426b.pdf A0 - OUT-RH (pin 14) A1 - NC (pin 1) GND - GND (pin 4) 5V - V+ (pin 11) connect a 0.1u capacitor between ground and V+ */ const int analogPin0 = A0; // Analog input pin attached to the RH output pin on the ChipCap-L sensor const int analogPin1 = A1; // Analog input pin attached to the T output pin on the ChipCap-L sensor const float volt = 0.001074219; // multiplier to go from 0-1023 to volts float RH = 0; // RH variable float T1 = 0; // T variable void setup() { Serial.begin(9600); // initialize serial communications at 9600 bps: analogReference(INTERNAL); // switch to the internal 1.1V analog reference (use just 'INTERNAL' with the Uno) } void loop() { RH = analogRead(analogPin0); // read the analog RH value T1 = analogRead(analogPin1); // read the analog T value RH = RH * volt * 100; // convert to RH as shown on the datasheet T1 = (T1 * volt *200)-50; // convert to T as shown on the data sheet // print the results to the serial monitor Serial.print("RH = " ); Serial.print(RH,2); Serial.print(" T = "); Serial.println(T1,2); delay(2000); // wait 2 seconds so it's easier to watch the serial output }