One wire example

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hey folks,

   

I am trying to extract data out of a DHT11 Temperature sensor. Can you tell me whether there exists an example project or a library?

   

Trying to write it myself wasn't successful yet...

0 Likes
1 Solution

See the code for 1-wire component here. Yes, something like Pin_Write(1) / Pin_Read()

View solution in original post

0 Likes
10 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Wouldn't be too bad to search for at top of this page. You'll get these results.

   

 

   

Bob

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Bratwust,

   

closest 1-wire library would be one made for DS18B20 by 'pavloven'. See this thread, and this website.

   

You likely have to modify it - timing and reading is different, may be not worth the effort.

   

odissey1

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Just looked into the DHT11 datasheet. First approach could be done with counters and a piece of logic.

   

When that works you could try to conquer by using an UDB and the datapath.

   

Challenging!!!

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Here is a  C file program  to read the device you will need to mod it to work on PSOC.  I am not sure the one wire program for the ds18b22 will   work as this device needs a longer delay for the data.

0 Likes
Anonymous
Not applicable

thank you all for help so far 🙂

   

I actually tried to prog it myself but I am not sure about the bidirectional pin. Do I have to switch somehow the data direction or can I just use the readpin and writepin functions?

   

like (pseudocode)

   

writepin(1);

   

CyDelay(20);

   

pinstate = readpin();

   

 

   

Thank you all again 🙂

0 Likes

See the code for 1-wire component here. Yes, something like Pin_Write(1) / Pin_Read()

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

See 7.1 of the following -

   

 

   

http://www.cypress.com/?rID=93401     AN86439 - PSoC® 4 - Using GPIO Pins

   

 

   

Regards, Dana.

Anonymous
Not applicable

Hello Bratwurst, were you successful with the DHT11?

0 Likes
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

I can offer you a simple project for PSoC4.
I used the library from this source:    STM32 + DHT11

   

​DHT11.cywrk.Archive01.zip

I  have corrected the link..

0 Likes
Anonymous
Not applicable

Hi Pavloven. I'm dealing with the DHT22. I'm trying to download your project but the link seems to be not working. Can you share the link again?

   

Thank you.

0 Likes