• Hello all,
    I'm continuing my trip in the Espruino world and I'm experiencing a problem with the DS18B20 temperature sensor and my ST NUCLEO-F401RE board on which I uploaded the latest version of Espruino (1v93).
    Using the first example shown on the DS18B20 sensor page (http://www.espruino.com/DS18B20) precisely:

    var ow = new OneWire(A0);
    var sensor = require("DS18B20").connect(ow);
    setInterval(function() {
      sensor.getTemp(function (temp) {
        console.log("Temp is "+temp+"°C"); 
      });
    }, 1000);
    
    

    I get the following result (instead of temperature value):

    _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v93 Copyright 2016 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    >
    =undefined
    Temp is null°C
    Temp is null°C
    Temp is null°C
    Temp is null°C
    
    

    The DS18B20 "cabled sensor" type is that identified on the Espruino web page as "Sensor type 1" connected as follows:

    Black wire -> GND
    Red wire -> 3.3V
    Yellow wire -> Data pin (A0)

    I'm also using the 4.7k resistor between data and the 3.3v line as suggested.

    Browsing in the forum before posting the question I noticed the following post:
    http://forum.espruino.com/conversations/­254655/#comment11813806

    in which Gordon suggested to skip the DS18B20 module and search for the sensor through the OneWire protocol.
    In the same configuration (board+sensor), described above, I get the following result:

    >var ow = new OneWire(A0);
    =OneWire { "pin": A0 }
    >ow.search(); // should return an array of devices
    =[
      "28ff050b85160520"
     ]
    > 
    

    It seems to recognize the serial number of the DS18B20 device...

    Could you please help me to solve this issue?
    Thanks in advance for your support.
    Kind regards

About

Avatar for Blizzard @Blizzard started