DS18B20 NOT RESPONDING

Using a single DS18B20 with a 3 wire connection (5v/Gnd/Signal to pin 2 & 4.7K pull-up) to Arduino UNO. Downloaded Onewire library and sample program(s).

Programs run fine, but no response from DS18B20. Serial monitor looks like.
-1000.00
-1000.00
Etc…..

  1. I’ve modified program and tried using different pins and sensors. (Although both sensors are from the same Ebay source)
  2. I’ve downloaded and run a program to find the Onewire address, but the program indicates no sensors found.

Is it possible the sensor(s) is dead? I am 100% sure my connections are correct and were checked with a voltmeter. Any ideas would be appreciated.

Try connecting the DS18B20's 5V and GND both to GND and just use the pullup on the signal pin to 5V for power.

Don't ask me why they sometimes don't work if you connect the 5V to 5V -- I don't know.

1 Like

Need to see your code. Is it set up to connect to ds18b20 using 5V or parasite power?
You could also try a lower pullup resistor - 3.3k or even 1.5k.

Pete

Thanks for the input, I'll try different connections and pull-ups. I've tried the 5v and 3.3v source from the Uno with the same result. I've powered the Uno with 5v.

Firstly double-check your pin-out - in fact always double-check all circuit wiring before powering up (saves
a lot of money).

Chagrin:
Try connecting the DS18B20's 5V and GND both to GND and just use the pullup on the signal pin to 5V for power.

Don't ask me why they sometimes don't work if you connect the 5V to 5V -- I don't know.

I've used dozens of DS18B20's never the slightest issue (but mostly with very short cable).

If the sensor is on a long cable then you should (after testing without the cable):

  1. used screened cable, ground connected to screen (really important)
  2. do not run the cable alongside power wiring (motors, mains, etc).
  3. have a 0.1uF decoupling capacitor between +5V and ground at the sensor
  4. Have the pull-up resistor at the Arduino end

Don't use parasite power if you can help it, less reliable, perhaps reduce the pull-up resistor to 2k2 for very long cables...

No luck with parasitic setup, or standard 5v setup with 3.3K pull-up. Maybe the images tell something.

Mbird:
Programs run fine, but no response from DS18B20.

You say that, but the best evidence that it's true is a response from the DS18B20.

A proper listing of the code will be more useful than the pictures. I don't see the logic in the getTemp section shown. It seems that you are printing out a value but you you don't know where it is coming from, and I don't know why you need to do that sort of stuff anyway.

Here is some code that works.

If you intend to only use one or two sensors, there is nothing wrong with this approach, particularly as you are doing it on breadboard. If you intend to use more, it would pay to move to using the one-wire system that the DS18B20 is designed for. In that event I would recommend software and tutorials from Hacktronics

Mbird:
No luck with parasitic setup, or standard 5v setup with 3.3K pull-up. Maybe the images tell something.

Can't see how the sensor itself is wired. How long is the cable? Its not screened so wouldn't expect
it to work well if long.

Have you tried just wiring it up without the cable?

Is there a decoupling capacitor on the sensor (in 3-wire mode)?

Used the code recommended by Nick...Using a DS18B20 Temperature sensor with an Arduino- ar3ne1tt without success. Great simple code!
Serial port just reads 0.00 temp.
Sensor is either of two that I tested. Its a waterproof version with a 1m cable. Purchased on Ebay. It seems unlikely to me, but I suppose it could be a DOA sensor?

Mbird:
It seems unlikely to me, but I suppose it could be a DOA sensor?

I have ten and they all work fine. I have wired one the wrong way round and it survived. You know when this happens, as the lights go out and they get seriously hot.

Are you sure the code agrees with the wiring? I recall the signal goes to A0 in the code.

The only code I know of for testing is the Hacktronics address finder. It doesn't measure temperature, it just looks for a singe sensor and reports the address.

I did change the input pin to 2. My next options are to try

  1. A0 pin (as in the code)
  2. Capacitor

The devices work OK on digital or analogue pins, just so long as the code knows where it is. You should not need a capacitor unless you live in a truly filthy electronic environment, but if the cable is yours, you might try taking it off and putting the sensor direct on to the breadboard.

MBird,
In a previous thread I posted my DS1820 library. Maybe it will help.
http://forum.arduino.cc/index.php?topic=173589.msg1292707#msg1292707
It should help you to see how to talk to the device.

Thanks Totoro, I'll give it a try, but I am fairly certain the sensors, not the code or connections, are at fault. The sensors are Ebay waterproof versions with 1m cable. I suspect if I strip the cable jacket to the sensor end, I'll find the sensor is potted. Just doesn't make for broken wire troubleshooting.

Way too much time spent on $3 sensors from exotic origins (ie Hong Kong).

I am however amazed at the amount of support one can get on this forum and am truly appreciative.