OUT package and IN report via interrupt transfer

I am using an Arduino UNO and the Ocean Optics (8-photodiode) pixelsensor (model #2042ASY-005). (Pin 2 is D- and pin 3 is D+.) The sensor does not have a library but requires a USB Interrupt Transfer to get the data from the sensor.

According to the sensor documentation, you send an OUT Interrupt transfer packet (4 bytes). When this is received by the sensor device it will cause an IN Report to be queued at the device (and will update the devices configuration register if required). You then send an IN interrupt transfer request. When this is received by the device it causes the device to return the the queued IN Report (20 bytes long) which contains the sensor data.

I have looked at a number of codes and watched many videos on external and internal interrupts, registers, etc., but I am still at a loss how/what command to use to send the OUT and IN interrupt transfer packet/request. I assume could use serial.readBytes to read in the queued IN report once sensor creates it, but could you shed any light on how I would send the OUT interrupt transfer packet and then the IN interrupt transfer request from the Arduino to the sensor?

Thank you very much for any help you can give!

Can you provide a link to your sensor.

Search the Arduino forum for "USB host" and see if you can find some help, there.

@lolita777, your topic has been moved to a more suitable location on the forum. Introductory Tutorials is for tutorials that e.g. you write, not for questions. Feel free to write a tutorial once you have solved your problem :wink:

Thank you! (Sorry for the error - I appreciate your help!)

Thx- I did try that without much luck. But I will keep searching online for more understanding and a similar issue to mine…

Hi, the sensor oem integration guide (which is what I have) is at

Page 17-18 of the guide (which is page 23-24 of the pdf) gives the integration specification information that I am confused about.

Just put the PDF up here….
The cloud wants me to ‘accept’ something… not happening.

I'm not sure how, but I think this will work:

PixelSensor OEM Integration Guide Ver 1.3.pdf (1.9 MB)

(if not, please tell me how- thx)

USB Enumeration Information
Vendor ID: 0x04D8 (subject to change)
Product ID: 0x005F (subject to change)
USB Transfer Type: Interrupt
Device Type: HID

Take a look at the USB Host Library Rev. 2.0 with particular attention on the paragraph about HID Libraries.

Interesting device. So this device works like a keyboard. You send it a command and it responds with results. You would need a USB HOST SHIELD with your arduino to talk to this thing. It should not be extremely hard. I recommend getting both versions 1 and 2 of the USB Host Library.

In my opinion, V1 is much easy to understand and doesn't have all the complexity of V2 that makes it very hard to understand how it works. For your simple application, I'd go with V1:

I wish I could find information from ocean optics but there is none. Have they retired this thing? What do you do with it? Just curious. I am a physicist. I may be able to whip up a lab with this sensor if I know what kind of applications I can use it for. I have ocean optics compact spectrometers for a regular lab but that is way too automated. Looking for something else. If there are interesting applications and the module isn't expensive, I could get one and work on a sample code :wink:

Sparkfun and Adafruit sell a very similar sensor, in three different wavelength versions that communicate via I2C. Arduino libraries are already available and it works out of the box. There is also this 18 band UV, VIS, NIR version.

Given the sparse documentation for the Ocean Optics sensor, there is no obvious reason to expend the non-negligible effort required to get a USB host shield working with it.

These sensors have very small holes, suggesting the need for sufficient lighting. The ocean optics sensor has larger area so I suspect it will work under dimmer light conditions.

Thank you, everyone, for so much feedback. The exact sensor I have has been retired but (it originated from PixelTeq - PIXELTEQ Introduces PixelSensor Multispectral Photodiode Array - and then was absorbed by Ocean Optics, which became Ocean Insight. I believe the chip is now used in https://salvoimaging.com/ products.
I am a physicist (but quite new to microcontrollers and the like), and we are investigating using the sensor to gauge ocean color. (The sensor chip with oem board was $200ish, and my section (physics at the Coast Guard Academy) bought it to integrate into a CubeSat, purely as a student project. We are playing with it now, also as a potential student project, to look at ocean color. (The relative intensities of the water at the various wavelengths can give an indication of ocean health.)

Ps- Dr. Telsa (liuzengqiang), if you whip up a lab with this or the like, we would love to collaborate(!)

Pps - I am connecting the sensor to the Arduino UNO using a USB-B micro to USB-B cable. (USB-B micro plugs into the sensor oem board and USB-B plugs into the Arduino.) Do I still need a USB Host Shieldl? (I could also directly connect the pins on the sensor board (GND, 5V, D+, D-) to the Arduino.)

"Sufficient" being comparable to or greater than moonlight. The AS7262 sensitivity is typically 45 counts per microWatt/cm^2, per channel. For comparison, full moonlight is about 0.1 uW/cm^2.

1 Like

This would unfortunately not work. It's a common misunderstanding that if you find a cable to connect two devices with USB connectors, you can make them talk to each other. I admit I was thinking this way as well, until I started working on USB systems in projects.

A USB system has a host and a device or several devices. Only the host can talk to the device. Devices can't talk to each other. A PC is a host. A USB Host shield has a host IC. Most other USB devices are literally devices, such as that sensor dev board, a mouse, a keyboard, or a flash drive. A smartphone can act as a host when you connect a flash drive or mouse to it using an OTG adapter and it also can act as a device when you connect it to a PC.

Here are some details to help you understand. A host has a lot of work that a device doesn't do. Think about a teacher and a student. Two students don't make a class because neither can teach.

The sensor sounds expensive. I thought it's less than $50. I could help but I might not be able to get one for a project until some students get interested and write a proposal to get the money.