![]() |
Data Gator
Hardware and software documentation for the Data Gator project.
|
Defines an I2C pH sensor which inherits from pHSensor.hpp. More...
#include <Atlas_EZO-pH.hpp>
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. | |
char * | getpH_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 | |
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.
|
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.
Reads pH value from sensor as a double on the pH scale.
[in] | address | The address of the sensor to read from (shallow, medium, or deep). Should be one of the defined addresses. |
Get the pH reading as a string.
|
inlinevirtual |
Get the string identifier for the Atlas EZO pH sensor. For use in MQTT topics and debugging.
Reimplemented from pHSensor.
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.
|
inlinevirtual |
Converts a pH voltage reading to a JSON object string for MQTT and debugging.
PH_RAW
and PH
fields which contain double values. Reimplemented from pHSensor.