Data Gator
Hardware and software documentation for the Data Gator project.
Loading...
Searching...
No Matches
AtlasEZOpH Class Reference

Defines an I2C pH sensor which inherits from pHSensor.hpp. More...

#include <Atlas_EZO-pH.hpp>

Inheritance diagram for AtlasEZOpH:
Collaboration diagram for AtlasEZOpH:

Public Member Functions

 AtlasEZOpH (int address)
 
bool sensor_at_address (int address)
 Check if sensor present at address.
 
double getpH (double)
 Convert voltage reading to pH value.
 
double getpH (int address)
 Reads pH value from sensor as a double on the pH scale.
 
double getpH ()
 Returns a pH measurement from the default sensor address.
 
chargetpH_str (int address)
 Get the pH reading as a string.
 
void clear_pH_str (void)
 
std::string getSensorType (void)
 Get the string identifier for the Atlas EZO pH sensor. For use in MQTT topics and debugging.
 
std::string toJSON (double voltage)
 Converts a pH voltage reading to a JSON object string for MQTT and debugging.
 

Private Attributes

byte received_from_computer = 0
 we need to know how many characters have been received.
 
byte serial_event = 0
 a flag to signal when data has been received from the pc/mac/other.
 
byte code = 0
 used to hold the I2C response code.
 
char ph_data [32]
 we make a 32 byte character array to hold incoming data from the pH circuit.
 
byte in_char = 0
 used as a 1 byte buffer to store inbound bytes from the pH Circuit.
 
byte i = 0
 counter used for ph_data array.
 
int address = 99
 default i2c address
 

Detailed Description

Defines an I2C pH sensor which inherits from pHSensor.hpp.

This sensor uses the I2C bus and is designed to support the usage of multiple sensors with a single system. A three address standard is defined for connecting three sensors to the same microcontroller. If desired, however, more sensors may be connected as long as each is configured with its own address.

See the configuration guides from the manufacturer or the guides written for the Data Gator project to configure the I2C address of your sensor.

Member Function Documentation

◆ getpH() [1/3]

double AtlasEZOpH::getpH ( )
inline

Returns a pH measurement from the default sensor address.

This function is the "plug and play" option for reading from this sensor without configuration.

Returns
A double pH value on the range [0.001, 14.000].

◆ getpH() [2/3]

double AtlasEZOpH::getpH ( double  voltage)
inlinevirtual

Convert voltage reading to pH value.

Returns
The pH as a double

Reimplemented from pHSensor.

◆ getpH() [3/3]

double AtlasEZOpH::getpH ( int  address)
inline

Reads pH value from sensor as a double on the pH scale.

Parameters
[in]addressThe address of the sensor to read from (shallow, medium, or deep). Should be one of the defined addresses.
Returns
A double pH value on the range [0.001, 14.000]

◆ getpH_str()

char * AtlasEZOpH::getpH_str ( int  address)
inline

Get the pH reading as a string.

Returns
A character pointer to the data.

◆ getSensorType()

std::string AtlasEZOpH::getSensorType ( void  )
inlinevirtual

Get the string identifier for the Atlas EZO pH sensor. For use in MQTT topics and debugging.

Returns
A string "atlas_ezo_ph"

Reimplemented from pHSensor.

◆ sensor_at_address()

bool AtlasEZOpH::sensor_at_address ( int  address)
inline

Check if sensor present at address.

Checks I2C bus for prescence of sensor at the specified address. This is done by starting a transmission to the address, collecting the error value. If the value is 0 then sensor is present.

Note: This method will work for ANY sensor which shares this address. Thus caution should be taken to ensure that only the expected type of sensor is allowed to have one of the addresses specified for shallow, middle, and deep sensors in Atlas_EZO-pH.hpp.

Returns
A boolean flag, true if sensor connected at address.

◆ toJSON()

std::string AtlasEZOpH::toJSON ( double  voltage)
inlinevirtual

Converts a pH voltage reading to a JSON object string for MQTT and debugging.

Returns
A JSON string with PH_RAW and PH fields which contain double values.

Reimplemented from pHSensor.


The documentation for this class was generated from the following file: