Beer thermometer with raspberry pi and ds18b20

You can edit this line out for now as it’s just confusing things until you have sorted out the pins.

console.log('using BCM GPIO 7, physical pin 26 on a Model B Pi');

Try the same sensor, with onboard resistor, in BCM 7 (physical pin 26) and change this

W1Temp.setGpioData(24);

to

W1Temp.setGpioData(7);

I am using the same sensors with onboard resistors in BCM 7.

Nope, same output

pi@raspberrypi:/usr/local/lib/node_modules/blynk-library $ sudo node TestTemp 
DS18B20 address is: 00-800000000000
(node:847) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cant get sensor instance
pi@raspberrypi:/usr/local/lib/node_modules/blynk-library $ sudo node TestTemp 
DS18B20 address is: 00-400000000000,00-c00000000000
(node:896) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cant get sensor instance

Weird, the ids also change and even duplicate…

Standard practise when it can’t find the sensor.

Have you installed wiringPi?

Just installed

And …?

This is my current pin configuration:

 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |  OUT | 1 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |  OUT | 1 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | OUT  | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | OUT  | CE1     | 11  | 7   |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+

About the output, exactly the same, do I have to edit my code?

Very much like mine but you will notice my BCM 7 is shown as IN not OUT. What BCM are you connected to now?

 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 |  OUT | 0 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |  OUT | 0 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |  OUT | 0 | 11 || 12 | 0 | OUT  | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |  OUT | 0 | 15 || 16 | 1 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+

Since you told me, the data cable is set on BCM 7

Any ideas then?

@raul try the following and see if it gives any more debug info:

sudo node TestTemp --trace-warnings

You could try the sensor code without Blynk, change the path and ID, name it w1.js and run as:

sudo node w1.js --trace-warnings

var W1Temp = require('/opt/nodejs/bin/node_modules/w1temp');

W1Temp.setGpioData(7);

W1Temp.getSensorsUids().then(function (sensorsUids) {
  console.log(sensorsUids);
});

W1Temp.getSensor('28-0004412479ff').then(function (sensor) {
  var temp = sensor.getTemperature();
  console.log('Actual temp:', temp,'°C' );   //'°C' ALT 0176 or 248
  sensor.on('change', function (temp) {
    console.log('Temp changed:', temp,'°C');
  });
});

@Costas Throws the same exception in terminal, I also deleted the blynk part in one of my tests, currently only trying to instance the darn sensor…
Thanks again for the help!!

@raul I was able to obtain a broadly similar error message to yours with the following syntax (no sudo) for w1.js

pi@raspberrypi:~ $ NODE_DEBUG=fs node w1 <token>
[ '28-0004412479ff' ]
Actual temp: 20.75 °C
(node:2888) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Could not set data gpio pin
Temp changed: 20.75 °C
Temp changed: 20.812 °C
Temp changed: 20.875 °C

However as you will see, my system carries on regardless and provided the ID and temperature readings.

You might also want to try the following, which will provide details of the modules being loaded. If you paste your results I can compare them with mine.

sudo NODE_DEBUG=fs,module node w1 750103df5d0e4de2b6b45af696f5db18

You could also try editing out this line as mine works without it and doesn’t require sudo.

W1Temp.setGpioData(7);

Finally, when you configured your Pi for Blynk did you install the modules with or without sudo?

1 Like

This is the output after editing out the setGpioData

