Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

DS18B20 wiring help


  • Please log in to reply
12 replies to this topic

#1 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 20 December 2011 - 03:31 AM

Hi, I'm working on a simple project to report 4 temps, I'm having a lot of analog noise with my LM35 sensors and ordered some DS18B20 to give them a try. I plan on flashing my N+ per the instructions here: http://forums.netdui...-onewire-alpha/ But I don't understand the wiring. Does someone have a picture of how to wire one of these sensors? I've been looking at the tech spec here: http://www.google.co...pboyJ6sgpwv-0kA should it be something like N+ 5v -> DS18B20 Pin3 N+ grd -> DS18B20 Pin1 N+ digI/O pin0 -> 4.7kohm resistor -> DS18B20 pin2 ? does it matter which digital I/O pin i use on the N+? Thanks! Chris

#2 andro

andro

    Member

  • Members
  • PipPip
  • 10 posts
  • LocationSlovakia

Posted 20 December 2011 - 09:50 AM

Yes N+ 5v -> DS18B20 Pin3 N+ grd -> DS18B20 Pin1 N+ digI/O pin0 -> DS18B20 pin2 4.7kohm resistor you don't need to use. On my foto red is 5V black GND white Digital I/O 0 It doesn't matter whits Digital I/O you use.

Attached Files



#3 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 24 December 2011 - 03:16 PM

Thanks for the reply. I don't mean to be argumentative, but I in the first post on this link they say a resistor is mandatory http://forums.netdui...-onewire-alpha/ I don't understand why that is stated though. THe sensor says it works off of 3-5v so i don't see why one would be needed in the supply line from the N+ to the sensor. Is the thought that too much current could pass through the sensor and damage the digital i/o port on the N+? I don't know very much about electronics but i agree that it seems a resistor isn't needed, I wonder why the post explicitly says its mandatory.....

#4 OppaErich

OppaErich

    Member

  • Members
  • PipPip
  • 22 posts
  • LocationEssen, Germany

Posted 24 December 2011 - 08:26 PM

4.7kohm resistor you don't need to use.

You DO need the resistor to tie the com line high, otherwise it would be floating = noise sensitive. It may work without it mos of the time but that's just luck.

#5 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 24 December 2011 - 08:56 PM

I don't understand why that is stated though. The sensor says it works off of 3-5v so i don't see why one would be needed in the supply line from the N+ to the sensor.

The resistor is required by the 1-Wire specification - when in doubt, check the datasheet, it usually contains recommended application circuits (it is not current limiting resistor on a power supply line, it is open-drain data line pull-up to ensure the logic level is high when there is no communication happening). Even though the resistor is mandatory, it does not necessarily mean the external one - you can use microcontroller's internal pull-up resistor, if it meets the 1-Wire specification requirements.

Also, 1-Wire devices do not require external power supply, they are powered from the data line ("parasite power"). DS18B20 is kind of exceptional in this regard, it allows external power supply connection - the advantage of this is that you don't need the external MOSFET to switch 'strong pull-up' during temperature conversion.

#6 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 25 December 2011 - 03:46 AM

Thanks for the responses. I've read most of the datasheet before, its just i have no experience with electronics and was confused by the diagrams. I think i understand the jist of it now. I plan on driving the sensors from an external power supply (N+ 5v port) just because the datasheet says it is recommended for temps over 100C which my boil kettle will see. Sorry for being such a newbie but are these the correct type of resistors to use on the datalink line? http://www.amazon.co...n/dp/B0017KG038 To wire it would one pin be in the DQ port on the sensor and the other end of it going to ground? (ive never used a resister in a project) Sorry for the newbie questions. Happy Holidays!

#7 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 25 December 2011 - 09:10 AM

Sorry for being such a newbie but are these the correct type of resistors to use on the datalink line? http://www.amazon.co...n/dp/B0017KG038

Yes, these are fine.

To wire it would one pin be in the DQ port on the sensor and the other end of it going to ground?

No, the resistor should go from the DQ line to +5V (see the attached picture; it is basically connected between sensor pins 2 and 3).

Marry Christmas to you too!

Attached Files



#8 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 26 December 2011 - 07:51 PM

Thanks very much CW2! Just waiting on the sensors at this point... BTW what software are you using to create the wiring schematic?

#9 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 26 December 2011 - 09:02 PM

BTW what software are you using to create the wiring schematic?

That breadboard schematic is done in Fritzing (it includes all Netduino-s since version 0.5.0b).

#10 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 28 December 2011 - 05:08 AM

thanks much for the help CW2, got the sensors and flashed my N+ per your post. Got this from your test app (without the resester, im picking them up tomorrow and will include in the wiring) 1-Wire device present Single device present 6F000003CE3DEB28 Device is on the bus 22.5625 22.8125 Do you think it it would be best to have the sensors wired into the same digital i/o port? I'm going to be using 5 total. Thanks!! Chris

#11 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 28 December 2011 - 10:14 AM

Do you think it it would be best to have the sensors wired into the same digital i/o port? I'm going to be using 5 total.

Well, it depends - if you need to identify individual sensors, you can either check their ROM id (then you'd probably need to update the code when you replace sensor with a different one) or place each sensor on different IO port. You can have many sensors on one line, as long as you don't exceed electrical ratings (e.g. max. IO port current when they are "parasite" powered).

Alternatively, you can use DS1825 thermometer, which is basically DS18B20 with 4-bit location address used for identification. Also check out Stuart's DS18*20 Temperature Sensor Auto Identity Circuit.

#12 cobolstinks

cobolstinks

    Member

  • Members
  • PipPip
  • 27 posts

Posted 29 December 2011 - 05:26 PM

thanks for the input i got multiple sensors working on the same I/O port by using the discovering network class from valkarie. I think ill just mantain a dictionary of roms and wire them to the same digital i/o. This way it wont matter which xlr connector i connect the sensors to either... Thanks again, your library is working great!

#13 OZ8ET

OZ8ET

    Advanced Member

  • Members
  • PipPipPip
  • 72 posts
  • LocationHundested, Denmark

Posted 30 December 2011 - 06:58 AM

Hi I also use CW2's lib - works greate. To the connection issue: I use pin 1 and 3 to Gnd and pin 2 to D0 - no pull up (neede with 2 sensors). I only run "One Wire!!" (and Gnd) and no +5V. I once found, that connecting both pin 1 and 3 to Gnd, gives a litle more noice imunity. I will public my house-controller project some day. I use it to control my vacation house and to ensure that it is warm and cosy when I arrive (turn heating from sleep-mode to normal mode from home via internet). Regards Erik




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.