Pages: 1 [2] 3 4 5   Go Down
Author Topic: DS18B20 multiple sensors  (Read 8565 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok i have now tried with only one 4.7k resistor (between DATA and +5V wires), and it works with 11 sensors, with the same code used before. Now i will try it with at least 22 sensors, and we will see what happens smiley
Logged

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At some point, it will stop working again.  If you have an oscilloscope, you can see how the signal degrades as you pile on sensors.  It's not like it's a very clean signal to start with.  Long cables will add to your woes because of the capacitance of the wiring.  Lower value pull-up resistors will help in many situations.  As you already saw, you could go as low as 1k if needed since it was working until you got it below about 500 ohms.  The sensors were only designed to sink 4mA which means even 1k is a little small.
Logged

Experience, it's what you get when you were expecting something else.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
At some point, it will stop working again.
Yes, i realize that, and when it does i will try with smaller resistor or something like that.

Is there any difference in number of sensors which can be connected or in code how to retrieve temperature if i would wire it like you (@afremont) said?

Quote
I suggest the OP read some Dallas documentation on powering the 1-wire data bus.  He could get rid of a wire (+5V) by using parasitic power mode thru the data line.  Then he'd only have to run the Data(Q) and Gnd wires to the sensors.  Handier sometimes.
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4836
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At some point, it will stop working again.  If you have an oscilloscope, you can see how the signal degrades as you pile on sensors.  It's not like it's a very clean signal to start with.  Long cables will add to your woes because of the capacitance of the wiring.  Lower value pull-up resistors will help in many situations.  As you already saw, you could go as low as 1k if needed since it was working until you got it below about 500 ohms.  The sensors were only designed to sink 4mA which means even 1k is a little small.

You're beyond me but could he use a circuit to drive a led as a line indicator?

Also, couldn't an Arduino support more than one 1-wire bus?
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Time to look at the datasheet, it tells all.  The only difference is that you have to supply extra power when a temp conversion (or EEPROM write) is in progress.  The datasheet shows how to do it, it's simple; it takes an extra i/o pin though.  You just enable the pin after issuing the conversion command.  That in turn bypasses the pull-up resistor on the data line (Q) so that the device has plenty of power to do the temp conversion or write to its EEPROM.  Look at the datasheet, they have a nice write-up on how it all works.
Logged

Experience, it's what you get when you were expecting something else.

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

At some point, it will stop working again.  If you have an oscilloscope, you can see how the signal degrades as you pile on sensors.  It's not like it's a very clean signal to start with.  Long cables will add to your woes because of the capacitance of the wiring.  Lower value pull-up resistors will help in many situations.  As you already saw, you could go as low as 1k if needed since it was working until you got it below about 500 ohms.  The sensors were only designed to sink 4mA which means even 1k is a little small.

You're beyond me but could he use a circuit to drive a led as a line indicator?

Also, couldn't an Arduino support more than one 1-wire bus?


I'm not sure what you mean about the LED.  Do you mean as an indicator of activity? 

Any pin could be another 1-wire bus, but I don't know if the library supports that or not.
Logged

Experience, it's what you get when you were expecting something else.

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4836
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm not sure what you mean about the LED.  Do you mean as an indicator of activity?

Perhaps a difference in brightness would tell something useful about the power line (non-parasite) with X number sensors connected? It would vary as signals are sent but would anyone be able to see that as anything but light level?
If it could then he could tune his power line resistance with a pot.  

Quote
Any pin could be another 1-wire bus, but I don't know if the library supports that or not.

If DS got the idea that they could sell more devices by supporting more pins, would it happen ASAP?

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Reporting smiley Successfuly connected 22 DS18B20 sensors and one DHT22. I used one 4.7k resistor for those 22 DS18B20 sensors and one 4.7k resistor for that one DHT22.

DHT22 sensor is wired like that:
http://api.ning.com/files/PKFE7DukclQO*V1lbgx2A1Xd*8ffMCvXqAA4Qd-*7J2cFd9DkoZyqDjdIURURatYsNTYNDLc77VSqOklXk-YnQmKI4l6dfie/RHT03arduino1.png

How can i wire multiple DHT22 sensors on Arduino Mega board? Becouse DHT22 data cable has to be each on its own pin, so therefore i have to use as many resistors as there are DHT22 sensors or is there any other way to wire it up? Becouse if that is so, i think there i'll have the same problem as i had with DS18B20 sensors.
« Last Edit: March 01, 2013, 06:02:05 pm by gasperinn » Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4836
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are parallel to serial shift registers. You can read a whole line of bits from the pins on chained shift registers (1 CS on the master to CS chip 1 chains to CS chip 2, etc) as SPI serial at 2 MHz. But, hardware SPI may use pins that 1-wire does so maybe use soft-SPI and 1 MHz speed.

 


Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are parallel to serial shift registers. You can read a whole line of bits from the pins on chained shift registers (1 CS on the master to CS chip 1 chains to CS chip 2, etc) as SPI serial at 2 MHz. But, hardware SPI may use pins that 1-wire does so maybe use soft-SPI and 1 MHz speed.

The 1-wire stuff is only in software already, so you can pick any pin you want for it.

(gasperinn)   That's cool on the 22 connected.  How long is the bus physically?
Logged

Experience, it's what you get when you were expecting something else.

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4836
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are parallel to serial shift registers. You can read a whole line of bits from the pins on chained shift registers (1 CS on the master to CS chip 1 chains to CS chip 2, etc) as SPI serial at 2 MHz. But, hardware SPI may use pins that 1-wire does so maybe use soft-SPI and 1 MHz speed.

The 1-wire stuff is only in software already, so you can pick any pin you want for it.

That says yes, hardware SPI can live with 1-wire. 2 buses can cross on a single chip.  smiley-grin

Quote
(gasperinn)   That's cool on the 22 connected.  How long is the bus physically?

Quote
OP:
How can i wire multiple DHT22 sensors on Arduino Mega board? Becouse DHT22 data cable has to be each on its own pin, so therefore i have to use as many resistors as there are DHT22 sensors or is there any other way to wire it up?

He can wire the DHT22's through a resistor each to the parallel-in side of 3 daisy-chained shift registers on an SPI bus and read, semi-process and store the states of all the DHT22's as bits at SPI speed, 2MB/sec. To read and store 24 bits through SPI would take only 24 cycles, 1.5 usec and you have all your DHT22 lines as digital states. If you do that 1000x a second, you have loads of time to copy the data to SPI between captures, 976 cycles out of 1000.

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@afremont, @GoForSmoke, i dont know, every sensor is physically cca. 15m away from the Arduino board, and it is wired with standard UTP network cable smiley

@GoForSmoke, i don't realy understand how do you meen, do you maybe have any shematic picture or something like that?  smiley-red
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4836
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Time to look at the datasheet, it tells all.  The only difference is that you have to supply extra power when a temp conversion (or EEPROM write) is in progress.  The datasheet shows how to do it, it's simple; it takes an extra i/o pin though.  You just enable the pin after issuing the conversion command.  That in turn bypasses the pull-up resistor on the data line (Q) so that the device has plenty of power to do the temp conversion or write to its EEPROM.  Look at the datasheet, they have a nice write-up on how it all works.

Is that for parasite mode only?

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4836
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@GoForSmoke, i don't realy understand how do you meen, do you maybe have any shematic picture or something like that?  smiley-red

Using SPI bus shift registers, it would connect like in the Daisy chain SPI configuration here:
Daisy chain SPI configuration

The 3 SPI slaves would be 3 8-bit parallel to serial shift registers. A sensor would hook to each input pin which is not shown in the wikipedia diagram. The registers read the digital state from the sensor and on command, copies those as bits. Then the bits are shifted out of the chips and read by the master in as fast as 1.5 microseconds.

The register has its own power line, some people power leds off them on external power.

Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Time to look at the datasheet, it tells all.  The only difference is that you have to supply extra power when a temp conversion (or EEPROM write) is in progress.  The datasheet shows how to do it, it's simple; it takes an extra i/o pin though.  You just enable the pin after issuing the conversion command.  That in turn bypasses the pull-up resistor on the data line (Q) so that the device has plenty of power to do the temp conversion or write to its EEPROM.  Look at the datasheet, they have a nice write-up on how it all works.

Is that for parasite mode only?



Yes it is.
Logged

Experience, it's what you get when you were expecting something else.

Pages: 1 [2] 3 4 5   Go Up
Jump to: