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

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.

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.

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?

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.

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.

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?

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.

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.

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?

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.

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.

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.

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

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.

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.