Raspberry + 1-wire temperature sensors DS18B20

I found a nice JS library w1temp library which could be used in JS scripts on raspberry pi. So there is no need for bash, perl or other scripts and parsing data from outputs.

My simple code for read 1 sensor:

var blynkLib = require('blynk-library');
var W1Temp = require('w1temp');
var AUTH = 'HERE_COMES_YOUR_TOKEN'; 

// Setup Blynk (SSL)
var blynk = new blynkLib.Blynk(AUTH); 

// Automatically update sensors value every 5 minutes
setInterval(function() {
W1Temp.getSensor('28-0000045c34f2').then(function (sensor) {
	// print actual temperature 
	var temp = sensor.getTemperature();
	console.log('Actual temp:', temp, 'Ā°C');
            //Report it to server
	blynk.virtualWrite(0, temp);
   }); 	
}, 50000);

THX to kolarcz

3 Likes

Hi, I know this is an old topic but iā€™m trying to link my DS18B20 to my Blynk App.

I have used these instuctions and i have the values showing int he python script.

ā€œhttps://www.element14.com/community/community/stem-academy/blog/2014/12/13/raspberry-pi--ds18b20-temperature-sensorā€

Iā€™m just wondering how do i install your code which you have wrote so i can use it within blynk?

Thanks
George

Please try to read this topic where are a lot of information. For run this code You need to install NODE.