Beschreibung
Ziel der Schaltung war es die Raumtemperatur in unserem Wohnzimmer über eine längeren Zeitraum zu messen. Der LM35 wird mit 5V versorgt und wandelt die Temperatur in eine Spannung um. Die Ausgangsspannung beträgt 10nV/1 C°.

Bekannte Nachteile
– Den Aufbau kann man nicht kalibrieren oder nur durch ändern des Codes.
– Es können keine negativen Temperaturen gemessen werden (ca. 2 ..150C°).
– Die Temperatur wird mit Zeitverschiebung angezeigt. Das bedeutet, dass zu jedem Zyklus die Zeit der Messung addiert wird, was den Zyklus etwas streckt.
Benötigte Bauteile
1x Arduino UNO
1x SD-Card Shield
1x LM35 TO-92
1x 3 Adrige Litze
1x SC-Card ca. 128 MB
Code
/* SD card datalogger This example shows how to log data from three analog sensors to an SD card using the SD library. The circuit: * analog sensors on analog ins 0, 1, and 2 * SD card attached to SPI bus as follows: ** MOSI - pin 11 ** MISO - pin 12 ** CLK - pin 13 ** CS - pin 4 created 24 Nov 2010 modified 9 Apr 2012 by Tom Igoe This example code is in the public domain. */ #include <SD.h> // On the Ethernet Shield, CS is pin 4. Note that even if it's not // used as the CS pin, the hardware CS pin (10 on most Arduino boards, // 53 on the Mega) must be left as an output or the SD library // functions will not work. const int chipSelect = 4; const int led = 13; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); Serial.print("Initializing SD card..."); // make sure that the default chip select pin is set to // output, even if you don't use it: pinMode(10, OUTPUT); pinMode(led, OUTPUT); // see if the card is present and can be initialized: if (!SD.begin(chipSelect)) { Serial.println("Card failed, or not present"); // don't do anything more: return; } Serial.println("card initialized."); analogReference(INTERNAL); } void loop() { digitalWrite(led, HIGH); // make a string for assembling the data to log: String dataString = ""; word HelpAd; // read three sensors and append to the string: HelpAd = 0; for (int i = 8; i; i--) { HelpAd += analogRead(1); } //wert mitteln word wSensor = HelpAd >> 3; float fSeneor = wSensor * 0.1075; // Scalieren // open the file. note that only one file can be open at a time, // so you have to close this one before opening another. File dataFile = SD.open("datalog.txt", FILE_WRITE); // if the file is available, write to it: if (dataFile) { dataFile.println(fSeneor, 2); dataFile.close(); // print to the serial port too: Serial.println(fSeneor, 2); } // if the file isn't open, pop up an error: else { Serial.println("error opening datalog.txt"); } digitalWrite(led, LOW); delay(1000); }