Microfire LLC Mod-ORP Raspberry Pi Library

Microfire LLC Mod-ORP Raspberry Pi Library

Release Information

Copyright © 2023 Microfire LLC

This documentation is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International (CC BY-ND).

Release History

Release

Date

Description

2.0.0

3/29/2023

Changes for version 2 hardware

1.0.0

5/10/2021

Initial

Legal Disclaimer

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-ORP Raspberry Pi Library

Release Information

Release History

Legal Disclaimer

Library Documentation

Installation

Member Variables

float mV

float tempC

float tempF

float calibrationSingleOffset

int hwVersion

int fwVersion

int status

Member Methods

begin

Definition

Parameters

Return

Example

connected

Definition

Parameters

Return

Example

calibrateSingle

Definition

Parameters

Return

Example

getDeviceInfo

Definition

Parameters

Return

Example

measureORP

Definition

Parameters

Return

Example

measureTemp

Definition

Parameters

Return

Example

reset

Definition

Parameters

Return

Example

setDeviceInfo

Definition

Parameters

Return

Example

setI2CAddress

Definition

Parameters

Return

Example

update

Definition

Parameters

Return

Example


Library Documentation

Installation

This Python library can installed through pip in a terminal:

pip3 install Microfire-Mod-ORP 

Typing python3 -m Microfire_Mod_ORP.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.

Member Variables

float mV

mV value from the probe.

float calibrationSingleOffset

Single offset calibration data. If there is no calibration data present, NaN (not a number) is returned.

int hwVersion

Hardware version of the module.

int fwVersion

Firmware version of the module.

int status

Status code of the last measurement or calibration.

0: STATUS_NO_ERROR

1: STATUS_SYSTEM_ERROR

Member Methods

begin

Initializes the library and determines if the module is connected.

Definition

def begin(i2c_bus=1, address=0x0E)

Parameters

Parameter

Description

i2c_bus

TwoWire I2C interface

address

I2C address of the module

Return

Type

Description

bool

True if the module is connected.

False if the module is disconnected.

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

if not orp.begin():
   print(
"Error")


connected

Determines if the module is connected.

Definition

def connected()

Parameters

Parameter

Description

None

Return

Type

Description

bool

True if the module is connected.

False if the module is disconnected.

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
if not orp.connected():
   print(
"Error")


calibrateSingle

Performs a single-point calibration. status and calibrationSingleOffset are updated. It takes 750 ms to complete a measurement.

Definition

def calibrateSingle(solution_mV, blocking=True)

Parameters

Parameter

Description

solution_mV

The mV of the calibration solution.

blocking

Return immediately or wait for the module to complete the calibration

Return

Type

Description

int

An error code for the measurement. Can be one of the following:

0: no error

1: system error

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
orp.calibrateSingle(
600.0)

if orp.status:
   print(
"Error: " + orp.status_string[orp.status])


getDeviceInfo

Updates all measurement, calibration, and system registers with the most recent information.

Definition

def getDeviceInfo()

Parameters

Parameter

Description

None

Return

Type

Description

None

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
orp.getDeviceInfo()
# The following variables are updated:
#   orp.hwVersion, orp.fwVersion
#   orp.calibrationSingleOffset


measureORP

Starts an ORP measurement.

Member variables mV and status are updated.

Definition

def measureORP(blocking=True)

Parameters

Parameter

Description

blocking

Return immediately or wait for the module to complete the measurement

Return

Type

Description

float

The solution-under-test’s ORP value.

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
orp.measureORP()

if orp.status:
   print(
"Error: " + orp.status_string[orp.status])
else:
   print(
"{:.2f}".format(orp.mV) + " mV")


reset

Resets all calibration data to the empty value of NaN (not a number).

Definition

def reset()

Parameters

Parameter

Description

None

Return

Type

Description

None

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
orp.reset()


setDeviceInfo

Sets all the device calibration registers with a specified value.

Definition

def setDeviceInfo(calibrationSingleOffset)

Parameters

Parameter

Description

calibrationSingleOffset

Single-offset calibration data

Return

Type

Description

None

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
orp.setDeviceInfo(
561.2)


setI2CAddress

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.

Definition

def setI2CAddress(i2cAddress)

Parameters

Parameter

Description

int

New I2C address

Return

Type

Description

None

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
orp.setI2CAddress(
0x0F)


update

If  blocking is set to false when measureORP is called, this method will update mV. This allows the controlling device to do other work rather than wait for the module to complete the measurement.

Definition

def update()

Parameters

Parameter

Description

None

Return

Type

Description

None

Example

import Microfire_Mod_ORP
orp = Microfire_Mod_ORP.i2c()

orp.begin()
orp.measureORP(blocking=
False)
# blocking=False above, do other work for at least 750 ms
orp.update()