Add a ds18b20

Hello community

i’m looking how i can add ds18b20 to a raspberry as client. I see a don’t need make script with LED or relay, so it’s same for DS18B20 ?

Thanks

No, it’s not.

You will need to change the client sketch to read the DS18B20 using a timer, then send the results to the Blynk server.

I’ve previously linked you to some NodeJS coding examples. The last of these examples shows how to read temperature and humidity using a DHT sensor and send the results to Blynk.
Your code structure would be basically the same, but using a different library and function calls to read your sensor.

Pete.

Ok for do this can you show me how i have to combine this both sketch together ?

 const Blynk = require('blynk-library');  // Links variable 'Blynk' to the Blynk Library
const AUTH = 'xxxxxxxxxx';  // Your top secret auth code
const blynk = new Blynk.Blynk(AUTH, options = {
	 connector : new Blynk.TcpClient( options = { addr: "xxx.xxx.xxx.xxx", port: 8080 } )  // This takes all the info and directs the connection to you Local Server.
	 });

and this

var Blynk = require('blynk-library');

var AUTH = 'YourAuthToken';

var blynk = new Blynk.Blynk(AUTH);

var v1 = new blynk.VirtualPin(1);
var v9 = new blynk.VirtualPin(9);

v1.on('write', function(param) {
  console.log('V1:', param[0]);
});

v9.on('read', function() {
  v9.write(new Date().getSeconds());
});

I mean you talking about this both sketch

How does this relate to adding a DS18B20 you your Pi client?

Pete.

 const Blynk = require('blynk-library');  // Links variable 'Blynk' to the Blynk Library
const AUTH = 'xxxxxxxxxx';  // Your top secret auth code
const blynk = new Blynk.Blynk(AUTH, options = {
	 connector : new Blynk.TcpClient( options = { addr: "xxx.xxx.xxx.xxx", port: 8080 } )  // This takes all the info and directs the connection to you Local Server.
	 });

This is for connecting to my local server

var Blynk = require('blynk-library');

var AUTH = 'YourAuthToken';

var blynk = new Blynk.Blynk(AUTH);

var v1 = new blynk.VirtualPin(1);
var v9 = new blynk.VirtualPin(9);

v1.on('write', function(param) {
  console.log('V1:', param[0]);
});

v9.on('read', function() {
  v9.write(new Date().getSeconds());
});

And this is random code.

I think i’ve to mix them for :

1 conenct to my local server
2 run sketch

So have you managed to get your client to connect to your local server yet?

Pete.

Yep just create sketch index.js with this code :

const Blynk = require('blynk-library');  // Links variable 'Blynk' to the Blynk Library
const AUTH = 'xxxxxxxxxx';  // Your top secret auth code
const blynk = new Blynk.Blynk(AUTH, options = {
	 connector : new Blynk.TcpClient( options = { addr: "xxx.xxx.xxx.xxx", port: 8080 } )  // This takes all the info and directs the connection to you Local Server.
	 });

And run it.

That why for DS18B20 i have to put sketch in index.js after it.But is conflict with AUTH and token. I want to know how i can mix both

So what does this code…

have to do with adding a DS18B20 sensor to your client?

Pete.

it’s from here : http://help.blynk.cc/en/articles/583104-how-to-install-node-js-library-on-linux

In create new project

Yes, we’ve been through all of this before. That is for using the cloud servers, you are using a local server.
But, the Instructions are nothing at all to do with using a DS18B20 sensor, so why try to incorporate this into your local server code?

Did you actually look at the NodeJS example for DHT sensor?

Pete.

Ok, for test this i need to find DS18B20 library right ?

Where i install library ?

To folder project : ~/blynkp/node_modules

or to this folder : /opt/nodejs/lib/node_modules ( create with manual installation of node by this way http://help.blynk.cc/en/articles/583104-how-to-install-node-js-library-on-linux )

I have to understand how it work globally, thats best way for don’t ask all time;…

I have no idea, I don’t use NodeJS.
However, if you find a NodeJS library for the DS18B20 then it may give you installation instructions and some code examples that you can use within your Blynk code.

Pete.

So i ask this on the forum. I wait for it ton continue

Thanks

Hi community !

I just started with blynk.

I am on a raspberry which is server and client

I would have liked to know where I should place the libraries for my projects. Like for example the library for DS18B50

Do I have to put them with the blynk library? in opt / nodejs / lib / nodes_modules / blynk-library ?

Or in the library of my specific project?

Thanks !

Please stop creating new topics about the same subject.
If you continue to do this your account will be suspended.

Pete.

is not same subject… That why i make new post

So is not important for the moment.

For add DS18B20 i’ve fisrt to understand how work virtual pin. I understand it read only, and is not physical.

But how V1 receive information ? I’ve to say, V1 information come from GPIO18 no ? I’m looking for more easy : blink LED widget on blynk application

I don’t really understand your question, and I don’t use NodeJS, but it’s pretty clear from your earlier example that when a widget that is attached to a virtual pin and the value of that widget changes, the result is obtained by your client device using this type of process…

And if your client wants to update a widget attached to a virtual pin then it uses this type of process…

I’m sure there are many other NodeJS virtual pin examples on the Blynk GitHub site and in the code samples from @Gunner that you could use to learn more.

Pete.

@PeteKnight can i open new post for ask about virtual PIN work with NodeJS ?