GreenPonik_Atlas_Scientific_OEM_i2c package

GreenPonik_Atlas_Scientific_OEM_i2c.AtlasOEMI2c module

Description

Class to communicate with Atlas Scientific OEM sensors in I2C mode. Atlas Scientific i2c by GreenPonik Source code is based on Atlas Scientific documentations:

https://www.atlas-scientific.com/files/EC_oem_datasheet.pdf

https://atlas-scientific.com/files/oem_pH_datasheet.pdf

class GreenPonik_Atlas_Scientific_OEM_i2c.AtlasOEMI2c._AtlasOEMI2c(bus=1, addr=None, moduletype='')

Bases: object

ADDR_OEM_DECIMAL = {100, 101, 102, 103}

Array value of each OEM sensors decimal addresses

ADDR_OEM_HEXA = {100, 101, 102, 103}

Array key=>value for each OEM sensors i2c hexa addresses

ADDR_OEM_HEXA_TO_DECIMAL = {100: 100, 101: 101, 102: 102, 103: 103}

Array key=>value for each OEM sensors i2c hexa to decimal addresses

ADDR_OEM_TXT_TO_HEXA = {'DO': 103, 'EC': 100, 'ORP': 102, 'PH': 101}

Array key=>value for each OEM sensors name i2c hexa addresses

ALLOWED_MODULES_TYPES = {'EC', 'PH'}
DEFAULT_BUS = 1
DEFAULT_LONG_TIMEOUT = 1.5
DEFAULT_SHORT_TIMEOUT = 0.3
EC_BINARY_CALIB_STATUS = {0: 'nothing', 1: 'only dry', 2: 'only single', 3: 'dry and single', 4: 'only low', 5: 'dry and low', 6: 'single and low', 7: 'dry, single and low', 8: 'only high', 9: 'dry and high', 10: 'single and high', 11: 'dry, single and high', 12: 'low and high', 13: 'dry, low and high', 14: 'single, low and high', 15: 'all'}
FOUR_BYTE_READ = 4
OEM_EC_REGISTERS = {'device_addr': 3, 'device_addr_lock': 2, 'device_calibration_confirm': 15, 'device_calibration_high': 11, 'device_calibration_low': 12, 'device_calibration_lsb': 13, 'device_calibration_msb': 10, 'device_calibration_request': 14, 'device_ec_high': 25, 'device_ec_low': 32, 'device_ec_lsb': 33, 'device_ec_msb': 24, 'device_firmware': 1, 'device_intr': 4, 'device_led': 5, 'device_new_reading': 7, 'device_probe_type_lsb': 9, 'device_probe_type_msb': 8, 'device_salinity_high': 33, 'device_salinity_low': 34, 'device_salinity_lsb': 35, 'device_salinity_msb': 32, 'device_sleep': 6, 'device_tds_high': 29, 'device_tds_low': 30, 'device_tds_lsb': 31, 'device_tds_msb': 28, 'device_temperature_comp_high': 17, 'device_temperature_comp_low': 18, 'device_temperature_comp_lsb': 19, 'device_temperature_comp_msb': 16, 'device_temperature_confirm_high': 21, 'device_temperature_confirm_low': 22, 'device_temperature_confirm_lsb': 23, 'device_temperature_confirm_msb': 20, 'device_type': 0}
OEM_PH_REGISTERS = {'device_addr': 3, 'device_addr_lock': 2, 'device_calibration_confirm': 13, 'device_calibration_high': 9, 'device_calibration_low': 10, 'device_calibration_lsb': 11, 'device_calibration_msb': 8, 'device_calibration_request': 12, 'device_firmware': 1, 'device_intr': 4, 'device_led': 5, 'device_new_reading': 7, 'device_ph_high': 23, 'device_ph_low': 24, 'device_ph_lsb': 25, 'device_ph_msb': 22, 'device_sleep': 6, 'device_temperature_comp_high': 15, 'device_temperature_comp_low': 16, 'device_temperature_comp_lsb': 17, 'device_temperature_comp_msb': 14, 'device_temperature_confirm_high': 19, 'device_temperature_confirm_low': 20, 'device_temperature_confirm_lsb': 21, 'device_temperature_confirm_msb': 18, 'device_type': 0}
ONE_BYTE_READ = 1
PH_BINARY_CALIB_STATUS = {0: 'nothing', 1: 'only low', 2: 'only mid', 3: 'low and mid', 4: 'only high', 5: 'low and high', 6: 'mid and high', 7: 'all'}
THREE_BYTE_READ = 3
TWO_BYTE_READ = 2
property address

getter i2c address of the device

Returns

i2c address of the device on the i2c bus

Return type

int

property bus_number

bus_number property

Returns

the i2c bus number

Return type

int

property debug

debug property

Getter

debug flag

Setter

change debug flag

Returns:

bool: True if the debug mode is ON, False if not

list_i2c_devices() list

