Reading USB Sensor Data

I have a sensor which is usually ran/read via the command line terminal, but interestingly enough the sensor has multiple microUSB jacks for different communication protocols. I am making a PCB design, and I am wondering how to handle the connections for the D- and D+ ports.

I am using an ATMEGA 2560 on arduino IDE v1.8.7 (OS issues dictate that I can't upgrade it), the sensor I am using has a USB port for UART and another for SPI. I am familiar with programming both of those protocols, but I am unsure how to relate those to the microUSB jack on the board (i.e. the wiring from the USB connection to the MEGA). My understanding is that per the Arduino page here, the ADC conversion can only be run around 10,000 times/second. If the technique involved will be bit-banging, receiving 10,000 bits/s will not be nearly fast enough for SPI, but may be fast enough for UART at 9600 baud rate. I read on this wikibooks page that USB communicates on the scale of 1.5MB/s minimum, and I wasn't sure if that would create issues with my design.

This is the first time that I have messed with a USB jack on a PCB, so any tips, tricks, or common pitfalls to avoid would be most appreciated.

Are you saying the designers of the sensor unit repurposed USB connectors for non-USB (UART, SPI) data?

The two microUSB connectors are labeled SPI and UART. The programming side of things is quite complex so I’m not sure if they’re just using the microUSB connectors for SPI or UART or if there’s another reason for it. Is there more info I can find for you that would help?

You could post a link to where we can find more information about this sensor unit.

It's a bit unusual to use USB connectors for things other than USB data, but it has been done. I remember seeing a Youtube video by scanlime about a mass produced commercial gimbal that used a USB connector for TTL serial data.

The digikey page with a detailed description: here

The company's page with more details/pictures of the unit: here

The page with the datasheet: here

User guide: here

Hopefully this helps. In general though, would reading the info bit by bit be doable on an arduino board? or is it too slow as I surmise?

OK, those connectors are for USB data. They are connected to bridge chips that convert between UART or SPI data and USB data, similar to how the Arduino Mega has an ATmega16U2 chip that converts the UART communication from the ATmega2560 to USB communication with your computer, where it is provided as a virtual COM port.

That is not going to be a great choice for interfacing with an ATmega2560. You will be better off to connect via the 2x5 header with the UART and I2C pins instead. But note this module is using 1.8 V logic levels, so you will need to be careful to convert them to the 5 V logic levels of your ATmega2560. If you subject the XM112 to 5 V, you’ll probably destroy it.

Oh that's a great idea I had not thought of bypassing the microUSB. I will try that and then report back if there are any issues. Thank you!

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per