Pages: [1]   Go Down
Author Topic: DHT22 Can i share the data pin ??  (Read 715 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello , i want to get measurements from this https://www.sparkfun.com/products/10167? , it works with my arduino , but i want to know if i can share the data pin and connect it to my raspberry pi , in order to read the measurements from there too.... Is that possible ? Does anyone tried it ?
Logged

Brunsbüttel, SH, F.Rep.GERM
Offline Offline
God Member
*****
Karma: 4
Posts: 596
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hi!

u could use 2 devices that communicate with that DHT22,
if u can make sure, that they dont try that at the same time... smiley
that 1-wire protocol doesnt tolerate communication collisions...

u could try to do it like ethernet does it:
1. carrier sense: a unit, that wants to talk, looks at the line for some time in order to c if communication is going on right now...
2. collision detect: a talking unit reads the line during a write request in order to c if someone "overwrites" its communication...

have fun...
Logged

-Arne

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello , i want to get measurements from this https://www.sparkfun.com/products/10167? , it works with my arduino , but i want to know if i can share the data pin and connect it to my raspberry pi , in order to read the measurements from there too.... Is that possible ? Does anyone tried it ?

In principle, yes. However, there are the following considerations:

1. The Rasperry Pi uses 3.3V signal levels. Most Arduinos use 5V signal levels. So you will have to either use a 3.3V Arduino, or be very careful not to let the Arduino drive more than 3.3V on to that line. Or use a buffer chip or diode and 2 pins - see point 3 below.

2. Both the Arduino and the Pi need to drive the device using an open-collector output. I know how to do this on the Arduino, but not on the Pi.

3. If either the Arduino or the Pi is powered down, the other will not be able to read from the device. This can be solved, but you would need to use 2 I/O pins per device, an open-collector buffer chip and a couple of diodes.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Let arduino "read" the sensor and then inform raspberry http://www.doctormonk.com/2012/04/raspberry-pi-and-arduino.html

I think its the best/safe way for me...

Thanks !
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 224
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, if the Arduino will always be powered up when you want the Pi to read the sensor, that's a better way.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: