I have a scenario where a sensor sends data to an Arduino Mega 2560, passing through a HW-97 (converter, with chip485) and I can display the sensor information via the serial port (Arduino's serial.print). However, in my application.
I have a NI DAQ USB 6008, I would like to know a way to connect this DAQ to the Arduino. and connect the DAQ to the computer via USB, so that through a COM Port, I can obtain the data serially, through a labview for example.
Would connecting the Mega's serial terminals (18 and 19), for example, to two USB 6008 digital terminals, give me this result?
What I need is for the Arduino to send the information to the DAQ, and somehow I can use the NI DAQ 6008 USB, connected to my computer, to see the sensor data arriving through the DAQ.
Does that thingie have a UART input? If yes, connect the arduino to it. If no, you could implement a lowspeed 2-wire protocol with 2 IOs, Or you connect the arduino directly to the PC and be done.
Problem, restated.
"I have a commercial product which has inputs read by a microcontroller and transmitted to my PC via USB. I want to use my Arduino to eavesdrop on the data flow from the commercial product to the PC. The commercial product has no UART port, but I believe it uses Serial, so I should be able to listen to it."
If that's what you're really saying, your problem lies in the last statement. It may or may not use serial, it could instead be a native USB device. Even if it uses Serial, there's no documentation that will tell you where to insert your connections to eavesdrop, and no documentation of the communications protocol (what bits/bytes in the datastream mean what).
Doesn't surprise me. My experience with NI is ancient, but back then, asking details that would require revealing core product features wasn't generally fruitful. Their products are good, but you've got to drink the coolaid. I got tired of the flavor.
Ahh, so what you're looking to do is use the commercial device as a front end to acquire data for your Arduino. Much different need. However, you're still out of luck. Your Mega has no hope of communicating with a USB device such as this.
I concur with @camsysca, you can't send the data from the Arduino to the DAQ through USB.
The NI DAQ USB-6008 is designed for data acquisition, so it's taking measurements from physical sensors, signals, or whatever sources and it is converting that analog data into digital form which is sent in a specific format over USB for processing by a software on a host computer - I assume this is where you use LabVIEW.
if you want to only have the DAQ connected to the PC, what you could possibly do is read the witmotion-wtvb01 data through the arduino and use a PWM signal on your mega to encode the inclinometer data (is that the only one you care about?). As the MEGA has only 256 PWM values, if you use only one pin, You'll loose in precision. If you encode the inclinometer data over 2 pins then you have a 16 bit sampling equivalent but then you need to have LabVIEW detect the PWMs and rebuild the numeric values.
if you can add a DAC to the MEGA then you could use it to send an analog value to your DAQ representing the inclinometer data. Then there is not a lot of work to do in Labview.
Alternatively as you mentioned, LabVIEW can handle multiple serial ports simultaneously via the VISA functions. So you could connect the Inclinometer to LabVIEW through a RS485 to USB Serial adapter as well as the DAQ and handle the two data sources in parallel. LabVIEW can communicate with Python to decrypt a custom binary protocol over a serial line so you would use that to acquire the witmotion-wtvb01 data (something similar to the arduino code).
If you can't decrypt the Inclinometer's protocol on the PC, then go through the Arduino and have the Arduino send something easier to parse to Labview. In that case both the DAQ and the Arduino are connected to the PC using USB.
My need is precisely to obtain the data coming from the inclinometer in the DAQ (Labview for example).
Witmotion provided me with an example script working on the Arduino Mega, I connect the wtv to a HW-97 485-TTL converter. and connect this to the Arduino Mega.
Now I need to make this information that I receive on the Arduino Mega reach the DAQ. (NO ARDUINO CONNECTION TO PC).
I will always leave the Arduino running the WITMOTION code that acquires the data, and I will add to this code the necessary steps to send the data to the DAQ.
I have the 485 converter, but I can't connect anything to the USB ports on my computer other than the DAQ. I need to leave Witmotion and get to the DAQ, whether or not it goes through an Arduino, whether or not it goes through a converter, whether or not it goes through a DAC, whether or not it goes through any type of module.
I'm thinking about the possibility of using Arduino as a bridge because Wit has already provided me with an Arduino script, so I'm here looking for alternatives.
I see no reason why you couldn't manage the two serial devices in LabVIEW, plus talk to the 6008. I wrote in LabVIEW for many years, mostly interfacing and data acquisition, storage and analysis from a broad spectrum of devices, serial, USB, GPIB, and, initially, built in ISA and PCI cards, and it's all in the coding skills(just like Arduino, frankly), NOT the devices. However, you may require skills beyond your present capabilities, if I read your posts correctly. That's beyond the scope of this forum, for sure.
Maybe OP is in a company where what’s get connected through USB to a computer is heavily regulated ? (Then I wonder how he got the code onto the Arduino)