Example source code for Maxim Integrated MAX6605 low-power, inexpensive analog output temperature sensor using the MAX32630FTHR analog input. The MAX6605 precision, low-power, inexpensive, analog output temperature sensor is available in a 5-pin SC70 package. The device has a +2.7V to +5.5V supply voltage range and 10µA supply current over the -55°C to +125°C temperature range.

Dependencies:   max32630fthr USBDevice

Files at this revision

API Documentation at this revision

Comitter:
phonemacro
Date:
Sat Apr 27 10:09:59 2019 +0000
Parent:
1:9b9c2989d4eb
Commit message:
initial commit;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Apr 23 04:34:36 2019 +0000
+++ b/main.cpp	Sat Apr 27 10:09:59 2019 +0000
@@ -22,14 +22,14 @@
 AnalogIn ain1(AIN_5);
 const float AIN5_FSV = 6.0f;   /* Full scale value for AIN5 */
 
-float max6613_celsius_to_fahrenheit(float temp_c)
+float celsius_to_fahrenheit(float temp_c)
 {
     float temp_f;
     temp_f = ((temp_c * 9)/5) + 32;
     return temp_f;
 }
 
-void max6613_timer(void) {
+void blink_timer(void) {
         gLED = !gLED;  /* blink the green LED */
 }
 
@@ -37,18 +37,22 @@
 // main() runs in its own thread in the OS
 // (note the calls to Thread::wait below for delays)
 /**
-* @brief Sample main program for MAX6613
+* @brief Sample main program for MAX6605
 * @version 1.0000.0000
 *
-* @details Sample main program for MAX6613
-* The MAX6613 is a low-cost, low-power analog output (1 wire, plus power)
-* temperature sensor in a tiny 5-pin SC70 package (0.65 mm pitch)
-* Supply Current: 7.5µA typical
-* Supply voltage: 1.8V to 5.5V
-* Operating Range: -55°C to +130°C when VDD is 2.5V to 5.5V
-*                   25°C to +130°C when VDD is 1.8V
-* Accuracy: +-4°C
-* Pin Compatible with LM20
+* @details Sample main program for MAX6605
+* The MAX6605 precision, low-power, analog output temperature 
+* sensor is available in a 5-pin SC70 (0.65 mm pitch)package.
+* The device has a +2.7V to +5.5V supply voltage range
+* and 10µA supply current over the -55°C to +125°C temperature range.
+* For the -40°C to +105°C temperature range, the supply voltage can go as low as +2.4V.
+* Supply Current: 10µA
+* Supply voltage: 2.7V to 5.5V
+* Accuracy : ±0.75°C 25°C
+*            ±3.00°C 0.0°C to 70°C
+*            ±3.80°C -20°C to 85°C
+*            ±5.00°C -40°C to 100°C
+*            ±5.80°C -55°C to 125°C
 *
 * The prints are sent to the terminal window (9600, 8n1).
 * The program sets the GPIOs to 3.3V and the program
@@ -63,28 +67,28 @@
 {
     float temperature;
     uint32_t i;
-    const float A = -0.00000225f;
-    const float B = -0.01105f;
-    const float C1 = 1.8455f;
+    const float A = 0.000001604f;
+    const float B = 0.0119f;
+    const float C1 = 0.744f;
     float c2;
     microUSB.printf("micro USB serial port\r\n");
     rLED = LED_OFF;
     gLED = LED_OFF;
     bLED = LED_OFF;
     Ticker ticker;   // calls a callback repeatedly with a timeout
-    ticker.attach(callback(&max6613_timer), 1.0f);  /* set timer for one second */
+    ticker.attach(callback(&blink_timer), 1.0f);  /* set timer for one second */
 
-    daplink.printf("MAX6613 Temperature Sensor\r\n\r\n");
+    daplink.printf("MAX6605 Temperature Sensor\r\n\r\n");
 
-    temperature = (float)((1.8455f - (AIN5_FSV * ain1)) / 0.01123f);
+    temperature = (float)(((AIN5_FSV * ain1) -0.744f) / 0.0119f);
 #if 0
     daplink.printf("AIN1: %1.5f\n", (AIN5_FSV * ain1) );  // analog inputs 1
 #endif
 
     daplink.printf("Temperature using Linear Approximation\r\n");
     for (i = 0; i < 8; i++) {
-        temperature = (float)((1.8455f - (AIN5_FSV * ain1)) / 0.01123f);
-        daplink.printf("temperature: %3.1f degrees C C, %3.1f degrees F\r\n", temperature, max6613_celsius_to_fahrenheit(temperature));
+        temperature = (float)(((AIN5_FSV * ain1) -0.744f) / 0.0119f);
+        daplink.printf("temperature: %3.1f degrees C, %3.1f degrees F\r\n", temperature, celsius_to_fahrenheit(temperature));
         wait(2);
     }
     daplink.printf("\r\n");
@@ -92,8 +96,8 @@
     daplink.printf("Temperature using the Quadratic Equation\r\n");
     for (i = 0; i < 8; i++) {
         c2 = AIN5_FSV * ain1;
-        temperature = (-B - sqrt(B*B - 4*A*(C1-c2)))/(2*A);
-        daplink.printf("temperature: %3.1f degrees C C, %3.1f degrees F\r\n", temperature, max6613_celsius_to_fahrenheit(temperature));
+        temperature = (-B + sqrt(B*B - 4*A*(C1-c2)))/(2*A);
+        daplink.printf("temperature: %3.1f degrees C C, %3.1f degrees F\r\n", temperature, celsius_to_fahrenheit(temperature));
         wait(2);
     }
     daplink.printf("\r\n\r\n");