My gas consumption is being monitored by a RaspberryPi (using a reed sensor).
A rather simple python script is gathering the sensor output and storing it in a CSV file.
The RaspberryPi has an internet connection (WiFi).
I want the RaspberryPi to send the sensor information somewhere where I can visualize or access the data online. What would be the best way to do so ?
Seen solutions involving MQTT and AwS (Amazon), but sounds complicated to send a single variable very few seconds and store it with a timestamp...
Any fancy simple solution ?
Thanks !
Here is the small code running as a Service
import RPi.GPIO as GPIO
import time
import csv
from datetime import datetime
GPIO.setmode(GPIO.BOARD)
GPIO.setup(15, GPIO.IN, pull_up_down=GPIO.PUD_UP)
counter = 0
current_state = True
prev_state = True
while True:
current_state = GPIO.input(15)
if (current_state == False) and (prev_state == True):
counter = counter + 1
print(counter)
with open('/home/pi/gas_newfile.csv', 'a', newline='') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow(str(counter))
spamwriter.writerow(str(datetime.now()))
prev_state = current_state
time.sleep(0.1)
CSV is one if the ways to monitor data after transferring them. If you dont need to store long-time data you can use SSH,... or cable and write a UI to displaying them.
But if you want to have long-time data you can use MySQL to create and modify a database on raspberryPi for data.
About transferring data from raspberryPi to Monitor, in addition to SSH, VNC(directly controling) ,.... or you can use some cloud Services like Amazon and Google that you mentioned befor.