From f2344d9386f9f7a1836b68a0cade0836fa3f9a33 Mon Sep 17 00:00:00 2001 From: Pi Date: Sat, 3 Sep 2022 18:17:20 +0300 Subject: [PATCH] Add test data, update depth recording script --- data/depth/2022-09-03T17-55-58_depth_data.csv | 43 ++++++++++++++++ data/depth/2022-09-03T18-01-18_depth_data.csv | 49 +++++++++++++++++++ data/gps/2022-08-20T12-23-39_GPS_data.csv | 11 +++++ .../{record-depth-temp.py => record-depth.py} | 23 ++++----- 4 files changed, 115 insertions(+), 11 deletions(-) create mode 100644 data/depth/2022-09-03T17-55-58_depth_data.csv create mode 100644 data/depth/2022-09-03T18-01-18_depth_data.csv create mode 100644 data/gps/2022-08-20T12-23-39_GPS_data.csv rename depth-logger/{record-depth-temp.py => record-depth.py} (57%) diff --git a/data/depth/2022-09-03T17-55-58_depth_data.csv b/data/depth/2022-09-03T17-55-58_depth_data.csv new file mode 100644 index 0000000..51e0d0c --- /dev/null +++ b/data/depth/2022-09-03T17-55-58_depth_data.csv @@ -0,0 +1,43 @@ +time and date, Voltage of depth sensor (V), Depth (m) +2022-09-03T17:55:58,0.714,-0.13 +2022-09-03T17:56:01,0.714,-0.13 +2022-09-03T17:56:04,0.714,-0.19 +2022-09-03T17:56:07,0.714,-0.19 +2022-09-03T17:56:10,0.714,-0.19 +2022-09-03T17:56:13,0.714,-0.13 +2022-09-03T17:56:16,0.714,-0.19 +2022-09-03T17:56:19,0.716,-0.19 +2022-09-03T17:56:22,0.714,-0.13 +2022-09-03T17:56:25,0.714,-0.19 +2022-09-03T17:56:28,0.714,-0.19 +2022-09-03T17:56:31,0.714,-0.19 +2022-09-03T17:56:34,0.714,-0.19 +2022-09-03T17:56:37,0.714,-0.13 +2022-09-03T17:56:40,0.714,-0.13 +2022-09-03T17:56:43,0.714,-0.19 +2022-09-03T17:56:46,0.716,-0.13 +2022-09-03T17:56:49,0.714,-0.13 +2022-09-03T17:56:52,0.714,-0.13 +2022-09-03T17:56:55,0.716,-0.19 +2022-09-03T17:56:59,0.714,-0.19 +2022-09-03T17:57:02,0.714,-0.19 +2022-09-03T17:57:05,0.716,-0.13 +2022-09-03T17:57:08,0.714,-0.13 +2022-09-03T17:57:11,0.714,-0.19 +2022-09-03T17:57:14,0.714,-0.13 +2022-09-03T17:57:17,0.894,5.48 +2022-09-03T17:57:20,0.986,8.54 +2022-09-03T17:57:23,0.988,8.47 +2022-09-03T17:57:26,1.368,20.58 +2022-09-03T17:57:29,1.354,20.26 +2022-09-03T17:57:32,0.714,-0.19 +2022-09-03T17:57:35,0.716,-0.13 +2022-09-03T17:57:38,0.714,-0.19 +2022-09-03T17:57:41,0.714,-0.19 +2022-09-03T17:57:44,0.714,-0.19 +2022-09-03T17:57:47,0.716,-0.19 +2022-09-03T17:57:50,0.714,-0.19 +2022-09-03T17:57:53,0.714,-0.13 +2022-09-03T17:57:56,0.714,-0.13 +2022-09-03T17:57:59,0.714,-0.19 +2022-09-03T17:58:02,0.714,-0.13 diff --git a/data/depth/2022-09-03T18-01-18_depth_data.csv b/data/depth/2022-09-03T18-01-18_depth_data.csv new file mode 100644 index 0000000..60e093b --- /dev/null +++ b/data/depth/2022-09-03T18-01-18_depth_data.csv @@ -0,0 +1,49 @@ +time and date, Voltage of depth sensor (V), Depth (m) +2022-09-03T18:01:18,0.716,-0.13 +2022-09-03T18:01:21,0.716,-0.13 +2022-09-03T18:01:24,0.714,-0.19 +2022-09-03T18:01:27,0.716,-0.13 +2022-09-03T18:01:30,0.714,-0.19 +2022-09-03T18:01:33,0.716,-0.13 +2022-09-03T18:01:36,0.716,-0.13 +2022-09-03T18:01:39,0.716,-0.13 +2022-09-03T18:01:42,0.716,-0.13 +2022-09-03T18:01:45,0.714,-0.19 +2022-09-03T18:01:48,0.714,-0.19 +2022-09-03T18:01:51,0.714,-0.19 +2022-09-03T18:01:54,0.714,-0.19 +2022-09-03T18:01:57,0.716,-0.13 +2022-09-03T18:02:00,0.716,-0.13 +2022-09-03T18:02:03,0.714,-0.19 +2022-09-03T18:02:06,0.714,-0.19 +2022-09-03T18:02:09,0.714,-0.19 +2022-09-03T18:02:12,0.714,-0.19 +2022-09-03T18:02:15,0.714,-0.19 +2022-09-03T18:02:18,0.716,-0.13 +2022-09-03T18:02:21,0.716,-0.13 +2022-09-03T18:02:24,0.714,-0.19 +2022-09-03T18:02:27,0.714,-0.19 +2022-09-03T18:02:30,0.714,-0.19 +2022-09-03T18:02:33,0.714,-0.19 +2022-09-03T18:02:36,0.714,-0.19 +2022-09-03T18:02:39,0.716,-0.13 +2022-09-03T18:02:42,0.714,-0.19 +2022-09-03T18:02:45,0.714,-0.19 +2022-09-03T18:02:48,0.714,-0.19 +2022-09-03T18:02:51,0.714,-0.19 +2022-09-03T18:02:54,0.714,-0.19 +2022-09-03T18:02:57,0.714,-0.19 +2022-09-03T18:03:00,0.714,-0.19 +2022-09-03T18:03:03,0.714,-0.19 +2022-09-03T18:03:06,0.714,-0.19 +2022-09-03T18:03:09,0.714,-0.19 +2022-09-03T18:03:12,0.714,-0.19 +2022-09-03T18:03:15,0.714,-0.19 +2022-09-03T18:03:18,0.716,-0.13 +2022-09-03T18:03:21,0.716,-0.13 +2022-09-03T18:03:24,0.714,-0.19 +2022-09-03T18:03:27,0.716,-0.13 +2022-09-03T18:03:30,0.714,-0.19 +2022-09-03T18:03:33,0.714,-0.19 +2022-09-03T18:03:36,0.714,-0.19 +2022-09-03T18:03:39,0.714,-0.19 diff --git a/data/gps/2022-08-20T12-23-39_GPS_data.csv b/data/gps/2022-08-20T12-23-39_GPS_data.csv new file mode 100644 index 0000000..525378d --- /dev/null +++ b/data/gps/2022-08-20T12-23-39_GPS_data.csv @@ -0,0 +1,11 @@ +GPStime utc,latitude,longitude,speed,sats in view +2022-08-20T09:23:40.000Z,60.196451148,24.960462239,0.582,0 +2022-08-20T09:23:41.000Z,60.196446687,24.960462239,0.374,0 +2022-08-20T09:23:42.000Z,60.196437765,24.960462239,0.257,7 +2022-08-20T09:23:43.000Z,60.196441539,24.960486191,0.192,7 +2022-08-20T09:23:44.000Z,60.196441539,24.960486191,0.121,7 +2022-08-20T09:23:45.000Z,60.196437078,24.960486191,0.279,7 +2022-08-20T09:23:46.000Z,60.196439678,24.960493798,0.233,7 +2022-08-20T09:23:47.000Z,60.196439678,24.960493798,0.059,7 +2022-08-20T09:23:48.000Z,60.196439678,24.960493798,0.124,7 +2022-08-20T09:23:49.000Z,60.196446739,24.960501406,0.369,7 diff --git a/depth-logger/record-depth-temp.py b/depth-logger/record-depth.py similarity index 57% rename from depth-logger/record-depth-temp.py rename to depth-logger/record-depth.py index a1afa26..82a34fb 100644 --- a/depth-logger/record-depth-temp.py +++ b/depth-logger/record-depth.py @@ -14,18 +14,18 @@ i2c = busio.I2C(board.SCL, board.SDA) ads = ADS.ADS1015(i2c) # Create single-ended input on channel 0 -tmp36 = AnalogIn(ads, ADS.P0) +# tmp36 = AnalogIn(ads, ADS.P0) # Attempting to create a single-ended input on channel 1 depthS = AnalogIn(ads, ADS.P1) # Subtract the offset from the sensor voltage # and convert chan.voltage * (1 degree C / 0.01V) = Degrees Celcius -temperatureC = (tmp36.voltage - 0.5) / 0.01 +# temperatureC = (tmp36.voltage - 0.5) / 0.01 # Open the file to write down the results timestr = time.strftime("%Y-%m-%dT%H-%M-%S") -filename = "/home/shared/logger-raspi-setup/data/depth-temp/" + timestr + "depth_temperature_data.csv" +filename = "/home/shared/logger-raspi-setup/data/depth/" + timestr + "_depth_data.csv" #depthM = ((depthS.voltage * 31.848) - 22.93) @@ -35,18 +35,19 @@ filename = "/home/shared/logger-raspi-setup/data/depth-temp/" + timestr + "depth #bar = psi * 14.503773800722 -with open(filename, "w") as f: - f.write("time and date, temperature (C), Voltage of depth sensor (V), Depth (m)\n") +with open(filename, "w", 1) as f: + f.write("time and date, Voltage of depth sensor (V), Depth (m)\n") while True: - depthM = ((depthS.voltage * 31.848) - 22.93) + voltage = depthS.voltage + depthM = ((voltage * 31.848) - 22.93) rounddepth = round(depthM, 2) - roundtemp = round(temperatureC, 2) - roundvolts = round(depthS.voltage, 3) + # roundtemp = round(temperatureC, 2) + roundvolts = round(voltage, 3) - print((str(roundtemp) + " °C ") + (str(roundvolts) + " V ") + (str(rounddepth) + " m")) + print((str(voltage) + " V ") + (str(depthM) + " m ") + (str(roundvolts) + " V ") + (str(rounddepth) + " m")) - f.write(time.strftime("%Y-%m-%d %H:%M:%S") + ",") - f.write((str(roundtemp) + " °C ") + "," + (str(roundvolts) + " V ") + "," + (str(rounddepth) + " m\n")) + f.write(time.strftime("%Y-%m-%dT%H:%M:%S") + ",") + f.write(str(roundvolts) + "," + str(rounddepth) + "\n") time.sleep(3)