DS18B20 multiple sensors

michinyon:
Why would you need "another pin" to supply 5V to the sensors ?

You'd need another wire, to use the 3 wire mode, but you could connect that third power supply wire to +5V in
all sorts of ways without using "another pin".

Clearly I've missed it again. In parasite power mode, you don't supply power to the Vcc pin of the sensor, it is GROUNDED. The sensor gets its power from the DQ data line, but the 1mA supplied is not enough to power the device during a temperature conversion. The device requires 1.5mA and the 4.7k pullup is too big. Also, you can tell all the devices on the bus to start a temp conversion at the same time so that they overlap the long delay during the conversion (750mS for 12 bits). If you had 20 devices, then you'd need to supply 30mA to the DQ bus by bypassing the pullup in some fashion. At any rate, the Vcc pin isn't being connected to anything but ground when using parasite power mode.

EDIT: Please, I beg both of you to download this document and look at Figure 4 and Figure 5 if nothing else:
http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
Please.

GoForSmoke:
I guess he would rather spend a pin and extra code than some wire.

Well yeah, it's kinda the whole point of having parasite power mode. I didn't invent it, just trying to explain how it works. By using only two wires (DATA and GND aka 1-wire parasite mode), you can often more easily find some way to wedge it into an existing system. For example you can stick these on unused pairs of cat-5 cable. It would be allot messier if you needed another wire. Running cable is not cheap.

You have to keep in mind that none of these devices were created with the home hobbyist in mind. They were designed to solve real world problems in an industrial environment. Sure it's easy to run another 12" wire at home, it's another thing to demand a shielded set of three or four wires run thru a factory when you can just toss some code and an open i/o pin at it and use an empty twisted pair already going right where you need it. Not to mention that if you have an old plant, you probably have some network coax already installed that's not doing anything since the cat-5 was installed. You could use that for 1-wire if you wanted.

afremont:

michinyon:
Why would you need "another pin" to supply 5V to the sensors ?

You'd need another wire, to use the 3 wire mode, but you could connect that third power supply wire to +5V in
all sorts of ways without using "another pin".

Clearly I've missed it again. In parasite power mode, you don't supply power to the Vcc pin of the sensor, it is GROUNDED. The sensor gets its power from the DQ data line, but the 1mA supplied is not enough to power the device during a temperature conversion. The device requires 1.5mA and the 4.7k pullup is too big. Also, you can tell all the devices on the bus to start a temp conversion at the same time so that they overlap the long delay during the conversion (750mS for 12 bits). If you had 20 devices, then you'd need to supply 30mA to the DQ bus by bypassing the pullup in some fashion. At any rate, the Vcc pin isn't being connected to anything but ground when using parasite power mode.

EDIT: Please, I beg both of you to download this document and look at Figure 4 and Figure 5 if nothing else:
http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
Please.

Arduino UNO pin can supply 40 mA at 5V without damage.

------* the mystical, magical Parasite mode, the only way that makes sense! ------*

Why do I want to read that document? You explained the same thing already but seem to have trouble that anyone else should think that running a power wire makes any sense. Okay, fine, there's a special big-deal parasite mode.. got the message and the junk mail, thank you.

As Uncle Frank used to say: Is that a real poncho or is that a Sears' poncho?

GoForSmoke:

afremont:

michinyon:
Why would you need "another pin" to supply 5V to the sensors ?

You'd need another wire, to use the 3 wire mode, but you could connect that third power supply wire to +5V in
all sorts of ways without using "another pin".

Clearly I've missed it again. In parasite power mode, you don't supply power to the Vcc pin of the sensor, it is GROUNDED. The sensor gets its power from the DQ data line, but the 1mA supplied is not enough to power the device during a temperature conversion. The device requires 1.5mA and the 4.7k pullup is too big. Also, you can tell all the devices on the bus to start a temp conversion at the same time so that they overlap the long delay during the conversion (750mS for 12 bits). If you had 20 devices, then you'd need to supply 30mA to the DQ bus by bypassing the pullup in some fashion. At any rate, the Vcc pin isn't being connected to anything but ground when using parasite power mode.

