General question about USB Host Shields & Leonardo

What I have:

  • Arduino Leonardo from the official store here
  • Pre-soldered USB Host shield from eBay
  • USB Host shield from Amazon that I soldered myself

Both of the USB Host shields do not work on my Leonardo but people that I know of are able to get it working.
There is no power going to either host shield. (Not tested with a meter) - I tried with many USB devices like mice, keyboards, USB flash drives, etc.
Do I need any specific libraries to make the USB host shield work?
All I want is my mouse to work with the shield.
I feel like I am missing something, or should the shield work right away?

How do you power the Leonardo? Have you tried to power it externally?

The Leonardo is plugged into my PC directly. The Leonardo is working fine with power, no issues.

The shield requires the following library: GitHub - felis/USB_Host_Shield_2.0: Revision 2.0 of USB Host Library for Arduino.

I suggest running simple examples included with the library such as board_qc and USB_desc.


I have this installed, then when I include the library I get a big error. @Icebuster

In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:1:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/address.h:26:2: error: #error "Never include address.h directly; include Usb.h instead"
 #error "Never include address.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:5:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/avrpins.h:28:2: error: #error "Never include avrpins.h directly; include Usb.h instead"
 #error "Never include avrpins.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:12:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/confdescparser.h:25:2: error: #error "Never include confdescparser.h directly; include Usb.h instead"
 #error "Never include confdescparser.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:14:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/hexdump.h:26:2: error: #error "Never include hexdump.h directly; include Usb.h instead"
 #error "Never include hexdump.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:20:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/macros.h:26:2: error: #error "Never include macros.h directly; include Usb.h instead"
 #error "Never include macros.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:22:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/max3421e.h:25:2: error: #error "Never include max3421e.h directly; include Usb.h instead"
 #error "Never include max3421e.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:24:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/message.h:25:2: error: #error "Never include message.h directly; include Usb.h instead"
 #error "Never include message.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:26:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/parsetools.h:26:2: error: #error "Never include parsetools.h directly; include Usb.h instead"
 #error "Never include parsetools.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:27:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/printhex.h:26:2: error: #error "Never include printhex.h directly; include Usb.h instead"
 #error "Never include printhex.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:40:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/sink_parser.h:26:2: error: #error "Never include hexdump.h directly; include Usb.h instead"
 #error "Never include hexdump.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:49:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usbhost.h:28:2: error: #error "Never include usbhost.h directly; include Usb.h instead"
 #error "Never include usbhost.h directly; include Usb.h instead"
  ^~~~~
In file included from C:\Users\x\Documents\Arduino\sketch_nov02a\sketch_nov02a.ino:52:0:
C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/usb_ch9.h:26:2: error: #error "Never include usb_ch9.h directly; include Usb.h instead"
 #error "Never include usb_ch9.h directly; include Usb.h instead"
  ^~~~~
Multiple libraries were found for "address.h"
 Used: C:\Users\x\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0
 Not used: C:\Users\x\Documents\Arduino\libraries\USBHost
exit status 1
Error compiling for board Arduino Leonardo.

Note: I do not have the USB host shield on top of my leonardo right now.

I use IDE version 1.8.19. Compile board_qc.ino or USB_desc.ino. Both compile fine for me using board type Leonardo.

If nothing compiles correctly, reinstall the USB host library. If there is no remove option, install an older version of the library then install the latest version.

Try something similar for you AVR board package.

How can I include the USB_desc.ino & board_qc.ino in my arduino code? I don't have either of these saved. USB_desc.ino: No such file or directory @icebuster

"Compile board_qc.ino or USB_desc.ino"
Do you mean like this?

#include <USB_desc.ino>
#include <board_qc.ino>

Because if so, I am getting the error USB_desc.ino: No such file or directory
And are you 100% sure that a library is needed for a USB host shield to work with other USB devices? I would assume so, but I heard from people that it's not but they weren't sure either.

Also I use Arduino IDE 1.8.19

I suggest looking at the following to compile and upload the blink.ino example.

One that is working install the USB Host Shield library. This is required to use the shield.

Start from the IDE main window. In the top left corner click on File. Then click on Examples. Scroll all lthe way down to the custom library examples.

Scroll over the USB Host Shield Library Examples. Move right and select the board_qc example. This should open a new window. You should be able to compile and upload the example.

But the shield may not get enough power. Power it externally and try again.

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