The LMT84 temperature sensor (U1) and the TLV2472 amplifier (U2). More...
Functions | |
| set_output_pin (name) | |
| Selects the pin the amplifier's output is read on, to match jumper JP2. | |
| set_supply_volts (volts=5.0) | |
| Sets the voltage of the shield's +5V rail, for a more accurate offset. | |
| amplifier_gain () | |
| The amplifier's (U2A) gain, from the shield's resistor values. | |
| amplifier_offset_volts () | |
| The voltage the amplifier (U2A) takes off its output. | |
| output_volts () | |
| Reads the signal at the end of the chain (TEMP_SIG) on A3 or A0. | |
| amplifier_volts () | |
| Works out the amplifier's output (OPA_OUT), before the R14/R15 divider. | |
| sensor_volts () | |
| Works out the sensor's voltage (SENSOR_IN) from the amplifier's output. | |
| raw_sensor_volts () | |
| Reads the sensor's voltage (SENSOR_IN) directly, on A1. | |
| temperature_from_volts (volts) | |
| Converts an LMT84 output voltage to a temperature. | |
| temperature () | |
| Reads the on-board LMT84 temperature sensor through the amplifier. | |
The LMT84 temperature sensor (U1) and the TLV2472 amplifier (U2).
The chain, as on the schematic:
| Stage | Signal | Read with |
|---|---|---|
| Sensor: LMT84 (JP1 on INT) or J1 (JP1 on EXT) | SENSOR_IN, about 0.18-1.3 V | raw_sensor_volts() on A1; sensor_volts() works it out from the end of the chain |
| U2A: non-inverting amplifier with an offset | sensor * 4.35 - 0.648 V | amplifier_volts(), amplifier_gain(), amplifier_offset_volts() |
| U2B: unity-gain low-pass filter, about 10.7 kHz | OPA_OUT, 0-5 V, also on J8 pin 4 | amplifier_volts() |
| R14/R15 divider, x 0.411 on A0; x 0.395 on A3, with the Phyduino Pico's 100 kOhm pulldown (R49) | TEMP_SIG, 0-2.05 V | output_volts() on A3 (JP2 on EXT) or A0 (JP2 on INT) |
temperature() runs the whole chain backwards and converts the sensor voltage with the LMT84's datasheet curve. The amplifier spreads about -50 to 150 °C over the A3 input's 0-2.048 V.
| set_output_pin | ( | name | ) |
Selects the pin the amplifier's output is read on, to match jumper JP2.
JP2 on EXT connects the amplifier to A3, read by the Phyduino's MAX11635 against its 2.048 V reference (0.5 mV steps). JP2 on INT connects it to A0, read by the RP2040 (0.8 mV steps, less accurate).
| name | "A3" (the default) or "A0". |
| ValueError | Not "A3" or "A0". |
| set_supply_volts | ( | volts = 5.0 | ) |
Sets the voltage of the shield's +5V rail, for a more accurate offset.
The amplifier's offset comes from a divider on the +5V rail (selected by JP4), so it moves with the supply: 0.1 V off gives about 0.5 °C. Measure the rail (J8 pin 1 to pin 3) and give the value here.
| volts | The rail voltage, 4-6 V. |
| ValueError | Not 4-6 V. |
| amplifier_gain | ( | ) |
The amplifier's (U2A) gain, from the shield's resistor values.
| amplifier_offset_volts | ( | ) |
The voltage the amplifier (U2A) takes off its output.
Its output is sensor_volts() * amplifier_gain() - amplifier_offset_volts().
| output_volts | ( | ) |
Reads the signal at the end of the chain (TEMP_SIG) on A3 or A0.
This is the amplifier's output after the R14/R15 divider, about 0-2.05 V on A0. On A3 it is about 4 % lower (up to 1.97 V), as the Phyduino Pico's 100 kOhm pulldown on A3 (R49) also loads the divider. Set the pin with set_output_pin(). Use mcu.analog_averaging() for steadier readings.
| OSError | The Phyduino's external ADC did not respond (A3). |
| amplifier_volts | ( | ) |
Works out the amplifier's output (OPA_OUT), before the R14/R15 divider.
Also on J8 pin 4, to check with a meter. Allows for the Phyduino Pico's pulldown on A3, so A3 and A0 give the same result.
| OSError | The Phyduino's external ADC did not respond (A3). |
| sensor_volts | ( | ) |
Works out the sensor's voltage (SENSOR_IN) from the amplifier's output.
The sensor is the on-board LMT84 with JP1 on INT, or the one on J1 with JP1 on EXT. The amplifier covers about 0.15-1.29 V.
| OSError | The Phyduino's external ADC did not respond (A3). |
| raw_sensor_volts | ( | ) |
Reads the sensor's voltage (SENSOR_IN) directly, on A1.
No amplifier, so about three times coarser than sensor_volts(). The two should agree to within about 10 mV.
| temperature_from_volts | ( | volts | ) |
Converts an LMT84 output voltage to a temperature.
Uses the datasheet's parabolic fit, accurate to about 0.5 °C over -50 to 150 °C.
| volts | The sensor's output in volts, about 0.18-1.30 V. |
| temperature | ( | ) |
Reads the on-board LMT84 temperature sensor through the amplifier.
Needs JP1 on INT and JP2 set as in set_output_pin(). Covers about -50 to 150 °C; outside that the amplifier's output is at a rail and the reading stops changing.
| OSError | The Phyduino's external ADC did not respond (A3). |