ARDUINO:  ACTIVE SENSOR THERMOMETER



ITALIANO   ENGLISH    ESPAÑOL

INTRODUCTION

This is a ambient thermometer based on the active sensor made by Microchip. The device is the MCP9701. The most characteristic of this device is the temperature representation by a voltage and its output characteristic defined by the formula:

vout = tc * ta + vout0

where vout0 is the voltage at 0 °C while tc is the temperature coefficient.

The tc for the MCP 9071 / A is 19.5 mV / °C while for the MCP9700 / A is 10 mV / °C.

The output voltage vout0 for the MCP9701 / A is 400mV. The temperature ta, note the voltage vout, is

ta = (vout- vout0) / tc

 The value of Vout is obtained by averaging 1024 samples of the voltage on the pin A0 that is connected to the sensor output. The value of ta will be calculated by the formula and shown on the serial monitor of the IDE program on the PC. You can use the the IDE serial plotter  to see a graphic of the time evolution of the temperature.

  HARDWARE IMPLEMENTATION

The hardware implementation is executed by using the Arduino MEGA 2560 card: just connect the active sensor as shown in the figure. Pin A0 is set as an analog input for converting the output voltage of the sensor to the AD.

microst.it

SOFTWARE  IMPLEMENTATION 

Here the code ( for arduino ) . This code can be downloaded at this link: ActiveTherm.zip

/*

 Termometro basato su sensore attivo MCP9701 della Microchip. Il sensore ha una caratteristica di uscita lineare
 definita dalla formula: Vout = tc * ta + v0
 dove v0 e' la tensione a 0°C mentre tc e' il coeffcinete di temperatura.
 tc per il MCP 9071 /A é di 19.5 mV/°C mentre per il MCP9700/A e' di 10 mV/°C
 Vout0 per il MCP9701/A vale 400mV.
 la tempertaura,nota la tensione vout, e'
 ta = (vout- vout0)/tc
 Il valore di Vout si ottiene facendo la media di 1024 valori acquisendo la tensione sul pin A0
 che e' collegato all'uscita del sensore. Il valore di ta sara' calcolato dalla formula e mostrato sul monitor seriale.
*/


// set pin numbers:

const int in = A0;            // ingresso tensione uscita sensore

// set constants:
const float vout0 = 400;   //  tensione di uscita vout in mV del mcp9701 a 0°C
const float tc = 19.53;      /// mV for °C coefficiente di temperatura del MCP9701/A

// variables:

int i, f;
float vout, vout_avg, ta;


// MAIN PROGRAM

void setup() {
 Serial.begin(9600);
 pinMode(in, INPUT);            // setta il pin IN come input
 pinMode(13, OUTPUT);            // setta il pin IN come input
 digitalWrite(13, LOW);
 analogReference(DEFAULT);

}

void loop() {
 vout_avg = 0;
 for (i = 0; i < 1024; i++) {
   vout = analogRead(A0) * (4976.30 / 1023);
   //Serial.println(vout);
   vout_avg = vout_avg + vout;
 }
 vout = vout_avg / 1024;
 //Serial.println(vout);
 ta = (vout - vout0) / tc;
 Serial.print("temperatura misurata ( gradi centigradi)   = " );
 Serial.println(ta);
 delay (1000);
}

VIDEO

This video shows the connection between the active sensor  MCP9701 and the Arduino Mega 2560. In the PC monitor where the IDE programm is running the temperature is shown using the serial monitor of the IDE program