LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

How to continuously monitor RX and TX (Pin 9 and 10) on Uno

I have a sensor that writes to continous string to Rx. How do I read these ports as text string

0 Kudos
Message 1 of 6
(4,400 Views)

You would need to put some code in the main Arduino loop to get the data and store it in a variable.  Then, you would need to create a custom LIFA function to get the value of the variable.  But note that this will slow down communication with LabVIEW.

That's the best I can answer without more information about the sensor.  For example, it would be idea (IMO) if the sensor had a mode that where you could get a single value on command which would fit better intot the LIFA architecture.

0 Kudos
Message 2 of 6
(3,432 Views)

Hi Nathan,

Thank you for thr quick reply.

Howevere, somehow Ithink there should be an easier way to do this!! I have atached partial documentation and one picture. Maybe my aproach iswrong. I thought all I nead to do is to read the text that is comming out of Tx pin. Is that even close? Well, I see you are very busy and do answer all request and I do appiciate you hard work.

Regards,

Barddya

EZ3.png

®

LV-MaxSonar -EZ3TM

High Performance

Sonar Range Finder

® With 2.5V - 5.5V power, the LV-MaxSonar -

EZ3TM provides very short to long-range

detection and ranging, in an incredibly ®

small package. The LV-MaxSonar -EZ3TM detects objects from 0-inches to 254-inches (6.45-meters) and provides sonar range information from 6-inches out to 254-inches with 1-inch resolution. Objects from 0- inches to 6-inches range as 6-inches. The interface output formats included are pulse width output, analog voltage output, and serial digital output.

=======

LV-MaxSonar -EZ3 Pin Out

GND – Return for the DC power supply. GND (& Vcc) must be ripple and noise free for best operation.

+5V –Vcc – Operates on 2.5V - 5.5V. Recommended current capability of 3mA for 5V, and 2mA for 3V.

TX – When the *BW is open or held low, the TX output delivers asynchronous serial with an RS232 format, except voltages are 0-Vcc. The output is an ASCII capital “R”, followed by three ASCII character digits representing the range in inches up to a maximum of 255, followed by a carriage return (ASCII 13). The baud rate is 9600, 8 bits, no parity, with one stop bit. Although the voltage of 0-Vcc is outside the RS232 standard, most RS232 devices have sufficient margin to read 0-Vcc serial data. If standard voltage level RS232 is desired, invert, and connect an RS232 converter such as a MAX232. When BW pin is held high the TX output sends a single pulse, suitable for low noise chaining. (no serial data).

TM

RX – This pin is internally pulled high. The EZ3
measure range and output if RX data is left unconnected or held high.

AN – Outputs analog voltage with a scaling factor of (Vcc/512) per inch. A supply of 5V yields ~9.8mV/in. and 3.3V yields ~6.4mV/in. The output is buffered and corresponds to the most recent range data.

PW – This pin outputs a pulse width representation of range. The distance can be calculated using the scale factor of 147uS per inch.

BW – *Leave open or hold low for serial output on the TX output. When BW pin is held high the TX output sends a pulse (instead of serial data), suitable for low noise chaining.

0 Kudos
Message 3 of 6
(3,432 Views)

The best way to use this sonar range finder with LIFA is to use the analog output, pin AN.   It is very  easy to monitor an analog signal using LIFA and one of an Arduino's analog inputs. 

If you prefer to do this task the hard way you could monitor the ASCII signal with Labview by getting a USB to serial converter. 

hrh1818

0 Kudos
Message 4 of 6
(3,432 Views)

AN reading is the first thing I tried, although I still would like to know how to use Tx in Labview.

The issue with AN is that, according to the documentation it has a scale of (Vcc/512) [does it make sense?] so, 5V will give ~9.8mV/inch

How do I translate what I read from analog pin which a low voltage to a distance?

Barddya

0 Kudos
Message 5 of 6
(3,432 Views)

Using the alternate serial communication available to the Arduino via LIFA is not trivial and requires consideralble changes in the LIFA firmware and LabVIEW interfacing VIs.  Getting a USB to serial converter device would allow you to connect to the sensor without the Arduino entirely but you will need to build the interfacing VIs required using VISA.

Like hrh1818 said, using the analog method will be the easiest method if you want to use the Arduino to do it.  To get a distance (with Vcc = 5) you simply read the analog pin and then divide by the resolution (Vcc/512 = 0.009765625 volts/in).  You can verify with dimensional analysis:  Volts divided by volts/inch will give you inches.

E.g. Vcc = 5 and Analog Read Pin gives you 2.5 V  --> 2.5V/(0.009765625 V/in) = 256 inches.

0 Kudos
Message 6 of 6
(3,432 Views)