EDIT: Please, I beg both of you to download this document and look at Figure 4 and Figure 5 if nothing else:
http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
Please.

Arduino UNO pin can supply 40 mA at 5V without damage.

------* the mystical, magical Parasite mode, the only way that makes sense! ------*

Why do I want to read that document? You explained the same thing already but seem to have trouble that anyone else should think that running a power wire makes any sense. Okay, fine, there's a special big-deal parasite mode.. got the message and the junk mail, thank you.

As Uncle Frank used to say: Is that a real poncho or is that a Sears' poncho?

First off, you shouldn't make bogus statements like that. 40mA is that absolute maximum current allowed out any single pin and 200mA is for the entire device. You do not operate devices at their maximum spec, the datasheet even tells you so. At 20mA output, an i/o pin is only guaranteed to give you 4.1V with a 5V supply. What do you think happens at 40mA load on the pin? People that read datasheets already know this though.

As for the "junk mail" I'm not sure what you are talking about, I sure didn't send you any PM. But since you think the time I spent trying to get you to understand how it works wasn't worthwhile, I'll keep your smart remarks in mind next time you want some help.

Go ahead and exceed specs on your own designs, but please don't recommend that others do so as well.
As for reading the document, what is the problem? Why argue with me and make me explain it numerous times when you could have just looked at the picture and understood. My advice is to start reading the datasheets, at least before you start arguing with someone.

If you can't see the advantage of parasite power mode, then it's probably due to a lack of education.

*NOTICE: Stresses beyond those listed under “Absolute
Maximum Ratings” may cause permanent damage
to the device. This is a stress rating only and
functional operation of the device at these or
other conditions beyond those indicated in the
operational sections of this specification is not
implied. Exposure to absolute maximum rating
conditions for extended periods may affect
device reliability.

One last question for you. Why is it ok to dedicate an i/o pin for a clock and even another i/o pin for a CS, but using one to comply with manufacturer recommendations is wasteful? The 1-wire bus uses neither a clock nor a chip selector.

Why argue with me and make me explain it numerous times when you could have just looked at the picture and understood

I got your point the first time but you don't seem to have figured that out.

I was asking questions not directly relevant to your post, not trying to have an argument nor to hear that I didn't get your point.. again and again and again. You are wrong. I understood the first explanation. And given that yes, I did question the absolute world-enlightening brilliance of parasite mode over using a grody little power wire instead, I should be flayed alive and fed to ants. :roll_eyes:

At 20 mA output, an i/o pin is only guaranteed to give you 4.1V with a 5 V supply.....People that read datasheets already know this though.

Figure 35-24.ATmega328P: I/O Pin Output Voltage vs. Source Current (VCC = 5V)

And 20 mA with 5Vcc in worst case at 105 C is just below 4.3V according to ATMEL. At 25 C which is warm it's just under 4.5V on the chart. I had the old datasheet more than a year ago and just got the updated one last week.

Unless those lines take a sharp turn between 20 mA and 40 mA, it stands to get a little below 4V. Will the DS18B20 run at such low voltages? Maxim says it can run on 3V.
Will it kill my 328P pin to push 40 mA for 100 milliseconds? I doubt it. But keep doing that and the lifetime of the MCU should shorten though I bet not drastically.

No, it's not bright but, once again, it is possible. Would I do it? It depends on what for. It's NOT a good idea, the charts only show to 20 mA for a reason but that is not because you will fall off the edge of the world if you do it. It's also not bright to overclock a CPU but that's done too and generally the CPU lasts until it's obsolete and so cheap to replace most people don't care.

I know it's not a great idea and far, far worse, I mentioned it to you.

*NOTICE: Stresses beyond those listed under “Absolute
Maximum Ratings” may cause permanent damage
to the device. This is a stress rating only and
functional operation of the device at these or
other conditions beyond those indicated in the
operational sections of this specification is not
implied. Exposure to absolute maximum rating
conditions for extended periods may affect
device reliability.

