Pages: [1]   Go Down
Author Topic: Arduino and NI usb DAQ  (Read 1087 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Alright, this may be a dumb question but here goes:

I have a quadrature encoder that read an angle.  I have this part working.  I need to write this number out to a pin, which will be read by a USB National Instruments USB DAQ.  I was trying to analogWrite to a pin, and wanted to verify it was sending the right information so I wanted to do an analog read and get the value to serial.print. Basically, how do i output a number from one pin and read it in on another?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 551
Posts: 46266
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I need to write this number out to a pin
How are you doing this? How does the device expect this number to be "written to a pin"?

Quote
which will be read by a USB National Instruments USB DAQ
No idea what a USB DAQ is, but is seems unlikely that National Instruments makes only one.

Quote
I was trying to analogWrite to a pin
Is that what the device expects? Hardly seems likely.

Quote
and wanted to verify it was sending the right information so I wanted to do an analog read
analogWrite() and analogRead() operate on pins on opposite sides of the board. Do you have the appropriate pins connected?

Quote
and get the value to serial.print
Well, that part, at least, is trivial.

Quote
Basically, how do i output a number from one pin and read it in on another?
First, let's make sure that this even makes sense. Post a link to the device that you are trying to talk to, and explain this number that you are trying to output. Byte, int, float, unsigned long? uint64_t?
Logged

"The old Europe"
Offline Offline
Edison Member
*
Karma: 1
Posts: 2005
Bootloaders suck!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Assuming your usb data acquisition hardware reads analog values, you need to add a suitable low-pass filter to the PWM pin of the arduino. I think the PWM frequency is around 500Hz. In case of doubt use a scope to make sure the voltage is reasonably steady.
Logged

• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 326
KC4MM
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think the problem is Arduino's differing use of the word 'analog' for input and output pins.

An 'analog' input expects a voltage input over the nominal range of 0-5v (or other if the reference pin is tied to some other voltage).

An 'analog' output is PWM - that is an approximately 500hz oscillation who's duty cycle depends on the value being output.
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 326
KC4MM
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, and if you are using NI Daq equipment I assume you're likely a LabVIEW programmer. You might want to check this out if you haven't already done so.

https://decibel.ni.com/content/groups/labview-interface-for-arduino

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

RoyK
Thank you!
Yes I am a labview programmer and did not know this existed.  This is the perfect solution to my problem.  I can read a value from arduino using a quad encoder assign that value to a variable and have it interact with my daq.  Thank you so much!
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 326
KC4MM
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You're welcome (from a now retired LabVIEW programmer).
Logged

Pages: [1]   Go Up
Jump to: