Jump to content
Forum sending old emails Read more... ×
sendiptangshu

DHT11 library for energia

Recommended Posts

I want to interface a DHT11 temperature and humidity sensor with my MSP430G2553. I looked up the Energia list of libraries, but the link for DHT11 is currently inactive. I tried downloading libraries from github, even ported over libraries from arduino, but none of them are working. I either get timeout errors or nothing gets printed on serial monitor at all. I know for sure that my sensor is perfectly fine because I have tested it for multiple libraries on Arduino. Please provide me the link for a valid DHT11 Energia library or help me out otherwise.

Share this post


Link to post
Share on other sites

In the distant past I have used the Adafruit library with the DHT11 and don't remember having a problem.  I normally use V17 of Energia with the G2553.  Make sure you get the pins right and list both the pins used and a link to the library when asking for help.  Arduino code that makes hardware specific calls will not work without porting whether to a MSP430, Teensy, ESP, etc.

Share this post


Link to post
Share on other sites
7 hours ago, Fmilburn said:

In the distant past I have used the Adafruit library with the DHT11 and don't remember having a problem.  I normally use V17 of Energia with the G2553.  Make sure you get the pins right and list both the pins used and a link to the library when asking for help.  Arduino code that makes hardware specific calls will not work without porting whether to a MSP430, Teensy, ESP, etc.

I used the Adafruit library you provided the link to. NAN is not defined in Energia. So, I defined NAN in the DHT.cpp file with 1e+30. Still does not seem to be working correctly. Here's the output I am receiving. Look at the image enclosed. By the way, I wired up the Vcc and GND pins (pin1 and pin4 ) respectively to 3.3V and GND pins of MSP and Data pin(pin2) to P1_4 through 10k resistor.

@Rei Vilo, I do not have access to a DHT12 right now. I have to get this DHT11 to work.

 

930x213_B-1.pdf

IMG_20180525_102008.jpg

Share this post


Link to post
Share on other sites

I googled "DHT11 msp430" and got dozens of hits, same with "DHT11 msp430 energia"

You might find this of interest on e2e.

I haven't worked with 1-wire devices, so not much direct help, but it appears a lot of engineers, students and others have faced and solved your issues.

Share this post


Link to post
Share on other sites

My memory must be faulty.  I had a quick look at the Adafruit code and don't believe it will work without a fair amount of modification.  They are using direct register reads in some cases which is not difficult to fix but they also seem to be blocking and counting loops to determine time which is not good practice.  I mostly used the DHT22 but do remember getting the DHT11 working at one point.  Most of the libraries seem to handle both.  Unfortunately I did not put my code in github or otherwise document it so can't give much more guidance.

Share this post


Link to post
Share on other sites

Oops. Sorry. I'm using the DHT22 not DHT11.

Quote

 

This code worked right out of the box:

https://github.com/TheDZhon/dht22_430

In Energia, I started with DHT22_430_main and added DHT22_430.cpp and DHT22_430.h. Amazingly, it compiled cleanly. Downloaded and started it and terminal console was active. Wired up the DHT22 (Pin 1 to VCC, Pin 4 to GND, and Pin 2 to P1.4 with a 10K resistor pull-up) and it all just worked.

Seems like I just stumbled upon the right code...

 

 

Share this post


Link to post
Share on other sites
On 5/24/2018 at 1:33 PM, sendiptangshu said:

Please provide me the link for a valid DHT11 Energia library or help me out otherwise.

Hmmm.... I'm not sure if you are panicking or just desperate to avoid the hard work of figuring out how things work.

That said, this is the first thing you need to do: write a todo list.

  1. Get DHT11 datasheet here.
  2. Learn how to use it here.

Does that help?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×