Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.

mzwaterski's Content

There have been 2 items by mzwaterski (Search limited from 25-September 23)


By content type

See this member's

Sort by                Order  

#14160 Thermistor Help

Posted by mzwaterski on 09 June 2011 - 07:35 PM in Netduino Plus 2 (and Netduino Plus 1)

Those are available in the Math library. Math.Pow(), Math.Log()

-dan


Thanks for your response. I tried this, and the Pow() function now works, but the Log() function is not working (e.g., System.Math.Log(ThermResistance / ThermRefResistance) reports that System.Math does not contain a definition for 'Log'). Do I need to somehow get a different Math library or version of something?

Thanks in advance for any help that you can provide.

Mike



#14096 Thermistor Help

Posted by mzwaterski on 08 June 2011 - 07:31 PM in Netduino Plus 2 (and Netduino Plus 1)

Below is how I applied it in C. If you have any questions, let me know!


//ADC_Value Accepted, Farenheit Returned
	double GetFarenheit(int ADC_Value)
	{
		//Define reference voltage
		double Vref = 5;

		//Define thremistor value
		double ThermRefResistance = 10000;
	
		//Convert ADC reading to a voltage
		double Vin = (Vref * ADC_Value) / 1024;
	
		//Convert Voltage to resistance
		double ThermResistance = ThermRefResistance/((Vref/Vin)-1);

		// Steinhart constants for thermistor (Vishay NTCLE203E3103FB0)
		double a = 3.354016 * pow(10, -3);
		double b = 2.56985 * pow(10, -4);
		double c = 2.620131 * pow(10, -6);
		double d = 6.383091 * pow(10, -8);

		//Convert resistance to temperature in degrees C (Steinhart equation)
		double Celcius = 1/(a + b * log(ThermResistance/ThermRefResistance) + c * pow(log(ThermResistance/ThermRefResistance), 2) + d * pow(log(ThermResistance/ThermRefResistance), 3)) - 272.15;
		
		//Convert celcius to farenheit

		return Farenheit = 18 * Celcius + 320;

	}


Is it possible to use this code with the Netduino? When I try and use this, I'm told that the pow() and log() functions do not exist. Is there a package that I need to add to my environment?




home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.