DHT 22 Temperature and Humidity sensor with adafruit code

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
InfraredFish
 
Posts: 3
Joined: Mon Apr 28, 2014 6:43 am

DHT 22 Temperature and Humidity sensor with adafruit code

Post by InfraredFish »

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!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by adafruit_support_rick »

Not sure - I'll check on this

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by adafruit2 »

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!

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by InfraredFish »

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

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by adafruit_support_rick »

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

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by rob61280 »

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!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by adafruit_support_rick »

Thanks for the tip!

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by InfraredFish »

That's solved it, thanks!

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by rob61280 »

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

R

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by adafruit_support_rick »

I've added an alert to the tutorial.

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by rob61280 »

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

R

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by tdicola »

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

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).

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by gtjy »

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!

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by tdicola »

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.

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

Re: DHT 22 Temperature and Humidity sensor with adafruit cod

Post by gtjy »

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.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”