Skip to main content

Project Based Engineering Instrumentation High Level Coding and Microcontrollers

Section 20.1 Initial Setup

There is no wiring diagram for this project because we’re using the thermistor that’s already on the CPX/CPB. The code to read the thermistor is pretty simple and is shown below. Remember that the thermistor is a resistor that changes with temperature. The ADC on the CPX converts the voltage across the thermistor to temperature. The Adafruit Learn system does a bit of work to explain the conversion from voltage to temperature and is also explained in Subsection 15.1.3[32]. Just remember that the thermistor on pin A9 is connected to the high side of the voltage divider which effects the equations to compute the resistance and voltage in the thermistor. My version of the code is also on my Github[33]. A simple version of the code is shown below but note that the code is from a much earlier and simpler version of my code which only reads the temperature in Celsius. The code on my Github has more functionality such as printing the raw ADC value and the voltage.
Figure 20.1.1. Read thermistor data code in CircuitPython