get i2c devices on the bus :return: list of i2c addresses on the bus :rtype: list

property long_timeout

long delay to wait

Returns

long delay in milliseconds

Return type

int

property moduletype

getter module type

Returns

get module type

Return type

string

property name

name of OEM circuit

Returns

name of OEM circuit

Return type

string

print_all_registers_values()

Print all register values

read(register: int, num_of_bytes=1) bytes

read data from i2c bus :param register > int i2c register to read :param num_of_byte > int number of bytes to read started from the register :return: raw value from i2c bus :rtype: bytes

property short_timeout

short delay to wait

Returns

short delay in milliseconds

Return type

int

write(register: int, v)

write data through i2c bus :param register > int i2c register to read :param v > int/bytearray to write through i2c

GreenPonik_Atlas_Scientific_OEM_i2c.CommonsI2c module

Description

Class to communicate with Atlas Scientific OEM sensors in I2C mode. Atlas Scientific i2c by GreenPonik Source code is based on Atlas Scientific documentations:

https://www.atlas-scientific.com/files/EC_oem_datasheet.pdf

https://atlas-scientific.com/files/oem_pH_datasheet.pdf

class GreenPonik_Atlas_Scientific_OEM_i2c.CommonsI2c._CommonsI2c(bus=1, addr=None, moduletype='')

Bases: GreenPonik_Atlas_Scientific_OEM_i2c.AtlasOEMI2c._AtlasOEMI2c

commons methods for EC and PH OEM circuits

_check_calibration_confirm(confirm)

check the response of calibration confirm register

_convert_raw_hex_to_float(byte_array)

convert bytearray response to float result return float converted value

_set_calibration_registers(value)

calibration registers do not use alone because calibration is apply by using set_calibration_apply /!in float micro siemens µS for EC/! /! in float for pH/!

get_calibration()

Get current calibrations data :return: string with current points calibrated :rtype:

get_device_info()

Get device information @return string module type, firmware version

get_firmware()

Read sensor firmware @return int the firmware revision

get_led() int

Get led state register is the same for EC and PH OEM circuit :return: int 0x00 = OFF or 0x01 = ON :rtype: int

get_new_read_available()

New Read is available @return int 1 if new read available, 0 if not

get_read()

Read sensor value @return float the sensor value

get_temperature()

Get current compensation temperature @return float temperature value

get_type()

Read sensor type @return int the sensor type (1=EC, 4=PH)

get_wakeup_sleep_mode() int

get Active or Hibernate device mode register is the same for EC and PH OEM circuit :return: int 0x01 = WakeUp or 0x00 = Hibernate :rtype: int

set_ack_new_read_available()

Ack new Read available

set_calibration_apply(value, point='')

apply the calibration

Parameters
  • value – float solution calibration value converted in float. EC waiting for µS e.g. 1.413 = > 1413.0

  • point – string “dry”, “single”, “low”, “mid”, “high” only

set_calibration_clear()

clear calibration data

set_i2c_addr(addr)

Change the device i2c address

Parameters

addr – int = new i2c add

set_led(state=1)

Change Led state

Parameters

state – byte state => 0x01 = ON or 0x00 = OFF

set_temperature(t=25.0)

Set the compensation temperature

Parameters

t – float temperature value

set_wakeup_sleep_mode(action=1)

change device mode to Active or Hibernate register is the same for EC and PH OEM circuit

Parameters

byte – action => 0x01 = WakeUp or 0x00 = Hibernate

GreenPonik_Atlas_Scientific_OEM_i2c.ECI2c module

Description

Class to communicate with Atlas Scientific OEM sensors in I2C mode. Atlas Scientific i2c by GreenPonik Source code is based on Atlas Scientific documentations:

https://www.atlas-scientific.com/files/EC_oem_datasheet.pdf

https://atlas-scientific.com/files/oem_pH_datasheet.pdf

class GreenPonik_Atlas_Scientific_OEM_i2c.ECI2c.ECI2c(bus=1, addr=None, moduletype='')

Bases: GreenPonik_Atlas_Scientific_OEM_i2c.CommonsI2c._CommonsI2c

specific methods for OEM EC module

get_k_probe()

Get current ec probe k

set_k_probe(k)

Set the ec probe k

GreenPonik_Atlas_Scientific_OEM_i2c.PHI2c module

Description

Class to communicate with Atlas Scientific OEM sensors in I2C mode. Atlas Scientific i2c by GreenPonik Source code is based on Atlas Scientific documentations:

https://www.atlas-scientific.com/files/EC_oem_datasheet.pdf

https://atlas-scientific.com/files/oem_pH_datasheet.pdf

class GreenPonik_Atlas_Scientific_OEM_i2c.PHI2c.PHI2c(bus=1, addr=None, moduletype='')

Bases: GreenPonik_Atlas_Scientific_OEM_i2c.CommonsI2c._CommonsI2c

specific methods for OEM PH module

get_slope_probe()

Get the pH probe slope