pi@raspberrypi:/usr/local/lib/node_modules/blynk-library $ sudo NODE_DEBUG=fs,module node w1 <token>
MODULE 1320: looking for "/usr/local/lib/node_modules/blynk-library/w1" in ["/root/.node_modules","/root/.node_libraries","/usr/local/lib/node"]
MODULE 1320: load "/usr/local/lib/node_modules/blynk-library/w1" for module "."
MODULE 1320: Module._load REQUEST /usr/local/lib/node_modules/w1temp parent: .
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp" in ["/usr/local/lib/node_modules/blynk-library/node_modules","/usr/local/lib/node_modules","/usr/local/node_modules","/usr/node_modules","/node_modules","/root/.node_modules","/root/.node_libraries","/usr/local/lib/node"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/index.js" for module "/usr/local/lib/node_modules/w1temp/dist/index.js"
MODULE 1320: Module._load REQUEST ./lib/setGpioPower parent: /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: RELATIVE: requested: ./lib/setGpioPower set ID to: /usr/local/lib/node_modules/w1temp/dist/index.js/lib/setGpioPower from /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/index.js/lib/setGpioPower" in ["/usr/local/lib/node_modules/w1temp/dist"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/lib/setGpioPower.js" for module "/usr/local/lib/node_modules/w1temp/dist/lib/setGpioPower.js"
MODULE 1320: Module._load REQUEST gpio parent: /usr/local/lib/node_modules/w1temp/dist/lib/setGpioPower.js
MODULE 1320: looking for "gpio" in ["/usr/local/lib/node_modules/w1temp/dist/lib/node_modules","/usr/local/lib/node_modules/w1temp/dist/node_modules","/usr/local/lib/node_modules/w1temp/node_modules","/usr/local/lib/node_modules","/usr/local/node_modules","/usr/node_modules","/node_modules","/root/.node_modules","/root/.node_libraries","/usr/local/lib/node"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/node_modules/gpio/lib/gpio.js" for module "/usr/local/lib/node_modules/w1temp/node_modules/gpio/lib/gpio.js"
MODULE 1320: Module._load REQUEST fs parent: /usr/local/lib/node_modules/w1temp/node_modules/gpio/lib/gpio.js
MODULE 1320: load native module fs
MODULE 1320: Module._load REQUEST util parent: /usr/local/lib/node_modules/w1temp/node_modules/gpio/lib/gpio.js
MODULE 1320: load native module util
MODULE 1320: Module._load REQUEST path parent: /usr/local/lib/node_modules/w1temp/node_modules/gpio/lib/gpio.js
MODULE 1320: load native module path
MODULE 1320: Module._load REQUEST events parent: /usr/local/lib/node_modules/w1temp/node_modules/gpio/lib/gpio.js
MODULE 1320: load native module events
MODULE 1320: Module._load REQUEST ./lib/setGpioData parent: /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: RELATIVE: requested: ./lib/setGpioData set ID to: /usr/local/lib/node_modules/w1temp/dist/index.js/lib/setGpioData from /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/index.js/lib/setGpioData" in ["/usr/local/lib/node_modules/w1temp/dist"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/lib/setGpioData.js" for module "/usr/local/lib/node_modules/w1temp/dist/lib/setGpioData.js"
MODULE 1320: Module._load REQUEST child_process parent: /usr/local/lib/node_modules/w1temp/dist/lib/setGpioData.js
MODULE 1320: load native module child_process
MODULE 1320: Module._load REQUEST ./lib/getSensorsUids parent: /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: RELATIVE: requested: ./lib/getSensorsUids set ID to: /usr/local/lib/node_modules/w1temp/dist/index.js/lib/getSensorsUids from /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/index.js/lib/getSensorsUids" in ["/usr/local/lib/node_modules/w1temp/dist"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/lib/getSensorsUids.js" for module "/usr/local/lib/node_modules/w1temp/dist/lib/getSensorsUids.js"
MODULE 1320: Module._load REQUEST fs parent: /usr/local/lib/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 1320: load native module fs
MODULE 1320: Module._load REQUEST ./fileExistsWait parent: /usr/local/lib/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 1320: RELATIVE: requested: ./fileExistsWait set ID to: /usr/local/lib/node_modules/w1temp/dist/lib/fileExistsWait from /usr/local/lib/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/lib/fileExistsWait" in ["/usr/local/lib/node_modules/w1temp/dist/lib"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/lib/fileExistsWait.js" for module "/usr/local/lib/node_modules/w1temp/dist/lib/fileExistsWait.js"
MODULE 1320: Module._load REQUEST fs parent: /usr/local/lib/node_modules/w1temp/dist/lib/fileExistsWait.js
MODULE 1320: load native module fs
MODULE 1320: Module._load REQUEST ./constants parent: /usr/local/lib/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 1320: RELATIVE: requested: ./constants set ID to: /usr/local/lib/node_modules/w1temp/dist/lib/constants from /usr/local/lib/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/lib/constants" in ["/usr/local/lib/node_modules/w1temp/dist/lib"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/lib/constants.js" for module "/usr/local/lib/node_modules/w1temp/dist/lib/constants.js"
MODULE 1320: Module._load REQUEST ./lib/getSensor parent: /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: RELATIVE: requested: ./lib/getSensor set ID to: /usr/local/lib/node_modules/w1temp/dist/index.js/lib/getSensor from /usr/local/lib/node_modules/w1temp/dist/index.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/index.js/lib/getSensor" in ["/usr/local/lib/node_modules/w1temp/dist"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js" for module "/usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js"
MODULE 1320: Module._load REQUEST ./fileExistsWait parent: /usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js
MODULE 1320: RELATIVE: requested: ./fileExistsWait set ID to: /usr/local/lib/node_modules/w1temp/dist/lib/fileExistsWait from /usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/lib/fileExistsWait" in ["/usr/local/lib/node_modules/w1temp/dist/lib"]
MODULE 1320: Module._load REQUEST ./Sensor parent: /usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js
MODULE 1320: RELATIVE: requested: ./Sensor set ID to: /usr/local/lib/node_modules/w1temp/dist/lib/Sensor from /usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/lib/Sensor" in ["/usr/local/lib/node_modules/w1temp/dist/lib"]
MODULE 1320: load "/usr/local/lib/node_modules/w1temp/dist/lib/Sensor.js" for module "/usr/local/lib/node_modules/w1temp/dist/lib/Sensor.js"
MODULE 1320: Module._load REQUEST fs parent: /usr/local/lib/node_modules/w1temp/dist/lib/Sensor.js
MODULE 1320: load native module fs
MODULE 1320: Module._load REQUEST events parent: /usr/local/lib/node_modules/w1temp/dist/lib/Sensor.js
MODULE 1320: load native module events
MODULE 1320: Module._load REQUEST ./constants parent: /usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js
MODULE 1320: RELATIVE: requested: ./constants set ID to: /usr/local/lib/node_modules/w1temp/dist/lib/constants from /usr/local/lib/node_modules/w1temp/dist/lib/getSensor.js
MODULE 1320: looking for "/usr/local/lib/node_modules/w1temp/dist/lib/constants" in ["/usr/local/lib/node_modules/w1temp/dist/lib"]
[ '00-746000000000', '00-f46000000000' ]
(node:1320) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cant get sensor instance

Can´t remember if I did it with sudo, I think i used it, since without it an error showing that the installation had no access to certain paths of the system was displayed.

Cheers!

Like you I found sudo was generally required.

Take a look at my data and see if you spot anything:

pi@raspberrypi:~ $ sudo NODE_DEBUG=fs,module node w1 <token>
MODULE 3161: looking for "/home/pi/w1" in ["/root/.node_modules","/root/.node_libraries","/opt/nodejs/lib/node"]
MODULE 3161: load "/home/pi/w1.js" for module "."
MODULE 3161: Module._load REQUEST /opt/nodejs/bin/node_modules/w1temp parent: .
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp" in ["/home/pi/node_modules","/home/node_modules","/node_modules","/root/.node_modules","/root/.node_libraries","/opt/nodejs/lib/node"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/index.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/index.js"
MODULE 3161: Module._load REQUEST ./lib/setGpioPower parent: /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: RELATIVE: requested: ./lib/setGpioPower set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/setGpioPower from /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/setGpioPower" in ["/opt/nodejs/bin/node_modules/w1temp/dist"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/lib/setGpioPower.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/lib/setGpioPower.js"
MODULE 3161: Module._load REQUEST gpio parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/setGpioPower.js
MODULE 3161: looking for "gpio" in ["/opt/nodejs/bin/node_modules/w1temp/dist/lib/node_modules","/opt/nodejs/bin/node_modules/w1temp/dist/node_modules","/opt/nodejs/bin/node_modules/w1temp/node_modules","/opt/nodejs/bin/node_modules","/opt/nodejs/node_modules","/opt/node_modules","/node_modules","/root/.node_modules","/root/.node_libraries","/opt/nodejs/lib/node"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/gpio/lib/gpio.js" for module "/opt/nodejs/bin/node_modules/gpio/lib/gpio.js"
MODULE 3161: Module._load REQUEST fs parent: /opt/nodejs/bin/node_modules/gpio/lib/gpio.js
MODULE 3161: load native module fs
MODULE 3161: Module._load REQUEST util parent: /opt/nodejs/bin/node_modules/gpio/lib/gpio.js
MODULE 3161: load native module util
MODULE 3161: Module._load REQUEST path parent: /opt/nodejs/bin/node_modules/gpio/lib/gpio.js
MODULE 3161: load native module path
MODULE 3161: Module._load REQUEST events parent: /opt/nodejs/bin/node_modules/gpio/lib/gpio.js
MODULE 3161: load native module events
MODULE 3161: Module._load REQUEST ./lib/setGpioData parent: /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: RELATIVE: requested: ./lib/setGpioData set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/setGpioData from /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/setGpioData" in ["/opt/nodejs/bin/node_modules/w1temp/dist"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/lib/setGpioData.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/lib/setGpioData.js"
MODULE 3161: Module._load REQUEST child_process parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/setGpioData.js
MODULE 3161: load native module child_process
MODULE 3161: Module._load REQUEST ./lib/getSensorsUids parent: /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: RELATIVE: requested: ./lib/getSensorsUids set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/getSensorsUids from /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/getSensorsUids" in ["/opt/nodejs/bin/node_modules/w1temp/dist"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensorsUids.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensorsUids.js"
MODULE 3161: Module._load REQUEST fs parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 3161: load native module fs
MODULE 3161: Module._load REQUEST ./fileExistsWait parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 3161: RELATIVE: requested: ./fileExistsWait set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/lib/fileExistsWait from /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/lib/fileExistsWait" in ["/opt/nodejs/bin/node_modules/w1temp/dist/lib"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/lib/fileExistsWait.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/lib/fileExistsWait.js"
MODULE 3161: Module._load REQUEST fs parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/fileExistsWait.js
MODULE 3161: load native module fs
MODULE 3161: Module._load REQUEST ./constants parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 3161: RELATIVE: requested: ./constants set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/lib/constants from /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensorsUids.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/lib/constants" in ["/opt/nodejs/bin/node_modules/w1temp/dist/lib"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/lib/constants.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/lib/constants.js"
MODULE 3161: Module._load REQUEST ./lib/getSensor parent: /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: RELATIVE: requested: ./lib/getSensor set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/getSensor from /opt/nodejs/bin/node_modules/w1temp/dist/index.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/index.js/lib/getSensor" in ["/opt/nodejs/bin/node_modules/w1temp/dist"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js"
MODULE 3161: Module._load REQUEST ./fileExistsWait parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js
MODULE 3161: RELATIVE: requested: ./fileExistsWait set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/lib/fileExistsWait from /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/lib/fileExistsWait" in ["/opt/nodejs/bin/node_modules/w1temp/dist/lib"]
MODULE 3161: Module._load REQUEST ./Sensor parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js
MODULE 3161: RELATIVE: requested: ./Sensor set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/lib/Sensor from /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/lib/Sensor" in ["/opt/nodejs/bin/node_modules/w1temp/dist/lib"]
MODULE 3161: load "/opt/nodejs/bin/node_modules/w1temp/dist/lib/Sensor.js" for module "/opt/nodejs/bin/node_modules/w1temp/dist/lib/Sensor.js"
MODULE 3161: Module._load REQUEST fs parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/Sensor.js
MODULE 3161: load native module fs
MODULE 3161: Module._load REQUEST events parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/Sensor.js
MODULE 3161: load native module events
MODULE 3161: Module._load REQUEST ./constants parent: /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js
MODULE 3161: RELATIVE: requested: ./constants set ID to: /opt/nodejs/bin/node_modules/w1temp/dist/lib/constants from /opt/nodejs/bin/node_modules/w1temp/dist/lib/getSensor.js
MODULE 3161: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/lib/constants" in ["/opt/nodejs/bin/node_modules/w1temp/dist/lib"]
[ '28-0004412479ff' ]
Actual temp: 21.437 °C
Temp changed: 21.437 °C

@raul after much trial and error I can get exactly the same error message as you:

MODULE 3586: looking for "/opt/nodejs/bin/node_modules/w1temp/dist/lib/constants" in ["/opt/nodejs/bin/node_modules/w1temp/dist/lib"]
[ '00-200000000000' ]
(node:3586) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cant get sensor instance

dmesg is quite useful with these sensors, call the command after each failed attempt and you should see something like this:

[50718.941986] w1_master_driver w1_bus_master1: Family 0 for 00.800000000000.8c is not registered.
[50780.753439] w1_master_driver w1_bus_master1: Family 0 for 00.400000000000.46 is not registered.
[50828.393643] w1_master_driver w1_bus_master1: Family 0 for 00.c00000000000.ca is not registered.

Having worked so hard to duplicate your error message it has messed up my system a little. All still working but now the search ID has one correct entry and a rogue ghost entry:
[ '00-100000000000', '28-0004412479ff' ]

OK so how did I get your error message. I simply pulled out the sensor from the breadboard. Strangely at first it still made reference to the correct ID and a temperature of 0 degrees. After a few more attempts the ghost ID’s appeared and finally “Can’t get sensor instance”.

I have a version 2 script for you to try, called w1v2.js, just a couple of lines:

var W1Temp = require('/opt/nodejs/bin/node_modules/w1temp');

W1Temp.getSensorsUids().then(function (sensorsUids) {
  console.log(sensorsUids);
});

As you know this just looks for the ID. You need to check and double check the sensor circuit. I mainly use the plug and play sensors but you should try with both versions. I am a little surprised that the system works at all without any pin definitions but I have a clue.

I don’t currently have any entries in the config.txt file on the SD card and no modprobe in crontab or elsewhere. But maybe when I first set it all up I did have the SD card entry (GPIO / BCM 7) and when I did the one off modprobe the pin is permanently registered unless you remove it from the OS.

So that’s certainly worth a try as per the docs, but ensure you use 7 if the sensor is wired up to 7.

Wow man, awesome work! I will check this as soon as I eat something, will replay with conclusions ASAP.
I really appreciate your help, you are being amazingly helpful and supportive.
Thanks!!!

Who needs food and sleep when there’s work to be done? :slight_smile:

Only humans…:wink: Nothing to do with you Costas…

5 Likes

Might have found something wit dmesg

[    7.114946] Driver for 1-wire Dallas network protocol.
[    7.180537] w1-gpio onewire@0: gpio pin 4, external pullup pin -1, parasitic power 0
[    7.180601] w1_add_master_device: set_pullup requires write_byte or touch_bit, disabling

at the end this appears

[   59.339371] w1_master_driver w1_bus_master1: Family 0 for 00.800000000000.8c is not registered.
[  118.956403] w1_master_driver w1_bus_master1: Family 0 for 00.400000000000.46 is not registered.
[  166.697502] w1_master_driver w1_bus_master1: Family 0 for 00.c00000000000.ca is not registered.
[  237.990070] w1_master_driver w1_bus_master1: Family 0 for 00.200000000000.23 is not registered.
[  297.331802] w1_master_driver w1_bus_master1: Family 0 for 00.a00000000000.af is not registered.
[  332.744244] w1_master_driver w1_bus_master1: Family 0 for 00.600000000000.65 is not registered.
[  370.083917] w1_master_driver w1_bus_master1: Family 0 for 00.e00000000000.e9 is not registered.
[  428.945608] w1_master_driver w1_bus_master1: Family 0 for 00.100000000000.9d is not registered.
[  465.257615] w1_master_driver w1_bus_master1: Family 0 for 00.900000000000.11 is not registered.
[  535.618923] w1_master_driver w1_bus_master1: Family 0 for 00.500000000000.db is not registered.
[  583.880575] w1_master_driver w1_bus_master1: Family 0 for 00.d00000000000.57 is not registered.
[  608.361038] w1_master_driver w1_bus_master1: Family 0 for 00.300000000000.be is not registered.
[  654.703589] w1_master_driver w1_bus_master1: Family 0 for 00.b00000000000.32 is not registered.
[  691.133758] w1_master_driver w1_bus_master1: Family 0 for 00.700000000000.f8 is not registered.
[  739.404933] w1_master_driver w1_bus_master1: Family 0 for 00.f00000000000.74 is not registered.
[  797.878119] w1_master_driver w1_bus_master1: Family 0 for 00.080000000000.c2 is not registered.
[  847.098407] w1_master_driver w1_bus_master1: Family 0 for 00.880000000000.4e is not registered.
[  882.449605] w1_master_driver w1_bus_master1: Family 0 for 00.480000000000.84 is not registered.
[  929.751004] w1_master_driver w1_bus_master1: Family 0 for 00.c80000000000.08 is not registered.
[ 1001.192726] w1_master_driver w1_bus_master1: Family 0 for 00.280000000000.e1 is not registered.
[ 1060.444223] w1_master_driver w1_bus_master1: Family 0 for 00.a80000000000.6d is not registered.
[ 1119.697256] w1_master_driver w1_bus_master1: Family 0 for 00.680000000000.a7 is not registered.
[ 1156.966841] w1_master_driver w1_bus_master1: Family 0 for 00.e80000000000.2b is not registered.
[ 1215.948267] w1_master_driver w1_bus_master1: Family 0 for 00.180000000000.5f is not registered.
[ 1252.318785] w1_master_driver w1_bus_master1: Family 0 for 00.980000000000.d3 is not registered.
[ 1298.601538] w1_master_driver w1_bus_master1: Family 0 for 00.580000000000.19 is not registered.
[ 1346.930554] w1_master_driver w1_bus_master1: Family 0 for 00.d80000000000.95 is not registered.
[ 1371.470737] w1_master_driver w1_bus_master1: Family 0 for 00.380000000000.7c is not registered.
[ 1417.872318] w1_master_driver w1_bus_master1: Family 0 for 00.b80000000000.f0 is not registered.
[ 1478.021901] w1_master_driver w1_bus_master1: Family 0 for 00.780000000000.3a is not registered.
[ 1526.342894] w1_master_driver w1_bus_master1: Family 0 for 00.f80000000000.b6 is not registered.
[ 1584.933597] w1_master_driver w1_bus_master1: Family 0 for 00.040000000000.61 is not registered.
[ 1634.214661] w1_master_driver w1_bus_master1: Family 0 for 00.840000000000.ed is not registered.
[ 1693.406111] w1_master_driver w1_bus_master1: Family 0 for 00.440000000000.27 is not registered.
[ 1740.767056] w1_master_driver w1_bus_master1: Family 0 for 00.c40000000000.ab is not registered.
[ 1764.108157] w1_master_driver w1_bus_master1: Family 0 for 00.240000000000.42 is not registered.
[ 1823.419051] w1_master_driver w1_bus_master1: Family 0 for 00.a40000000000.ce is not registered.
[ 1848.679541] w1_master_driver w1_bus_master1: Family 0 for 00.640000000000.04 is not registered.
[ 1896.041099] w1_master_driver w1_bus_master1: Family 0 for 00.e40000000000.88 is not registered.
[ 1955.261941] w1_master_driver w1_bus_master1: Family 0 for 00.140000000000.fc is not registered.
[ 1991.573103] w1_master_driver w1_bus_master1: Family 0 for 00.940000000000.70 is not registered.
[ 2061.814526] w1_master_driver w1_bus_master1: Family 0 for 00.540000000000.ba is not registered.
[ 2110.074921] w1_master_driver w1_bus_master1: Family 0 for 00.d40000000000.36 is not registered.
[ 2182.236275] w1_master_driver w1_bus_master1: Family 0 for 00.340000000000.df is not registered.
[ 2228.577903] w1_master_driver w1_bus_master1: Family 0 for 00.b40000000000.53 is not registered.
[ 2264.887544] w1_master_driver w1_bus_master1: Family 0 for 00.740000000000.99 is not registered.
[ 2313.148434] w1_master_driver w1_bus_master1: Family 0 for 00.f40000000000.15 is not registered.
[ 2371.859774] w1_master_driver w1_bus_master1: Family 0 for 00.0c0000000000.a3 is not registered.
[ 2421.080550] w1_master_driver w1_bus_master1: Family 0 for 00.8c0000000000.2f is not registered.
[ 2456.553704] w1_master_driver w1_bus_master1: Family 0 for 00.4c0000000000.e5 is not registered.
[ 2503.853370] w1_master_driver w1_bus_master1: Family 0 for 00.cc0000000000.69 is not registered.
[ 2527.133863] w1_master_driver w1_bus_master1: Family 0 for 00.2c0000000000.80 is not registered.
[ 2586.386652] w1_master_driver w1_bus_master1: Family 0 for 00.ac0000000000.0c is not registered.
[ 2635.727886] w1_master_driver w1_bus_master1: Family 0 for 00.6c0000000000.c6 is not registered.
[ 2683.029767] w1_master_driver w1_bus_master1: Family 0 for 00.ec0000000000.4a is not registered.
[ 2742.142123] w1_master_driver w1_bus_master1: Family 0 for 00.1c0000000000.3e is not registered.
[ 2778.523507] w1_master_driver w1_bus_master1: Family 0 for 00.9c0000000000.b2 is not registered.
[ 2824.925194] w1_master_driver w1_bus_master1: Family 0 for 00.5c0000000000.78 is not 

I changed my sensor to gpio 4, but the same error in dmsg appears…

The numbers are BCM numbers not “GPIO” numbers. Which physical pin are you using? Should be “pin 7” for BCM 4 i.e. 3 below the main 3.3V pin.

I have the following for BCM 7 in dmesg:

     [   68.070978] Driver for 1-wire Dallas network protocol.
     [   68.741830] w1-gpio onewire@0: gpio pin 7, external pullup pin -1, parasitic power 0
     [   68.741903] w1_add_master_device: set_pullup requires write_byte or touch_bit, disabling