Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

One-wire temperature sensor + relay control using Arduino

Hello, everyone!

I'm a beginner in LabVIEW and need help with my automation project.

I need to manually control a relay, read two temperatures (using DS18B20, one-wire protocol) and a water flow meter. All of that using an Arduino UNO.

By combining information I found online, I managed to either read the temperatures OR control the relay using VISA, not both.

I wasn't able to use LINX because it doesn't seem to support one-wire protocol. Is that true?

When I try to implement both at the same time, LabVIEW only displays the temperatures but the relay doesn't receive the commands.
I'm attaching the Arduino and LabVIEW codes.

Thanks!

Download All
0 Kudos
Message 1 of 3
(1,336 Views)

LINX/Hobbyist Toolkit is a nice toy but for such an involved multi device control task you really should not try to control the various sensors through the serial link used by LINX. What you should do is writing an Arduino sketch that reads the various sensors and then also contains a serial handler that you can send commands to from LabVIEW and respond with a string containing the measurements your sketch last time did. Operating in this way will work over a normal VISA serial connection without the need to invoke LINX functions.

 

LINX allows you to access the various IO resources directly from your LabVIEW host and implement the actual handling in LabVIEW itself. But every transaction to access a single resource requires one or more write operations to the device and waiting for the individual responses in between and that all over a pretty slow serial bus. That makes implementing multiple devices in the same program very difficult and slow,. In the same way it would be theoretically possible to implement the one wire protocol in such a way, but the serial port is to slow to allow that in a reliable way.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 3
(1,317 Views)

I'm not sure I understand this correctly. Could you be a bit more specific about what I should change in my Arduino code?
I'm not really using LINX for now, just VISA.

 

Thanks for the quick response!

(Code attached below).

0 Kudos
Message 3 of 3
(1,301 Views)