Here's some bits from Maxim that haven't been brought up, possibly because they don't indicate parasite power as the end-all be-all mode for DS18B20 and offer just a little hope that discussion on powered mode won't result in death by boredom through repeated explanations of how the wonderful parasite mode can be the only way to use these chips.

If the DS18B20 is powered by an external supply, the master can issue “read time slots” (see the 1-Wire Bus System section) after the Convert T command and the DS18B20 will respond by transmitting 0 while the temperature conversion is in progress and 1 when the conversion is done. If the DS18B20 is powered with parasite power, this notification technique cannot be used since the bus must be pulled high by a strong pullup during the entire temperature conversion. The bus requirements for parasite power are explained in detail in the Powering the DS18B20 section.

And there's a whole section on TIME SLOTS. Just guessing but it looks like the things run faster when they're coordinated. But really, who wants THAT? It, gasp, uses an extra wire!

Parasite power is very useful for applications that require remote temperature sensing or that are very space constrained. Figure 1 shows the DS18B20’s parasite-power control circuitry, which “steals” power from the 1-Wire

How can this be when parasite power is the only mode these chips should be run? How dare they?
How dare -anyone- question using parasite power? If not in the Maxim doc then at this forum! It should be banned!

The DS18B20 can also be powered by the conventional method of connecting an external power supply to the VDD pin, as shown in Figure 5. The advantage of this method is that the MOSFET pullup is not required, and the 1-Wire bus is free to carry other traffic during the temperature conversion time.

========================================================================================

You give me too little credit and you jump to conclusions too easily. You can't tell tell when someone makes anything like a less than a totally serious remark.

It's not like I asked or told about something that would cause bodily harm or legal proceedings.

=========================================================================================

Hey OP! I'd go with the power wire if I was you! It should be easier, cheaper and maybe faster not just running but getting debugged.

GoForSmoke:

Why argue with me and make me explain it numerous times when you could have just looked at the picture and understood

I got your point the first time but you don't seem to have figured that out.

I was asking questions not directly relevant to your post, not trying to have an argument nor to hear that I didn't get your point.. again and again and again. You are wrong. I understood the first explanation. And given that yes, I did question the absolute world-enlightening brilliance of parasite mode over using a grody little power wire instead, I should be flayed alive and fed to ants. :roll_eyes:

At 20 mA output, an i/o pin is only guaranteed to give you 4.1V with a 5 V supply.....People that read datasheets already know this though.

Figure 35-24.ATmega328P: I/O Pin Output Voltage vs. Source Current (VCC = 5V)

And 20 mA with 5Vcc in worst case at 105 C is just below 4.3V according to ATMEL. At 25 C which is warm it's just under 4.5V on the chart. I had the old datasheet more than a year ago and just got the updated one last week.

Unless those lines take a sharp turn between 20 mA and 40 mA, it stands to get a little below 4V. Will the DS18B20 run at such low voltages? Maxim says it can run on 3V.
Will it kill my 328P pin to push 40 mA for 100 milliseconds? I doubt it. But keep doing that and the lifetime of the MCU should shorten though I bet not drastically.

No, it's not bright but, once again, it is possible. Would I do it? It depends on what for. It's NOT a good idea, the charts only show to 20 mA for a reason but that is not because you will fall off the edge of the world if you do it. It's also not bright to overclock a CPU but that's done too and generally the CPU lasts until it's obsolete and so cheap to replace most people don't care.

I know it's not a great idea and far, far worse, I mentioned it to you.

*NOTICE: Stresses beyond those listed under “Absolute
Maximum Ratings” may cause permanent damage
to the device. This is a stress rating only and
functional operation of the device at these or
other conditions beyond those indicated in the
operational sections of this specification is not
implied. Exposure to absolute maximum rating
conditions for extended periods may affect
device reliability.

Here's some bits from Maxim that haven't been brought up, possibly because they don't indicate parasite power as the end-all be-all mode for DS18B20 and offer just a little hope that discussion on powered mode won't result in death by boredom through repeated explanations of how the wonderful parasite mode can be the only way to use these chips.

