I recently purchased a UBS host shield for my Arduino Mega. I want to use it to read data off a hand held usb connected optical power meter. Looking through the online documentation I could only find examples for PS controllers and flash drives. I was wondering if anyone can point me in the right direction:
I have no specific idea, but you can try to connect the sensor to a PC, using the indicated software. Then check the Windows Device Manager for details about the protocol (USB class...) of the device.
I would start exploring https://chome.nerpa.tech/arduino_usb_host_shield_projects/ and possibly the "USB to serial converters" device classes they list, may be the CDC ACM (The CDC-ACM class provides a serial interface for connecting devices such as modems to an embedded system ➜ more info)
You might be able to pick up some chatter on the USB port. Your link has references to a doc that seems to document the protocol to ask queries as well.
it would have been easier probably to get an RS232 version of your product (1919-R device apparently)
Thanks for your reply. I had a few follow up questions:
I went on the forum already. They dont seem to expand on generic usb devices. The power meter outputs one value that I am interested in. I am almost tempted to try and strip the USB cable and connect the pins directly to my analogue inputs. What are your thoughts on that?
Why would you recommend that other sensors? Is the Rs232 have something in its usb interface this model doesnt?
What would you say is the closest device on their list of examples does this resemble so I can start there?
I did see the queries. Its almost like python where I have a function.object to call specific values. I have never dont it in Arduino unfortunately. Any current discussions that you can point me to?
Thanks for your help
The CDC ACM class in the USB Host Component is used for attaching communication devices to your system. It's a likely possibility, hence my suggestion. They have also some sample code (acm_terminal ) for that.
not sure what you would do? try to look at the differential value to extract bits?
it's easy to get an RS232 to UART TTL converter and then you just speak Serial. no need to mess around with USB
for point 4, if you get to a point where you can read and write to the device - then it's just a matter of sending bytes and listening to the answer.
I would suggest to study Serial Input Basics to see how a Serial line would be managed to buffer the response until an end marker is received
You might be able to use what looks like a virtual COM port after installing their software:
"Install PMManager to use with the 843-R-USB, and your PC becomes a full optical power meter workstation. A COM object for system integrators, as well as a LabVIEW library are provided."
I did and installed the software that comes from the manufacture. When I went to device manager, it said the device was connected. Under class, I found OphirMeasurmentDevice. What am I looking for?
No I am not. The usb cable is a standard external one. If i am getting one value off. I was thinking maybe I could read the differential signal off the two data pins off the 4 in a usb connection
That isn't quite what I meant. What I suggested, or meant, was to plug it in without first installing any software. With the installed software, you would expect USB drivers to be installed for it, if it is not plug-and-play. I suggested that way because, obviously, you can't install their software on the Arduino. So, you should try uninstalling the manufacturer software bundle and try again.
When you found your device in the Device Manager, where was it? In this case, you are hoping that it appears under "Ports (COM & LPT)".