Microfire LLC Mod-NTC Raspberry Pi Library
Copyright © 2023 Microfire LLC
This documentation is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND).
Release | Date | Description |
1.0.0 | 5/1/2023 | Initial |
TECHNICAL AND RELIABILITY DATA FOR MICROFIRE LLC PRODUCTS (INCLUDING DATASHEETS) AS MODIFIED FROM TIME TO TIME (“RESOURCES”) ARE PROVIDED BY MICROFIRE LLC "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW IN NO EVENT SHALL MICROFIRE LLC BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE RESOURCES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MICROFIRE LLC reserves the right to make any enhancements, improvements, corrections or any other modifications to the RESOURCES or any products described in them at any time and without further notice.
The RESOURCES are intended for skilled users with suitable levels of design knowledge. Users are solely responsible for their selection and use of the RESOURCES and any application of the products described in them. User agrees to indemnify and hold MICROFIRE LLC harmless against all liabilities, costs, damages or other losses arising out of their use of the RESOURCES.
HIGH RISK ACTIVITIES. MICROFIRE LLC products are not designed, manufactured or intended for use in hazardous environments requiring fail safe performance, such as in the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, weapons systems or safety-critical applications (including life support systems and other medical devices), in which the failure of the products could lead directly to death, personal injury or severe physical or environmental damage, or business loss (“High Risk Activities”). MICROFIRE LLC specifically disclaims any express or implied warranty of fitness for High Risk Activities and accepts no liability for use or inclusions of MICROFIRE LLC products in High Risk Activities.
Microfire LLC Mod-NTC Raspberry Pi Library
This Python library can be installed through pip in a terminal:
pip3 install Microfire-Mod-NTC |
Typing python3 -m Microfire_Mod_NTC.shell will start the shell application and give access to all features and functions of the module. Type help to see a listing of the commands available.
Result of the last temperature measurement, in Celsius.
Result of the last temperature measurement, in Fahrenheit.
Result of the last temperature measurement, in Kelvin.
Result of the last measurement, in resistance (ohms).
The beta value of the connected temperature sensor.
Hardware version of the module.
Firmware version of the module.
Status code of the last measurement or calibration.
0: STATUS_NO_ERROR
1: STATUS_NO_PROBE
2: STATUS_SYSTEM_ERROR
Initializes the library and determines if the module is connected.
def begin(i2c_bus=1, address=0x0C) |
Parameter | Description |
i2c_bus | TwoWire I2C interface |
address | I2C address of the module |
Type | Description |
bool | True if the module is connected. False if the module is disconnected. |
import Microfire_Mod_NTC |
Determines if the module is connected.
def connected() |
Parameter | Description |
None |
Type | Description |
bool | True if the module is connected. False if the module is disconnected. |
import Microfire_Mod_NTC |
Starts a temperature measurement. A measurement takes 150 ms to complete.
Member variables tempC, tempF, tempK, and status are updated.
def measureTemp(blocking=True) |
Parameter | Description |
blocking | Return immediately or wait for the module to complete the measurement |
Type | Description |
float | The solution-under-test’s temperature in Celsius. |
import Microfire_Mod_NTC print(str("{:.3f}".format(ntc.tempF)) + "°F") print(str("{:.3f}".format(ntc.tempK)) + "K") |
Resets calibration beta to the default value of 3977.0.
def reset() |
Parameter | Description |
None |
Type | Description |
None |
import Microfire_Mod_NTC |
Changes the beta value for the connected temperature sensor. The value is saved and used across power resets.
def setBeta(float beta); |
Parameter | Description |
float | New beta value |
Type | Description |
None |
import Microfire_Mod_NTC |
Changes the I2C address of the module. The change is stored and used again after a power-cycle.
Note: The library will use the new I2C address after calling this method, but the address must be stored and begin must be appropriately called with the new address on subsequent initialization.
def setI2CAddress(i2cAddress) |
Parameter | Description |
int | New I2C address |
Type | Description |
None |
import Microfire_Mod_NTC |
If blocking is set to false when measureTemp is called, this method will update tempC, tempF, tempK, and resistance. This allows the controlling device to do other work rather than wait for the module to complete the measurement.
def update() |
Parameter | Description |
None |
Type | Description |
None |
import Microfire_Mod_NTC |