Pages: [1] 2   Go Down
Author Topic: Help with DS18B20, not found  (Read 3947 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 44
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I have a single DS1820B and the OneWire library from http://www.pjrc.com/teensy/td_libs_OneWire.html

I have pin 1 to gnd, pin 2 to digital pin 10 on my uno and pin 3 to +5v. I also have a 4k7 resistor on my breadboard across pins 2 & 3 which I believe is correct.

I loaded the example shipped with the OneWire lib, checked the bus pin was correct and pushed it to my uno but it does not find my sensor, serial output is simply "No more addresses"

I have tried two different DS18B20 sensors and two different resistors (of the same value). I've stripped my breadboard of everything else and I have 4.96v to the sensor according to my multimeter. I'm 99.99% sure everything is wired correctly as per the pinouts on http://datasheets.maxim-ic.com/en/ds/DS18B20.pdf

Any ideas what else I could be missing?

Thanks in advance.

Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Quote
Any ideas what else I could be missing?

Posting your code?


have you tried  - http://www.milesburton.com/Dallas_Temperature_Control_Library - works like a charm on the UNO
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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


Quote
Any ideas what else I could be missing?

Posting your code?


The code is simply the sample included with the OneWire library...

Code:
#include <OneWire.h>

/* DS18S20 Temperature chip i/o */

OneWire  ds(10);  // on pin 10

void setup(void) {
  Serial.begin(9600);
}
   
void loop(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
    Serial.print("No more addresses.\n");
    ds.reset_search();
    delay(250);
    return;
  }
  ....

have you tried  - http://www.milesburton.com/Dallas_Temperature_Control_Library - works like a charm on the UNO

I tried this also and loaded the example sketch that ships with that library, also the same result.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


Sounds more and more like hardware.

- how long is the cable used?
- have you tried without the resistor?

- did you (double) check the pin 1 and 3
- did you (double) checked the cables?

I assume you have but I can't think of anythink better yet ...
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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


Sounds more and more like hardware.

- how long is the cable used?
- have you tried without the resistor?

- did you (double) check the pin 1 and 3
- did you (double) checked the cables?

I assume you have but I can't think of anythink better yet ...


Yeah I agreee it sounds like hardware but im honestly sure everything is hooked up correctly.

I had soldered wire onto the first sensor, but we're talking 20cm max wich I hope is ok as I plan eventually to run these at ~ 100 meters. I deicided I might have fried the sensor with heat from the soldering iron so took a new one and plugged it directly into the breadboard.

I've got voltage at the sensor so obviously those cables are ok, I've got continuity from pin 2 back to pin 10 on the uno so that rules out any broken wire I guess. I've tried pin 2 back to a different digital pin on the uno too but to no avail.

Im sure I have the pins in the correct order, if I look at the sensor with the flat face towards me and legs pointing downward, leg 1 is on the left and is going to gnd, the right hand leg to +5v. That said they are going to gnd & +5v rails on the breadboard but the voltage is there so shouldnt make any difference right?

I have not tried without the resistor, Im really new to this so I wasnt sure if I would do any damage running without a resistor but I can try that and see what happens.

Logged

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

Not sure if this makes any odds but originally when I ran the "Single" sketch from the Dallas temp lib, I was getting no sensors found and a temp of -127c for address 0000000000000000

Without the resistor, still 0 devices found but the temp is now 0c
Code:
Dallas Temperature IC Control Library Demo
Locating devices...Found 0 devices.
Parasite power is: OFF
Unable to find address for Device 0
Device 0 Address: 0000000000000000
Device 0 Resolution: 0
Requesting temperatures...DONE
Temp C: 0.00 Temp F: 32.00
Logged

South Africa
Offline Offline
Sr. Member
****
Karma: 2
Posts: 403
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was getting no sensors found and a temp of -127c for address 0000000000000000

I looked at these sensors a few weeks back. I seem to recall that you had to run some initial software to get the Device Address which is unique for each sensor, and then put that device address into your code that is receiving the temp value from that specific sensor. Each sensor has a unique device address, and this allows you to have multiple sensors on the same line connected to the same pin, and you're able to query the value from a specific sensor on that line by using its unique address.

Hope that helps.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

- can you measure 5V at the sensor side?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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


I looked at these sensors a few weeks back. I seem to recall that you had to run some initial software to get the Device Address which is unique for each sensor, and then put that device address into your code that is receiving the temp value from that specific sensor. Each sensor has a unique device address, and this allows you to have multiple sensors on the same line connected to the same pin, and you're able to query the value from a specific sensor on that line by using its unique address.

Hope that helps.


Thanks but I already know this. Calling the search method from the OneWire library should find all of the addresses on the bus, I am calling this, my problem is that it is not finding anything on the bus though smiley-sad
Logged

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

- can you measure 5V at the sensor side?


yes, well 4.97v between pins 1 & 3
Logged

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 642
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unfortunately I don't know what's wrong, but I bought several DS18B20's a few weeks ago.

The onewire sample example apparently is written for the DS18S20, not the B version.
When I run it, all sensors/addresses are found but I get no sensor-readings, error-msgs keep telling me "device is not a DS18S20 family device".

I did get values of -127 C after accidentally having plugged in one LM335 (and a few DS18B20's) on the bus. For some reason 85C and 0C are values I've seen several times on all sensors, but I haven't paid too much attention to know what I did wrong to get that on display.

Using the dallastemperature-Lib I do get the correct readings though.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Simpson_Jr
Somewhere in your code is the model ID, you should check your code for this magic number and replace it

#define DS18S20MODEL 0x10
#define DS18B20MODEL 0x28
#define DS1822MODEL  0x22

-127 C is a value returned when it is disconnected
#define DEVICE_DISCONNECTED -127

0C is a value when there is nothing written in the variable to hold the temperature.

85C is the power-on reset value of the temperature register (datasheet DS18B20).

FYI, #defines from Dallas Temp Lib.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Netherlands
Offline Offline
God Member
*****
Karma: 7
Posts: 642
A naughty mind is a joy forever.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Rob for the info,
As told I already got the stuff working. I just run the onewire-sample to see what would happen and gave my info hoping I could make a contribution.  Reading back my message I can see you may have interpreted as a question, sorry for not writing it better.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@simpson_jr
It might answer the particular values you got smiley-wink
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

This might help to ensure I am not just being dim

Logged

Pages: [1] 2   Go Up
Jump to: