Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: easy-connect-v16 Watchdog FP MQTTPacket RecordType-v-16 watersenor_and_temp_code
Revision 18:5585365d6951, committed 2017-12-12
- Comitter:
- DuyLionTran
- Date:
- Tue Dec 12 17:54:04 2017 +0000
- Parent:
- 17:b89d884eb609
- Child:
- 19:fbc21a964938
- Commit message:
- version 1.6: Project is re-organized, RTC is added, Sensor Calibration and Flash is being developed
Changed in this revision
| Sensor/ReadSensor.cpp | Show annotated file Show diff for this revision Revisions of this file |
| Sensor/ReadSensor.h | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Sensor/ReadSensor.cpp Tue Dec 12 17:54:04 2017 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "ReadSensor.h"
+
+const float saturationValueTab[41] = { //saturation dissolved oxygen concentrations at various temperatures
+14.46, 14.22, 13.82, 13.44, 13.09,
+12.74, 12.42, 12.11, 11.81, 11.53,
+11.26, 11.01, 10.77, 10.53, 10.30,
+10.08, 9.86, 9.66, 9.46, 9.27,
+9.08, 8.90, 8.73, 8.57, 8.41,
+8.25, 8.11, 7.96, 7.82, 7.69,
+7.56, 7.43, 7.30, 7.18, 7.07,
+6.95, 6.84, 6.73, 6.63, 6.53,
+6.41,
+};
+
+float saturationDoVoltage;
+float saturationDoTemperature;
+float averageVoltage;
+
+AnalogIn phSensor(SENSOR_1_PIN);
+AnalogIn DOSensor(SENSOR_2_PIN);
+
+void SENSOR_PHCalib() {
+
+}
+
+float SENSOR_ReadPHADC() {
+ return phSensor.read();
+}
+
+float SENSOR_GetPHValue() {
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sensor/ReadSensor.h Tue Dec 12 17:54:04 2017 +0000 @@ -0,0 +1,30 @@ +#ifndef __READSENSOR_H__ +#define __READSENSOR_H__ + +#define SENSOR_1_PIN (A0) +#define SENSOR_2_PIN (A1) +#define SENSOR_3_PIN (A3) +#define SENSOR_4_PIN (A4) + +#define SaturationDoVoltageAddress 12 //the address of the Saturation Oxygen voltage stored in the Flash +#define SaturationDoTemperatureAddress 16 //the address of the Saturation Oxygen temperature stored in the Flash + +#define VREF 3.3 +#define SCOUNT 30 + +/** brief Perform calibration for pH sensor + * retral None + */ +void SENSOR_PHCalib(); + +/** brief Read the analog value of pH sensor + * retral pH ADC value + */ +float SENSOR_ReadPHADC(); + +/** brief Convert the ADC value read from pH sensor into pH value + * retral pH value + */ +float SENSOR_GetPHValue(); + +#endif /* __READSENSOR_H__ */ \ No newline at end of file