DS18B20 Issues - all I get is 'null'

Posted on
  • Wow this is killing me. Something so simple and it's not working for me.

    I have 5 of this sensors I've just got off ebay, they are the red/green/yellow type. Here is a pic of my setup. I previously thought I'd got the wrong resistor, but reading around people are using other pull up resistor sizes with this cable so I should have got something. I've got the correct 4.7k resistors today. Still null.

    This is my setup. What am I doing wrong. I'm on v1.69 firmware. Also connected is a cc300o and bluetooth module. I've powered down the cc3000 but it makes no difference. I'm using A0 for the data. Tested on A1 too. Same result.

    Either I'm missing something basic, somethings not working on my board or I've been sent 5 duff sensors (tested with 3 so far, 2 different breadboards, and I've bridged an LED to confirm I've got 3.3v coming out)

    Apologies for posting up on something so basic, but I can't see where I'm going wrong.

  • Hm, that sure looks right to me. I'd check with an ohm meter and make sure all the connections are okay - the wiring is dead simple here, very little room for problems to hide.

    can you post the code you're using?

  • Thanks @DrAzzy. Good to know I've not made any obvious newbie mistakes with something this simple ;)

    Code is basic: just the example from the DS18B20 page on the espruino site, reproduced below with my A0 pin in place of A1.

    var ow = new OneWire(A0);
    var sensor = require("DS18B20").connect(ow);
    setInterval(function() {
    }, 1000);

    I also tried sensor.isPresent() which just returns false.

  • Is this working now? It seems from your other post at http://forum.espruino.com/conversations/­492/?offset=25#comment11810722 that it might be?

    I just tested here and it does work on 1v69 though...

  • Hi Gordon, no it's not I'm afraid. Thanks for testing your side to confirm it's ok on the firmware.

    The earlier post in the other thread was pre-obtaining the correct resistor. At that point I believed that my issue. (I thought i better leave that thread alone as it appeared to be unrelated to firmware since I installed several of the earlier binaries to test which I should have mentioned here. Same result as 1.69)

    I'm baffled. I suppose I probably need to try a sensor from a different supplier but is there a chance the bluetooth module has anything to do with this? I've powered down the CC3000 to rule it out but obviously the bluetooth is soldered on so powered up all the time. I'm clutching at straws with that though.

  • I don't think bluetooth or CC3000 would cause you any problems... I've done some CC3000 + DS18B20 temperature sensors so I know that they both work together... Just in case it might be worth unplugging it (at least from VCC) though?

    You mentioned at first that you bought 5 sensors... Have you tried any others? It could be that this particular one is dead...

    Just to be sure, you can also totally skip using the DS18B20 module, and can see if any OneWire devices can be found on the pin:

    var ow = new OneWire(A0);
    ow.search(); // should return an array of devices
  • Thanks Gordon, I've tried 3 of the 5 devices I have. I'll try your ow.search() suggestion tonight. Thanks again.

  • It seems that anything might go with regard to color-coding the wires on these sensors!

    I've revisited the ebay listing for the sensors I purchased, and the advert states in the tech specifications: yellow is ground, green is data!! It's the only advert I can see like this, all the others have yellow as data. I'm reluctant to even believe it - thinking it a mistake - but it would explain everything!

    I shall test tonight - if you hear me laughing maniacally you'll know green was data.

  • Argh. Wow... Those will be the first I've seen like that, but please let us know how you get on and I'll update the documentation!

  • What does a maniacal laugh sound like! Green IS data. Incredible.

    Thanks again for help @Gordon and @DrAzzy :)

  • Thanks! I've updated the documentation with a warning about the 2 different types (it'll go live when I next update the site).

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

DS18B20 Issues - all I get is 'null'

Posted by Avatar for Ollie @Ollie