7:12 am

August 23, 2018

Hi all,
I'm pretty new to this Topic but I have searched the Forum and the web but have not yet found a solution.
I am a hobby wine maker and just recently upgraded my production room with a temperature and humidity control System, using a raspberry pi and a DHT22. The data get's uploaded with the following code (slightly altered, as this is taken from a tutorial) to ThingSpeak:
________________________________________________________________________________________________________________
import thingspeak
import time
import Adafruit_DHT
channel_id = 206897 # PUT CHANNEL ID HERE
write_key = '24GJQV17H7H4XGJ5' # PUT YOUR WRITE KEY HERE
read_key = '9EZ7E0918UVVAGAY' # PUT YOUR READ KEY HERE
pin = 4
sensor = Adafruit_DHT.DHT22
def measure(channel):
try:
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
# write
response = channel.update({'field1': temperature, 'field2': humidity})
# read
read = channel.get({})
print("Read:", read)
except:
print("connection failed")
if __name__ == "__main__":
channel = thingspeak.Channel(id=channel_id, write_key=write_key, api_key=read_key)
while True:
measure(channel)
# free account has an api limit of 15sec
time.sleep(15)
________________________________________________________________________________________________________________
The transmission itself and displaying of the data works without any complications.
Unfortunately, the router has some major issues and shuts down more or less every day. I will tackle that problem as well but for the moment I'd like to create a workaround.
Hence the question: is it possible to locally log the data (in a round robin data base for instance) as soon as the wifi shuts down AND transmit all the logged data as a bulk to ThingSpeak as soon as the connection is up again? This would help me to consistently monitor and analyze the necesseary information for the fermentation process online.
If I just missed the right tutorial to do just that, a link might suffice to solve my problem. I'm eager to read and learn to solve my problems on my own but as of yet, I don't see a starting point.
Thank you in advance.
Cheers,
Larimow
10:28 am


Moderators
March 7, 2017

I think I have the tutorial you ordered:
https://www.mathworks.com/help/thingspeak/continuously-collect-data-and-bulk-update-a-thingspeak-channel-using-a-raspberry-pi-board.html
Please let us know how it works, and when there are open tastings!
Most Users Ever Online: 166
Currently Online:
30 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
bogart, estebanmateo93, mikewrite, onlinebusiness, winzy99, Zark_zeuganModerators: cstapels: 460
Administrators: Hans: 405, lee: 457