#1
Сообщение
igrik1972 » 02.03.2017{, 01:42}
может кто-то создать правильный блок..... в схеме реализован Термистор НТС (+ ножка 1, 2 ножка на резисторы паралельно по 15 кОм и к аналоговому входу, -) ............ проверенно вот схема.......
#include <math.h>
#define ThermistorPIN 0 // Analog Pin 0
float vcc = 4.91; // only used for display purposes, if used
// set to the measured Vcc.
float pad = 7350; // balance/pad resistor value, set this to
// the measured resistance of your pad resistor
float thermr = 1000; // thermistor nominal resistance
float Thermistor(int RawADC) {
long Resistance;
float Temp; // Dual-Purpose variable to save space.
Resistance=pad*((1024.0 / RawADC) - 1);
Temp = log(Resistance); // Saving the Log(resistance) so not to calculate it 4 times later
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp - 273.15; // Convert Kelvin to Celsius
// BEGIN- Remove these lines for the function not to display anything
Serial.print("ADC: ");
Serial.print(RawADC);
Serial.print("/1024");
// Print out RAW ADC Number
Serial.print(", vcc: ");
Serial.print(vcc,2);
Serial.print(", pad: ");
Serial.print(pad/1000,3);
Serial.print(" Kohms, Volts: ");
Serial.print(((RawADC*vcc)/1024.0),3);
Serial.print(", Resistance: ");
Serial.print(Resistance);
Serial.print(" ohms, ");
// END- Remove these lines for the function not to display anything
// Uncomment this line for the function to return Fahrenheit instead.
//temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert to Fahrenheit
return Temp; // Return the Temperature
}
void setup() {
Serial.begin(9600);
}
void loop() {
float temp;
temp=Thermistor(analogRead(ThermistorPIN)); // read ADC and convert it to Celsius
Serial.print("Celsius: ");
Serial.print(temp,1); // display Celsius
//temp = (temp * 9.0)/ 5.0 + 32.0; // converts to Fahrenheit
//Serial.print(", Fahrenheit: ");
//Serial.print(temp,1); // display Fahrenheit
Serial.println("");
delay(5000); // Delay a bit...
}
в блоке нужен выход один.... float t_termistor