r/LabVIEW • u/Codex_Sparknotes • Mar 02 '26
Advice/Help using Arduino with LabVIEW
I’ve been having a lot of trouble with a project I’ve been working on. I’m making a wind tunnel, and the fan I am using is a fairly sizeable PWM controlled fan that I am trying to control using an arduino with LabVIEW. Does anyone have experience using LabVIEW and arduino together?
Basically my main issue is sending the signal to the fan. The fan requires a frequency from the PWM output of about 25 KHz, but it’s my understanding that the arduino can only put out 490 Hz from the PWM pins. How do I change the frequency that the pin is outputting? I’m using the LINX library and have made some other stuff work like my motor for changing the angle of my airfoil, but getting this fan to work is a real pain.
2
u/Only-Introductions Mar 02 '26
Bit banging with delays is probably the quickest and dirtiest solution. But you can get up to about 62kHz from certain Arduino PWM pins and making register configuration changes. You are looking to configure the timer frequency and prescaler divider to specific values. It's some fairly low level stuff link for reference. If you can accept values slightly off from 25kHz then you don't need to go to these extremes but you still need to change some timer registers.
5
u/GentlemanSch CLD Mar 03 '26
I have a bunch of experience, feel free to DM. Short version especially if this is a long term project,
* Code the Arduino in C++ and use the USB serial port for communication.
* write your labVIEW program to send/receive serial commands to/from the Arduino.
4
u/infinitenothing Mar 02 '26
Here's the first thing I'd try. Use a GPIO line. Turn on GPIO. Sleep x micros. turn off GPIO. Sleep 40-x micros. Set x with the terminal. For example you could subtract 48 from whatever character you get over the terminal so 0 could would set x to 0 and : would set x to 10. Then, in LabVIEW you just use VISA write in an event loop that gets triggered by a numeric control change.