Introduction: 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

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

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

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

author
SemiWelt (author)2017-08-10

Hero, this is exactly what i needed.

author
NicolasJ7 (author)SemiWelt2017-08-12

Thanks for the comment!

author
cher_djamel (author)2017-03-28

Great project! Thanks for sharing!