If the DS18B20 is powered by an external supply, the master can issue “read time slots” (see the 1-Wire Bus System section) after the Convert T command and the DS18B20 will respond by transmitting 0 while the temperature conversion is in progress and 1 when the conversion is done. If the DS18B20 is powered with parasite power, this notification technique cannot be used since the bus must be pulled high by a strong pullup during the entire temperature conversion. The bus requirements for parasite power are explained in detail in the Powering the DS18B20 section.

And there's a whole section on TIME SLOTS. Just guessing but it looks like the things run faster when they're coordinated. But really, who wants THAT? It, gasp, uses an extra wire!

Parasite power is very useful for applications that require remote temperature sensing or that are very space constrained. Figure 1 shows the DS18B20’s parasite-power control circuitry, which “steals” power from the 1-Wire

How can this be when parasite power is the only mode these chips should be run? How dare they?
How dare -anyone- question using parasite power? If not in the Maxim doc then at this forum! It should be banned!

The DS18B20 can also be powered by the conventional method of connecting an external power supply to the VDD pin, as shown in Figure 5. The advantage of this method is that the MOSFET pullup is not required, and the 1-Wire bus is free to carry other traffic during the temperature conversion time.

========================================================================================

You give me too little credit and you jump to conclusions too easily. You can't tell tell when someone makes anything like a less than a totally serious remark.

It's not like I asked or told about something that would cause bodily harm or legal proceedings.

=========================================================================================

Hey OP! I'd go with the power wire if I was you! It should be easier, cheaper and maybe faster not just running but getting debugged.

Typical curves from charts are not guaranteed, you have to use the numbers from the DC Characteristics chart since those are the ones that are guaranteed. Nice try though.

I never said parasite mode was the only (or even the best) way, I just tried to explain why it might be useful to some people. You seem to think that I was trying to shove it down everyone's throat as the only way to do something.

"Just guessing" about the time slots got you what you deserved, a wrong assumption. The time slots don't change because you are using parasite power mode, nice try though. Reading instead of guessing is much more useful in my opinion.

You can make all the excuses you want, but you still recommended operating the device against the manufacturers recommendations. Perhaps you'd like to pay for someones Arduino when they toast it from listening to your poor advice.

I don't know what you are trying to prove by posting tidbits from the document. Of course the bus can carry other traffic when not using parasite mode. I already know about checking the status of a temp conversion when not using parasite power mode. I started playing with 1-wire stuff 10 years ago, remember? How many have you implemented? How much bit-banging code have you written for them?

Whatever the OP does, he shouldn't listen to people that refuse to read the datasheets. Your advice to the OP about faster debugging by using the power wire should also be ignored since it is wrong. It's not going to make any difference if he uses the library.

By the way, 1K EEPROMs hold 1K bits of information, not 1K bytes like you mis-advised someone in another post about data logging.

Next time read the whole warning notice about operating devices at their max specs. You missed the part about never operating the device even at the max specs, not just beyond. If you operate the device at max specs, then you have no right to complain when it doesn't meet other specifications.

40mA for 100mS? The temp conversions take as much as 750mS for a 12 bit reading. I'm done.

I want to apologize to the OP and the rest of the forum for the nonsense. I only meant to offer some input, I certainly wasn't trying to force anything on anyone. Sorry about the thread hijack.

afremont:
I never said parasite mode was the only (or even the best) way, I just tried to explain why it might be useful to some people. You seem to think that I was trying to shove it down everyone's throat as the only way to do something.

And giving people who even asked about different a load of yourself.

"Just guessing" about the time slots got you what you deserved, a wrong assumption. The time slots don't change because you are using parasite power mode, nice try though. Reading instead of guessing is much more useful in my opinion.

I'm not just guessing that slots are handled differently -without- the handshake they exclude by mode of operation. And I do know how handshaking and speed go together so call it an educated guess.

You can make all the excuses you want, but you still recommended operating the device against the manufacturers recommendations. Perhaps you'd like to pay for someones Arduino when they toast it from listening to your poor advice.

