A flat Waveform Chart with an empty read buffer, while the Arduino Serial Monitor shows 300-800 counts, puts the fault between the USB port and the VISA Read node. The Uno and the AD8232 are already proven by the Serial Monitor. Swapping Decimal String To Number for Scan From String or Spreadsheet String To Array does nothing, because all three parse a string that is empty. Rebuilding the diagram does nothing either. The diagram under repair is VISA Configure (9600) to VISA Read (30 bytes) to Decimal String To Number to Waveform Chart. Work the steps below in order. Each one ends with a check that must pass before the next.
Check that VISA lists the Uno before touching the diagram
If VISA cannot see the port, no diagram change matters. Open the VISA Resource Name control dropdown (on Windows, NI MAX or Device Manager also works). Plug and unplug the Uno and watch for an ASRL entry appearing and disappearing.
On the laptop used in this build, a Mac, the port never appeared in LabVIEW. The same project worked once it was moved to a different laptop. Trying every listed COM port is pointless when the list is empty or holds only ports that are not the Uno.
- Temporary restore: run the VI on a machine where the port enumerates.
- Permanent repair: install the USB-serial driver the board or its clone's USB chip needs, then re-check the list.
Check: an ASRL resource appears when the cable goes in and disappears when it comes out. If it never appears after the driver install, stop and take it to official NI support (see the last FAQ).
Release the COM port and open the session once
Only one program can hold the serial port. The usual quick fix is to keep pressing Run. That fails when the Arduino IDE Serial Monitor or Serial Plotter still owns the port, or when an earlier aborted LabVIEW run left a session open. Then VISA reads nothing.
- Close the Serial Monitor and Serial Plotter, or the whole Arduino IDE.
- Open the VISA session once, outside the loop, before the first read. Use VISA Configure Serial Port with the resource name wired in, or an explicit VISA Open placed with it.
- Pass the session and error wires through the loop and finish with VISA Close after it.
- If a previous run was aborted with the Abort button, restart LabVIEW to drop any stale session.
- Expect the Uno to reset when the port opens, because the serial DTR line toggles the auto-reset. The sketch restarts and sends nothing until the bootloader hands over. Add a wait after configuration, then call VISA Flush I/O Buffer so a partial first line is discarded.
Check: the error cluster out of Configure is clean. A property node reading VISA Bytes at Port shows a count that keeps growing while the sketch runs.
Match baud rate and line format to the sketch
The 9600 in VISA Configure Serial Port must equal the value in Serial.begin()in the sketch. The Serial Monitor working only proves that its own baud setting matches.
Serial.println(value) sends the digits plus carriage return and line feed. A 3-digit reading such as 512 arrives as 512\r\n, which is 5 bytes, not 30. Right-click the read buffer string indicator and switch it to \ Codes Display so the control characters show.
Check: the indicator shows digit groups ending in \r\n. Random symbols or boxes mean a baud mismatch. An empty string with a growing VISA Bytes at Port count means the read call is the problem (next section).
Read one line instead of a fixed 30 bytes
VISA Read returns when the requested byte count arrives, when the termination character arrives (if enabled), or when the timeout expires. A fixed 30-byte request against 5-byte lines has three consequences:
- The string holds several numbers, and Decimal String To Number returns only the first.
- If the chunk starts mid-number or with a control character, the parse returns 0. An empty string also returns 0. A stream of zeros draws exactly the flat line you see.
Fix it with the termination character. On VISA Configure Serial Port, confirm Enable Termination Char is true and the character is line feed (). Set the read byte count larger than one line, for example 20, so the terminator ends the read. Parse with Scan From String using %d.
| What you see | Cause | Test |
|---|---|---|
No ASRL resource |
OS/VISA does not enumerate the port | Plug/unplug with resource list open |
| Empty buffer, port listed | Port held by Serial Monitor or stale session; or Uno still resetting | Close other programs; watch VISA Bytes at Port
|
| Garbage characters | Baud mismatch with Serial.begin()
|
Match both sides |
| Readable text, chart at 0 | Fixed-size read splits lines; parse fails on leading control character | Enable LF termination, read one line, use %d
|
| Timeout error, then zeros | Nothing arrived within the timeout | Stop the loop on error; check port and reset delay |
Check: a numeric indicator after Scan From String shows a value in the same 300-800 range the Serial Monitor showed, and it changes with the signal.
Put the parse and chart inside a paced loop
A Waveform Chart takes one scalar per loop iteration. A terminated VISA Read blocks until the next line arrives, so the loop paces itself to the Arduino and needs no extra wait. Keep the open and close outside the loop.
Before loop: Configure Serial Port (baud = sketch baud, termination = LF, enabled)
wait for Uno reset, then Flush I/O Buffer
While loop: VISA Read (count = 20)
Scan From String (format %d) -> value
Waveform Chart <- value
stop on Stop button OR error
After loop: VISA Close
Check: the chart trace moves when an electrode is touched or the input changes, and the value matches what the Serial Monitor showed in the same conditions.
Raise the sample rate before judging waveform shape
Once the chart moves, a spiky or misshapen trace usually comes from too few samples. The transmit time is per line, not per bit. Assuming 8N1 framing (10 bits per character) and a 5-byte line:
| Baud | Time per character | Time per 5-byte line | Upper bound, lines/s |
|---|
These are ceilings. Any delay()in the sketch and any loop overhead in LabVIEW lower the real rate. The QRS spike rises in tens of milliseconds, so a few samples per beat draw a triangle. Pick a fixed sample period in the sketch, remove unneeded delays, and raise the baud in both places:Serial.begin() and VISA Configure Serial Port.
Check: count loop iterations per second in LabVIEW (a shift register with Tick Count works). The count should match the rate you set in the sketch. If it is lower, look for a long delay() or a leftover fixed-size read.
Clean up the AD8232 signal and connect it safely
Never connect this circuit across the body from a mains-connected setup. A fault can be fatal. Run the laptop on battery, or isolate the USB link, and read the manufacturer datasheet before touching the electrodes.
Signal problems that survive a correct sample rate are analog. Use the Analog Devices AD8232 datasheet and application note AN-1557 for the example circuits, right-leg drive and lead connections. Work through these in order:
- Electrode contact and placement: dry or loose pads give drifting or railed output. The AD8232 has leads-off detection pins (
LO+,LO-), so read them in the sketch and flag the sample invalid when electrodes are off. - Mains pickup: a laptop on its charger and long unshielded leads add 50/60 Hz noise. Move away from mains cables and run on battery.
- Scaling: the chart should use the 10-bit Uno ADC range (0-1023), so set the Y axis to match instead of leaving autoscale to hide the trace.
Check: electrodes off gives a visibly different trace from electrodes on. At rest, R peaks appear at regular intervals matching the pulse.
Run the end-to-end check
- Unplug and replug the Uno with the resource list open. The
ASRLentry appears and disappears. - Close the Serial Monitor and run the VI. The read buffer indicator shows digits ending in
\r\n. - The parsed numeric indicator sits in the 300-800 range and changes with the input.
- The chart trace moves, and loop iterations per second match the sketch sample rate.
- Press Stop. VISA Close runs, and an immediate second Run works with no error. Open the Serial Monitor afterward to confirm the port was released.
Restoring production means steps 1-4 with the 30-byte read replaced by a terminated line read. The permanent repair is the higher baud, the fixed sample period, and VISA Close on every exit path.
FAQ
Why does the LabVIEW Waveform Chart show a flat line while the Arduino Serial Monitor shows changing values?
The chart is being fed zeros. An empty read, or a string that starts with a control character or partial number, makes Decimal String To Number return 0. Check the read buffer indicator with \ Codes Display first; if it is empty, fix the port access, and if it holds text, fix the read size and termination.
Why does VISA Read return an empty string from an Arduino Uno?
The usual causes are the Serial Monitor or a stale LabVIEW session still holding the port, the Uno still resetting after the port opened, or a baud mismatch. Close every other serial program, add a wait plus VISA Flush I/O Buffer after configuration, and confirm VISA Bytes at Port is growing.
Why does Decimal String To Number return 0 on Arduino serial data?
It reads from the start of the string, so an empty string, a leading \r or \n, or a fixed-size read that split a line all give 0. Enable the line-feed termination character, read one line at a time, and parse with Scan From String using %d.
Why does my ECG waveform show only one or two points per spike at 9600 baud?
The QRS spike rises in tens of milliseconds, so raise the baud rate on both sides (for example 115200) and cut delays in the sketch.
Why does the Arduino COM port not appear in the LabVIEW VISA resource list, and when should I stop and escalate?
VISA lists a port only when the OS enumerates it and a driver for the USB-serial chip is loaded; on the Mac used in this build the port never appeared, while another laptop worked. If the port still does not appear after the driver install and a cable swap, stop and contact NI support with the OS version, VISA version and USB adapter chip. Contact Analog Devices support for AD8232 front-end questions.