diff --git a/data/depth/2022-09-04T11-50-21_depth_data.csv b/data/depth/2022-09-04T11-50-21_depth_data.csv new file mode 100644 index 0000000..7998f67 --- /dev/null +++ b/data/depth/2022-09-04T11-50-21_depth_data.csv @@ -0,0 +1,17 @@ +time and date, Voltage of depth sensor (V), Depth (m) +2022-09-04T11:50:21,0.716,-0.13 +2022-09-04T11:50:24,0.716,-0.13 +2022-09-04T11:50:27,0.716,-0.13 +2022-09-04T11:50:31,1.12,12.74 +2022-09-04T11:50:34,0.716,-0.13 +2022-09-04T11:50:37,1.074,11.28 +2022-09-04T11:50:40,1.154,13.82 +2022-09-04T11:50:43,0.716,-0.13 +2022-09-04T11:50:46,1.034,10.0 +2022-09-04T11:50:49,1.234,16.37 +2022-09-04T11:50:52,1.212,15.67 +2022-09-04T11:50:55,0.714,-0.19 +2022-09-04T11:50:58,0.716,-0.13 +2022-09-04T11:51:01,0.716,-0.13 +2022-09-04T11:51:04,0.716,-0.13 +2022-09-04T11:51:07,0.716,-0.13 diff --git a/data/depth/2022-09-04T11-56-09_depth_data.csv b/data/depth/2022-09-04T11-56-09_depth_data.csv new file mode 100644 index 0000000..f021fa0 --- /dev/null +++ b/data/depth/2022-09-04T11-56-09_depth_data.csv @@ -0,0 +1,7 @@ +time and date, Voltage of depth sensor (V), Depth (m) +2022-09-04T11:56:09,0.716,-0.13 +2022-09-04T11:56:12,0.716,-0.13 +2022-09-04T11:56:15,0.716,-0.13 +2022-09-04T11:56:18,0.716,-0.13 +2022-09-04T11:56:21,0.716,-0.13 +2022-09-04T11:56:24,0.716,-0.13 diff --git a/depth-logger/record-depth.py b/depth-logger/record-depth.py index 82a34fb..3447583 100644 --- a/depth-logger/record-depth.py +++ b/depth-logger/record-depth.py @@ -6,6 +6,12 @@ import busio import adafruit_ads1x15.ads1015 as ADS from adafruit_ads1x15.analog_in import AnalogIn from time import sleep, strftime +from rpi_lcd import LCD + +try: + lcd = LCD(bus=2) +except OSError: + lcd = None # Create the I2C bus i2c = busio.I2C(board.SCL, board.SDA) @@ -25,7 +31,7 @@ depthS = AnalogIn(ads, ADS.P1) # 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/" + timestr + "_depth_data.csv" +filename = "/home/shared/hydrophonitor/data/depth/" + timestr + "_depth_data.csv" #depthM = ((depthS.voltage * 31.848) - 22.93) @@ -47,6 +53,9 @@ with open(filename, "w", 1) as f: print((str(voltage) + " V ") + (str(depthM) + " m ") + (str(roundvolts) + " V ") + (str(rounddepth) + " m")) + if lcd: + lcd.clear() + lcd.text((str(roundvolts) + " V ") + (str(rounddepth) + " m"), 1) f.write(time.strftime("%Y-%m-%dT%H:%M:%S") + ",") f.write(str(roundvolts) + "," + str(rounddepth) + "\n") diff --git a/lcd-display/test_lcd.py b/lcd-display/test_lcd.py new file mode 100644 index 0000000..4f17595 --- /dev/null +++ b/lcd-display/test_lcd.py @@ -0,0 +1,13 @@ +from rpi_lcd import LCD +from time import sleep + +lcd = LCD(bus=2) + +lcd.text('Hello World!', 1) +lcd.text('Raspberry Pi', 2) +lcd.text('is really', 3, 'center') +lcd.text('awesome', 4, 'right') + +sleep(5) +lcd.clear() +