Introduction: Arduino& Labview With 2 DS18B20

Picture of Arduino& Labview With 2 DS18B20

Hi! This instructable is for those who want to make an interface with PC and arduino. I chose the popular DS18B20, because there is no clear information about how to do it, more questions than solutions and some VI´s without explanation. I will assume that you are familiar with labview enviroment at basic level.If not, there is a lot of info about this software and how to begin (even a free trial, i think).

http://www.ni.com/labview/why/

Labview also has a tool for arduino :LINX, but do not has support for this sensors.

We will use 2 DS18B20 ,that will give you an idea of how to connect more sensors or send data from your Arduino. This is not the "ultimate" code,so you can modify according to your needs.

You need to watch the video to know how to make the Labview interface. Also, I included the VI ready and the Arduino code.

Step 1: MATERIALS

Picture of MATERIALS

Software

LabVIEW with VISA (2013)

Arduino IDE (1.6.9)

Hardware

Arduino UNO

2 DS18B20

4.7 K resistor

Breadboard, wires

Step 2: Arduino Side

Picture of Arduino Side

This is the easiest part. We will read the temperature and send a "string" with a header that will be "filtered" on the labview side.

I am using the inox version of DS18B20 and normal power mode with 4.7 K resistor. Data connected to pin 2.

Red =+5V

Black =Gnd

Blue= Data

-Make sure you have the libraries needed (below).

#include

#include

-Arduino pin for data (2)

#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.

DallasTemperature sensors(&oneWire);

-Setting serial communication at 9600 (baud rate)

void setup(void) {

Serial.begin(9600);

// Start up the library

sensors.begin();

}

void loop(void) {

-Reading temperatures

sensors.requestTemperatures(); // Send the command to get temperatures

Getting and converting the values to DEC.

If you want °F : sensors.getTempFByIndex()

String sensor1 = String(sensors.getTempCByIndex(0),DEC);

String sensor2 = String(sensors.getTempCByIndex(1),DEC);

We make strings with the headers"A" and "B"

String temp1 = String("A" + sensor1);

String temp2 = String("B" + sensor2);

Print over serial port

Serial.println(temp1);

Serial.println(temp2);

}

Upload the code to Arduino board. Once you have the code running, grab one sensor to raise the temp and identify sensor "A" and "B".

Step 3: Labview Side

Picture of Labview Side

For this step you need to watch the video. I tried to make a step by step guide to be clear and show the operation by stages. Anyway, i will upload the VI ready.

The COM port it is the same that on your Arduino IDE.

As you can see, We send two data strings concatenated with an"A" and "B". When enter to the while loop ,there is a delay to control the sample readings. After the read function. the strings goes to the Match pattern, to "filter" each data string. Then, converted to numbers (double) and connected to the thermometers.

You can add more functions like graphics, waves ,etc.

Comments

Halitt1 made it! (author)2017-10-18

hi can you help me about this problem?

NicolasJ7 (author)Halitt12017-10-18

Working here....do you have all the libraries needed?

Halitt1 (author)NicolasJ72017-10-19

yes I have

NicolasJ7 (author)Halitt12017-10-30

Sorry, is your IDE 1.0.5?

henryb89 made it! (author)2017-10-26

. Hola, ejecuto el programa Labview y me arroja un error de 0.000E + 0, no me permite visualizar el nivel en los gráficos del termómetro. Hice las conexiones en el Arduino (tengo Mega2560), el sensor está conectado en el puerto 2 de Arduino, el boceto me funciona bien, (por ahora solo tengo un sensor) ¿me pueden ayudar, por favor?

NicolasJ7 (author)henryb892017-10-30

Hola! , nunca he tenido ese error. Modificaste el sketch? veo que dice "grados celcius" y el VI debe recibir una "A" o una "B" primero, También cierra el monitor del IDE cuando ejecutes Labview

RoronoaZ7 made it! (author)2017-09-13

Sorry, I don't get this part. Can you explain me more? Do you mean compile all in IDE or what?

NicolasJ7 (author)RoronoaZ72017-09-13

The code for the arduino is ds_18b20_serial.... , The others are the libraries needed for the sensor(DallasTemp and OneWire). Once you have uploaded the code, open the serial monitor and check the temperatures.

approxime (author)2017-09-10

Nicolas, thank you very much! Great project, all works perfectly!

NicolasJ7 (author)approxime2017-09-12

Thanks!, I'm glad to help you!

SemiWelt (author)2017-08-10

Hero, this is exactly what i needed.

NicolasJ7 (author)SemiWelt2017-08-12

Thanks for the comment!

cher_djamel (author)2017-03-28

Great project! Thanks for sharing!

About This Instructable

6,515views

56favorites

License:

More by NicolasJ7:Arduino LCD 16x2. Turn Single Screen Into Multiple Screens.Arduino& Labview With 2 DS18B20 Arduino/Android Timer (with App!).Control Your Lights and Other Stuff
Add instructable to: