0

DHT 22 Temperature and Humidity sensor with adafruit code
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

DHT 22 Temperature and Humidity sensor with adafruit code

by InfraredFish on Mon Apr 28, 2014 7:00 am

Hi, I'm new here and have looked around the forums didn't seem to find a solution to my problem.

I'm using this code to try and monitor the temp and humidity of some plants:

https://learn.adafruit.com/dht-humidity ... g/overview

Although when SSHd in I get a temp and humidity response, it then says 'unable to append data. Check your connection?'. I can ping fine, so I have a connection but it doesn't update the Google docs. So in order to see the sensor values, I have to constantly run the code from my laptop. Ideally I'd like to graph the data over a week or day and/or I have a spare HD 44780 display although I don't know if I can use this in conjunction with DHT22.

please help!
InfraredFish
 
Posts: 3
Joined: Mon Apr 28, 2014 6:43 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by adafruit_support_rick on Wed Apr 30, 2014 8:04 am

Not sure - I'll check on this

adafruit_support_rick
 
Posts: 35074
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by adafruit2 on Wed Apr 30, 2014 10:54 am

thats an old project - so something in the google api may have changed. check that you have the right key/password type stuff. its easy to mistype or add a char!

adafruit2
Site Admin
 
Posts: 16567
Joined: Fri Mar 11, 2005 7:36 pm

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by InfraredFish on Thu May 01, 2014 11:10 am

I checked my password and stuff and they seem fine, also I would get a login fail response, rather than a Could not connect. Do you think it is because something changed with how google docs works?

Thanks
InfraredFish
 
Posts: 3
Joined: Mon Apr 28, 2014 6:43 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by adafruit_support_rick on Thu May 01, 2014 1:02 pm

Yes, it could be a change in the google docs API.

adafruit_support_rick
 
Posts: 35074
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by rob61280 on Mon May 05, 2014 8:57 am

I encountered the same problem, it seems that gspread isn't working the new google spreadsheets, use the link below to create an old version of a google spreadsheet, then your code should work.

https://g.co/oldsheets

Source (https://github.com/burnash/gspread/issues/111)

Thanks multivoxmuse!
rob61280
 
Posts: 3
Joined: Mon May 05, 2014 8:54 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by adafruit_support_rick on Mon May 05, 2014 3:23 pm

Thanks for the tip!

adafruit_support_rick
 
Posts: 35074
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by InfraredFish on Tue May 06, 2014 6:39 am

That's solved it, thanks!
InfraredFish
 
Posts: 3
Joined: Mon Apr 28, 2014 6:43 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by rob61280 on Tue May 06, 2014 6:45 am

No problem, multivoxmuse is due all the credit though, good luck with the Pi

R
rob61280
 
Posts: 3
Joined: Mon May 05, 2014 8:54 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by adafruit_support_rick on Tue May 06, 2014 11:03 am

I've added an alert to the tutorial.

adafruit_support_rick
 
Posts: 35074
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by rob61280 on Tue May 06, 2014 11:11 am

Thanks Rick, I hope it helps others getting into coding with the Pi.

R
rob61280
 
Posts: 3
Joined: Mon May 05, 2014 8:54 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by tdicola on Sat Jun 07, 2014 8:28 pm

I've been cleaning up old DHT sensor library issues, and just as an FYI for folks that stumble on this now it appears the gspread library has been updated to work with the 'new style' Google spreadsheets. Make sure to install or upgrade to the latest version of gspread, for example with pip execute:
Code: Select all | TOGGLE FULL SIZE
sudo pip install --upgrade gspread


I've been running the example code uploading to a sheet that was just created and it works great. Make sure to delete all the rows that are added to a new sheet too or else your values will start getting appended at the very bottom of the sheet (past row 1000).

tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by gtjy on Mon Jun 30, 2014 4:49 am

Hi there.
I have tried to follow all the instructions given on the tutorial page

And have managed to display the message on the terminal saying "Logging sensor measurements to (spreadsheet name) every X seconds"

However, when I opened my spreadsheet in Google Drive, there is no data being populated there.

Anyone has any idea why? Kindly advise.

Thank you!
gtjy
 
Posts: 5
Joined: Mon Jun 30, 2014 2:53 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by tdicola on Mon Jun 30, 2014 5:19 pm

One thing that tripped me up at first was that Google by default adds 1000 empty rows to a new spreadsheet. This means new readings will be appended at the very end, after those 1000 rows. Try scrolling down to see if there are readings at the end of the spreadsheet to check that the data is getting to the spreadsheet. If you do see data there and those 1000 empty rows in the way, the easiest thing to do is select the 1000 blank rows, right click, and select the delete all rows option. Let me know if the 1000 empty rows is the issue, or if the sheet doesn't have any rows and is still not getting results.

tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

by gtjy on Wed Jul 02, 2014 1:48 am

Hi there,

Appreciate your prompt reply. Sadly, the issue that I faced wasn't like what you have mentioned. There isn't any readings after the 1000 rows.
Any other possibilities/reasons why this does not work? I was wondering if it could be a hardware issue. (Though I have already repeated checked that the various parts are connected as per advised in the tutorial.)

Regards.
gtjy
 
Posts: 5
Joined: Mon Jun 30, 2014 2:53 am

Please be positive and constructive with your questions and comments.