Here's the exact words:
Arduino UNO pin can supply 40 mA at 5V without damage.

Guess where this came from? Better get your lawyers.

Summary
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz

Whatever the OP does, he shouldn't listen to people that refuse to read the datasheets. Your advice to the OP about faster debugging by using the power wire should also be ignored since it is wrong. It's not going to make any difference if he uses the library.

Of course. Everything to do with that will go right without a hitch.

By the way, 1K EEPROMs hold 1K bits of information, not 1K bytes like you mis-advised someone in another post about data logging.

What? Didn't you read the ATMEL DATASHEET?

– 256/512/512/1KBytes EEPROM

Next time read the whole warning notice about operating devices at their max specs. You missed the part about never operating the device even at the max specs, not just beyond. If you operate the device at max specs, then you have no right to complain when it doesn't meet other specifications.

I quoted the part about that. And I stated that I don't make a practice of doing that.
For me writing ONE SENTENCE you've gotten more wound up than Bill O'Reilly on a good day.

40mA for 100mS? The temp conversions take as much as 750mS for a 12 bit reading. I'm done.

promises....

Like I said, a 1K EEPROM, such as the 2401 is 1K bits. EEPROM sizes are stated in bits. Straight from page 1 of the Atmel datasheet:

Two-wire
Serial EEPROM
1K (128 x 8)
2K (256 x 8)
4K (512 x 8)
8K (1024 x 8)
16K (2048 x 8)

For example a 2401 is 1K bits, a 2416 is 16K bits. The part number makes it clear how they are numbered. You're still not going to admit you were wrong though, now will you?

I read thru the whole spiel again and I don't see where I was anything but polite to you until you started insulting me. I honestly thought you didn't understand why anyone would want to use parasite mode so I tried to explain why.

ATMEL EEPROM datasheets don't list the ATMega 328P, do they? But they say bits so you just hang tight to that and let denial take care of the rest.

The ATMEL datasheet for the ATMegas including the 328P says:

ATMEL: – 256/512/512/1KBytes EEPROM

ATMEL: 8.4 EEPROM Data Memory
The ATmega48A/PA/88A/PA/168A/PA/328/P contains 256/512/512/1Kbytes of data EEPROM memory. It is organized as a separate data space, in which single bytes can be read and written.

That's BYTES there, not bits, as in ATMEL says the 328P in the UNO has 1k BYTES of EEPROM.

What does Arduino say?

Arduino: EEPROM 1 KB (ATmega328)

I won't bother quoting the forum but a lot of people writing and reading UNO EEPROM's keep saying there's 1k bytes. Nobody is saying that after byte 127 they ran out.

I didn't tell some poor user the UNO has 1k bytes of EEPROM when there's 1k bits. That's because there really is 1k bytes EEPROM in the UNO.

Scuze me, thought you were talking about using an external serial EEPROM since you had just mentioned an SD card. Wasn't even thinking of the 328p, that's why I referred to EEPROM datasheets and sizing terminology.

BTW, it really doesn't matter what any Arduino documentation might say about technical specs like current limits. So don't bother citing any of that when talking about electrical characteristics of the 328P. The only thing that matters is what the manufacturer puts in the datasheet. Also, characterizations of "typical" devices can be interesting like many of the charts in the datasheet, but they really can't be used to make design decisions. You have to use worst case numbers if you want to create reliable circuits.

You can argue until you are blue in the face about it being ok to suck 40mA from a pin, and you can come up with all the rationalizatons you can dream up, but you're still wrong when you start advising others to do things that way. You can do things however you like in your designs, but don't expect to post in a technical forum that it's ok to exceed the recommended specs unless you want some flack for it. Honestly, you shouldn't even be drawing over 20mA from any pin. That's why they don't characterize the device for any more current than 20mA at 5V.

EDIT: I see where you got those numbers now, and I understand what you were referring to by them posting it on the web site advertising. All I can see is, they shouldn't be doing that and welcome to the world of marketing. Most of those claims are straight from the absolute maximum section. That's why you should always just download a datasheet and verify any marketing claim that you intend to actually depend upon.

