Using the DHT11

So now I want to measure humidity in the house using a DHT11 delivered promptly from the shop.

Member for

17 years

derek

13 years 5 months ago

Hi Kim,

Good to see you experimenting!

The firmware for the HAHnodes is written using the freely available Arduino environment. 
http://arduino.cc/en/Main/Software - I'm using version 1.0.5

As with any new compiler environment, there are a few things to get used to. However, it's pretty straightforward.

I know that Brett dropped a DHT11 into one of his roomNodes. I think this replaced the DS18B20 - reasonable enough as the DHT11 does humidity and temperature. 

Member for

15 years 7 months

garrydwilms

13 years 5 months ago

Kim,

as Derek rightly says, arduino environment is best.

just open sketch, modify, save and upload. Simple.

You will need to connect your jeenodes via a FTDI USB interface, assume you will be using one of these to connect your base node to HAH so it should be easy, just use that one.

alternatively you can flash the chip directly in an arduino and then transfer to the nodes ( I do this so as to keep my HAH up and running whilst messing.

winavr and the like are only really required when your chips don't have boot loaders on them.

 

good luck

 

Garry

Member for

15 years 11 months

kim

13 years 5 months ago

.. for your helpful input - a bit of of learning curve going on.  I had naively thought I could just compile one file and load it into the jeenode.  

Interesting.

 

Kim 

Member for

15 years 11 months

kim

13 years 5 months ago

Well ... I got roomNode2.ino to compile but had to make a number of changes:

1) Having downloaded DallasTemperature, Jeelib and OneWire libraries I found I had over 30 compile errors

2) In OneWire.cpp I changed "WConstants.h" to "Arduino.h" to make it work with Arduino 1.0.5

3) Ditto with DallasTemperature.cpp

4) Then found I had to move "Arduino.h" to be above the extern "C" line

5) Finally I put in an "include <PortsSHT11.h> - not needed - see below!

Then I got no more errors.

I then commented out #define DHT11PIN 4

and removed comments from //#define SHT11_PORT 1

Then plugged in basenode with the jeenode chip into the pc usb port and told it to upload.  No visible sign of anything happened but after a while it said uploaded.

Then I spent a long while compiling this post saying how it wasn't working.... before I realised it IS a DHT11 and not an SHT11 !!! 

So now it works.  At least the humidity goes from 58 to 70 when I breathe on it.  PIR doesn't work though? Maybe something to do with the fact that the line enabling it is commented out.

You can see my novice level.  I only found out about the changes to be made by googling the errors!  Fun though - glad I didn't try for a career in programming.
Kim 

Member for

17 years

derek

13 years 5 months ago

Great job Kim.

I also had a bit of a struggle moving from 'pre version 1.0' Arduino to the latest. Quite a few things changed. Thank goodness for google. By writing this note, you've made the transition easier for others. 

Anyway, it sounds like your perseverence has (nearly) paid off.

Do keep going 'till that PIR works too (& publish your final sketch!).

As for a job in programming ... given this effort ... I reckon that you'd do a lot better than most.

Member for

15 years 7 months

garrydwilms

13 years 5 months ago

I find the struggles help with the learning curve.

One note for future reference that on hindsight I should have mentioned. Use a SVN checkout service (like tortoise SVN for windows) and check out the google SVN from google code. You will then have all the code (and libraries!) to hand on your local drive. Easy to keep updated with Bretts current versions.

Garry

Member for

16 years 10 months

brett

13 years 5 months ago

Oh sorry about that I just noticed that I was not using a sync from the SVN repo so what I had wasn't what was checked in.

Damn..  I've checked in a bunch of replacements for these OLD libraries you should be able to keep in sync with the SVN repo and it will all compile now.   Glad you figured it out thou - good practice.

Brett

Member for

15 years 11 months

kim

13 years 5 months ago

...  and the PIR works as well.  

Learning curve on SVNs went 

1) Download from google code - didn't compile with html (!) 

2) Download from source

3) Got bored doing that one at a time - found a little prog called DownloadSVN.exe

4) Put directly into arduino "libraries" at the wrong level and then imported - it recursively created a depth of over 500 directories before I manually turned off the computer - took two hours to sort!

Now I understand that if I use TortoiseSVN I can do it all automatically - great - thanks

So I can join the ranks of "just open sketch, modify, save and upload. Simple."  Although I did like to see the livebox doing the avrdude stuff - watching it roll by was reassuring.

I might try updating my BoilerNodeTwin to see if I can measure the compost humidity!  But for now I shall content myself with annoying SWMBO by going round the house quoting the humidity levels.

Thanks for all the help.

Kim

p.s. Derek - I haven't published the sketch 'cos its just a trivial (ha!) amendment to Brett's code and he may update it (sic!).

p.p.s Cacti works really well - got the data collecting on the pi several weeks ago and haven't touched it since - just sits there on its own in the corner of the study loading off the cached data.

Member for

15 years 11 months

kim

13 years 5 months ago

... yup - missed that.  Very useful

K