Data Gator
Hardware and software documentation for the Data Gator project.
Loading...
Searching...
No Matches
GenericPH.hpp
Go to the documentation of this file.
1
11#ifndef GENERICPH_H
12#define GENERICPH_H
13#include <../../include/pHSensor.hpp>
14
18class GenericPH: public pHSensor{
19 public:
20
21 double getpH(double voltage){
22 voltage = voltage*(3/2);
23 double pH = ((voltage/MAX_V) * 6) + 3; // on range 3-9 with min value of 3
24 return pH;
25 }
26
32 std::string getSensorType(){
33 return "generic_pH";
34 }
35
39 std::string toJSON(double voltage){
40 return "\"PH_RAW\": " + std::to_string(voltage) + ", \"PH\":" + std::to_string(this->getpH(voltage));
41 }
42
43 private:
44 const double MIN_V = 0;
45 const double MAX_V = 3.33;
46
47
48};
49
50#endif
Overrides the interface provided by pHSensor.hpp for a generic analog pH sensor.
Definition GenericPH.hpp:18
std::string getSensorType()
Get identifier string for debugging.
Definition GenericPH.hpp:32
std::string toJSON(double voltage)
Converts voltage reading to JSON object for debugging and data collection.
Definition GenericPH.hpp:39
double getpH(double voltage)
Convert voltage reading to pH value.
Definition GenericPH.hpp:21
Interface for pH sensors.
Definition pHSensor.hpp:19
int reset_count
number of resets retrieved for NVS
Definition scheduler.hpp:31