Calculate temperature based on resistance from thermistor with lookup chart
thermister_ert-j0eg1.h@6:3c9cb2bd08c6, 2016-04-02 (annotated)
- Committer:
- joeata2wh
- Date:
- Sat Apr 02 03:48:56 2016 +0000
- Revision:
- 6:3c9cb2bd08c6
- Parent:
- 5:88bf5a42812e
basic data log working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joeata2wh | 6:3c9cb2bd08c6 | 1 | /* thermister_ert-j0eg1.h |
joeata2wh | 6:3c9cb2bd08c6 | 2 | Read the ERT0xxx thermister and return the temperature |
joeata2wh | 6:3c9cb2bd08c6 | 3 | in C on the specified pin. Includes lookup table to |
joeata2wh | 6:3c9cb2bd08c6 | 4 | compute precision temperature based on non-linear |
joeata2wh | 6:3c9cb2bd08c6 | 5 | change of resistance in thermister. |
joeata2wh | 6:3c9cb2bd08c6 | 6 | |
joeata2wh | 6:3c9cb2bd08c6 | 7 | Update the resitance array in cpp to properly reflect |
joeata2wh | 6:3c9cb2bd08c6 | 8 | your specific device. |
joeata2wh | 6:3c9cb2bd08c6 | 9 | |
joeata2wh | 6:3c9cb2bd08c6 | 10 | By Joseph Ellsworth CTO of A2WH |
joeata2wh | 6:3c9cb2bd08c6 | 11 | Take a look at A2WH.com Producing Water from Air using Solar Energy |
joeata2wh | 6:3c9cb2bd08c6 | 12 | March-2016 License: https://developer.mbed.org/handbook/MIT-Licence |
joeata2wh | 6:3c9cb2bd08c6 | 13 | */ |
joeata2wh | 0:39f659087759 | 14 | #ifndef thermister_ert_j0eg1_h |
joeata2wh | 0:39f659087759 | 15 | #define thermister_ert_j0eg1_h |
joeata2wh | 5:88bf5a42812e | 16 | #define ERTThermisterAdcRef 3.30f |
joeata2wh | 5:88bf5a42812e | 17 | #define ERTThermisterErrorOver 255.0f |
joeata2wh | 5:88bf5a42812e | 18 | #define ERTThermisterErrorUnder -255.0f |
joeata2wh | 0:39f659087759 | 19 | |
joeata2wh | 0:39f659087759 | 20 | float conv_c_to_f(float tempC); |
joeata2wh | 5:88bf5a42812e | 21 | float conv_f_to_c(float tempF); |
joeata2wh | 5:88bf5a42812e | 22 | float ERTThermisterReadTemp(AnalogIn adcpin); |
joeata2wh | 5:88bf5a42812e | 23 | float ERTThermisterAvgReadTemp(AnalogIn adcpin, int numRead); |
joeata2wh | 5:88bf5a42812e | 24 | |
joeata2wh | 5:88bf5a42812e | 25 | |
joeata2wh | 5:88bf5a42812e | 26 | |
joeata2wh | 5:88bf5a42812e | 27 | // Shorthand to read thermister by pinName |
joeata2wh | 5:88bf5a42812e | 28 | // rather than reading it with pre-allocated |
joeata2wh | 5:88bf5a42812e | 29 | // AnalogIn. |
joeata2wh | 5:88bf5a42812e | 30 | float ERTThermisterRead(PinName apin); |
joeata2wh | 5:88bf5a42812e | 31 | |
joeata2wh | 5:88bf5a42812e | 32 | // read the temp from thermister and print out |
joeata2wh | 5:88bf5a42812e | 33 | // both the reading and intermediate values. |
joeata2wh | 5:88bf5a42812e | 34 | float ERTThermisterReadPrint(Serial log, char *label, PinName apin); |
joeata2wh | 0:39f659087759 | 35 | |
joeata2wh | 0:39f659087759 | 36 | #endif |