You probably don't care, but heavily loading a pin can have other peculiar side effects. I don't know how much the AVR arch. mirrors the PIC, but trying to read or change the state of a heavily loaded pin can end with erroneous results when it's a RMW (read-modify-write) setup. Just because you can load a pin like that and not fry it is no excuse to do so. You can pull allot of hair before figuring out why other pins are changing state when you try to change one.

I wasn't trying to be a butt to you. You kept asking me questions about what I was saying, so I tried only to answer them the best I could. Just go back and look at the thread.

You can go through this forum and find many posts where I spell out 20 mA per pin and 200 mA total as recommended and not bright to exceed. My feeling is that the less you pull from the Arduino, the better.

But when someone says the SOS about me again and again despite me writing different, I might just pull their tail to see if they even notice and maybe got a hair across a sensitive spot.

Why would ATMEL say pulling 40 mA for extended periods MAY permanently damage the machine if that is no way true? Go climb up their butts. Maybe you will learn something you didn't expect.

As for me, I can see you do miss things and have your dearly held practices as I have mine but what is possible and can work doesn't care a bit for those.

GoForSmoke:
You can go through this forum and find many posts where I spell out 20 mA per pin and 200 mA total as recommended and not bright to exceed. My feeling is that the less you pull from the Arduino, the better.

That''s certainly not the way you sounded yesterday. Not that it matters any. I am only talking about what your were spouting yesterday.

But when someone says the SOS about me again and again despite me writing different, I might just pull their tail to see if they even notice and maybe got a hair across a sensitive spot.

Oh, so your intention WAS to just be an ass. Good job.

Why would ATMEL say pulling 40 mA for extended periods MAY permanently damage the machine if that is no way true? Go climb up their butts. Maybe you will learn something you didn't expect.

I don't have a problem with what Atmel says, I have a problem with people making bogus recommendations without bothering to tell anyone that they are recommending exceeding the specs. I certainly never said that the warning wasn't true. My advice is to heed the warning.

As for me, I can see you do miss things and have your dearly held practices as I have mine but what is possible and can work doesn't care a bit for those.

English please.

EDIT: Dude, after rereading the thread again, it's perfectly clear that you didn't have a clue about how any of it actually worked until you broke down and looked at the datasheet. You'd rather rely on your "educated guesses" and arguing with those that actually have experience than to bother to pick up a datasheet and see for yourself. Since you are the one that thinks that parasite mode is so stupid, why don't you climb up Dallas' butt and let them know how dumb they've been all these years? I'm sure they'd appreciate someone telling them. Why don't you tell us all now just how long you've been at all this electronics stuff?

I REALLY AM DONE NOW FIND SOMEBODY ELSE TO GOAD INTO A FIGHT All I did was answer your barrage of questions to the best of my ability, can't you even understand that much? If you didn't want to know what I thought, why the hell did you ask me?

Let me know when you've sobered up or your head gets down to regular size or they find the right meds for you, whatever.

GoForSmoke:
Let me know when you've sobered up or your head gets down to regular size or they find the right meds for you, whatever.

Go back and reread my last post, I added some more for you. I wouldn't want you to miss anything.

I hereby admit to being an ass to an asshole.

GoForSmoke:
I hereby admit to being an ass to an asshole.

I assume that's all inclusive, kinda like scoop to nuts. Only giving back what I got from you in spades after having had enough. At least I recognized the OP's problem by simply reading what he posted and knowing what was wrong from actual experience, what help did you give him by hijacking his thread and making an ass of yourself? Did you even notice that?

So long Troll.

GoForSmoke:
So long Troll.

Like I said, I didn't see you solving his problem. I'm also not the one that kept asking question after question and then getting p'd off because they didn't like the answers. What's up with you? I begged you to read the datasheet, but no, you had to just keep on asking questions and then you had to start insulting me. Now you call me the troll, when I wasn't even speaking to you to start with. All I ever did was recommend that the OP look into parasite power mode, you had to make some kind of federal case out of it. Go read the thread again. You started it all dude, now live with it. Stalker.