Connect a qr-code reader to Arduino

Hi,
I would like to connect a qr-code reader to Arduino nano via a TTL usb schield CP2102. After several attempts, I cannot find a solution. What am I doing wrong?
Should I change shield? Are there any library that can help me out?

Which one? User manual / datasheet please.

Which one?

We can't possibly have any idea as you didn't tell us what you tried.

Sorry!
The shield used is CP2102 USB per TTL Konverter HW - 598 per 3,3V e 5V con cavo
The qr-code reader is Inateck 2D Wireless Bluetooth® Barcode Scanner BCST-50 – Inateck Office

I have connected both wireless usb and cable to the shield

Draw it. Did you have to hack cables to make it fit?

USB has a host (e.g. your PC) and devices (e.g. mouse and keyboard). Hosts can communicate with devices, hosts can not communicate with each other and devices can't communicate with each other.

The CP2102 is, to my knowledge, an USB device that needs to be connected to a host (e.g. your PC); looking at the image of the apater, it has the connector that fits in the PC so that would make the adapter a device.

Your scanner comes with a USB A/B cable and that makes that the scanner (connected that way) an USB device; the USB dongle that comes with your scanner is also an USB device.

As said, devices can't communicate with each other.

The easiest way is probably to use the USB A/B cable in combination with a USB host shield; your scanner connected that way probably acts like a keyboard and that should be supported by the library for the USB host shield.

Yes, my idea was to simulate a keyboard device, as the qr-code scanner should have similar behaviour.
I connected it like this.

So based on what you've written, should I change the schield type, like a CH376?

I'm not sure; it's getting outside my area of expertise. I was referring to something like https://docs.arduino.cc/retired/shields/arduino-usb-host-shield which uses a MAX3241E.

I think it could be easier to switch to Esp32 and use it as bluetooth HID host. That scanner is acting as HID keyboard.

Interesting!
I have an esp32-s3 at home!
Could you recommend some examples to guide me in writing the code?

Unfortunately, I have been using only serial on bluetooth. But there is HID host for Esp32.
https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/bluetooth/esp_hidh.html

So I expect you find some code online.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.