Using USB Host Shield with Arduino

USB Host Shield

There is a huge variety of shields that are available which can be stacked on top of an Arduino. Often there are more than one manufacturer for a single type of shield itself. In a way this is good, because as a user you are going to have multiple options. But it becomes a problem when the shield is pretty complex (like the USB Host Shield) and you have to use a library and the shields are not compatible with each other. One such shield which has many incompatible versions is USB Host Shield and in this post I am going to tell you how you can select the proper shield and also the changes that you have to do to make even the incompatible shields work with the library.

What is an USB Host Shield?

Before we start, let’s first understand what is an USB Host Shield. It is a shield which provides USB Host support for Arduino.

So, what is USB Host support? The USB protocol defines two types of devices. One is called the host (or server) and the other one is called peripheral (client). The Host device controls the peripheral device and also provides power to it. When you connect any USB device like a mouse or a keyboard to your computer, your computer acts as the host and controls (or polls) the client device (keyboard or mouse or even an Arduino). For a successful communication to happen using USB protocol, you need at least one of the device to be the host, which means that you cannot connect two keyboards together and expect them to communicate with each other.

The USB Host shield has a separate chip (usually Max3421E), which provides USB Host support. Once you have this shield, your Arduino board can act as USB Host and you can connect other USB devices like keyboard, mouse or even an Android phone and communicate with the device from Arduino itself.

What you can build using USB Host Shield

USB Host shield can be used to interface any USB device to Arduino. The following are examples which I have built using the shield.

Available Hardware Options

The following are the various versions of USB Host Shields from different manufacturers.

Available Software Libraries

The following are the two libraries that are available for USB Host Shield. Both of them are from Oleg of Circuits @ Home.

  • USB Host Library v1.0
  • USB Host Library v2.0

Out of these two, the v1.0 of the library is kind of deprecated. Use it only if you really need to or have to use some other library that depends on it, otherwise use only v2.0.

Selecting the right shield

If you have not bought the shield yet, then just go ahead and buy the shield from Circuits @ Home and use v2.0 of the library. The library works out of the box and you don’t need to modify anything.

But if you have already bought the shield from Sparkfun, especially the old (like me) then read the next section to find out the changes that you have to do to the library to make it work with the shield.

Making the Sparkfun shields work

Choose the instructions from the right section below based on your shield and library version.

Old Sparkfun shield (part no: DEV-09628) with v1.0 of the library

The old sparkfun shield has two issues. First, the GPX and RESET pins are swapped and the second it has power issues.

To solve the first issue, you have to make the following change on line number 24 of the max3421e_constants.h file in the library.

Alternatively if you are using my makefile to compile Arduino sketches (more about it in a separate blog post soon), then you can grab my fork of the library and add the SPARKFUN_9628_SHIELD define to your makefile.

To address the second issue, you have to add an external power source to the shield like a battery or wall adapter, even if you have connected the Arduino through USB cable.

Old Sparkfun shield (part no: DEV-09628) with v2.0 of the library

In v2.0 of the library the communication happens over the SPI pins and therefore you don’t have to make any change to the library. But to fix the swapped pin use you have to short the pin D7 to RESET. Take a small jumper cable and connect one end of it to D7 pin and the other end to the RESET pin (next to the 3.3V pin). This is the only change that is needed to get v2.0 of the library to work.

In addition to that you should also use an external power supply.

New Sparkfun shield (part no: DEV-09947)

The new Sparkfun shield has fixed the swapped pin issue, but it still has power issue. So to use this shield with both v1.0 and v2.0 of the library, you don’t have to make any changes to the library, but you should still connect the external power source.

Related boards

The following are some of the boards that also provide USB Host support.

108 thoughts on “Using USB Host Shield with Arduino

  1. Pingback: Controlling USB Missile Launchers using Arduino | Hardware Fun

  2. Shashank Khanna

    Can we use two usb host shields with an arduino??I actually want to transfer data from one usb drive to another..please help

    Reply
    1. Sudar Post author

      You can’t use two USB Host Shield with a single Arduino. Instead you can connect a USB Hub to your USB Host Shield and can connect up to 64 devices.

      Reply
      1. Michael

        I know this is an old thread, but thought I would ask. Could the system tell the difference if I connect two of the exact same video game controllers to the USB Host Shield via a USB hub or would it just recognize button A and not button A port 1 or button A port 2?

        Reply
  3. Pingback: Accessing GPIO pins of Max 3421 IC in USB Host ShieldHardware Fun | Hardware Fun

    1. Praveen

      Hi abhijit,
      Are you able to connect bhashatech shield with usb shield?
      I am also trying to do it but could not succeed.

      Reply
  4. Developer

    Did any one try to connect usb ethernet network lan adapter to usb host shield?
    I’m working on this.
    In this case no need for Ethernet shield and saving money.
    Regards.

    Reply
  5. vatsal

    Can anyone please provide me with a code and connection diagram to transfer data to and from into a pendrive using usb host shield and a leonardo board??

    Reply
    1. surv

      to a pen drive …all the efforts ??? when you can ( and i have ) connect an arduino(
      uno, mega2560) with a usb hard drive …and create +read+write to the usb hard drive … trick is make sure your usb hard drive/usb pendrive is formatted as fat32
      …and try not to forget download+install that usb host shield v2.0

      Reply
      1. surv

        let me know if you have you downloaded the usb host shield 2.0
        and which board will you be using, mega adk or uno+usb host
        shield2.0;
        and if you are using a pend drive/usb hard drive, you will also need
        a power adapter connecting the arduino board because the laptop/
        pc power supply to the 5v arduino board will not be enough

        Reply
  6. girindra

    Connecting Teensy 2.0 with Sparkfun’s USB Host Shield
    I’m trying a hardware keylogger project using teensy from http://www.irongeek.com/i.php?page=s…eylogger-phukd
    it is stated that i can’t connect my keyboard -> teensy -> computer directly because teensy needs to act as a USB host for the keyboard.

    I can’t find the USB host from the site, so I had a Sparkfun USB host shield instead.
    So, I connected the Teensy, micro-SD card adapter module, and sparkfun’s USB host shield like the [left] picture, with wiring like the [right] picture

    in details, I connected the micro-sd adapter to SPI pins 0-3 on teensy, and the USB host adapter to Tx & Rx pins 7-8.
    you can see the green cable on the [left] picture is Rx of teensy -> Tx of USB Host
    and the yellow cable is Tx from teensy -> Rx of USB Host
    the twisted Red and Black cable are the +5V and GND
    (in short, i followed the guidelines from the [right] picture)

    with this configuration, the micro-SD card adapter works fine, as i can access it from my computer, but the keyboard connected through the USB adapter isn’t detected.
    Anyone can help to point out of what I did wrong? any solutions to my problem?

    -Thanks!

    Reply
  7. gabriel sosa

    HI I WANT TO CONECT THE ARDUINO TO A PRINTER ZEBRA, USING THE USB HOST SHIELD, BUT I DONT KNOW HOW TO USE OR MAYBE IF THAT CAN BE USED, I HAVE THE CODE TO PRINT, BUT HOW DID I CAN SEND THIS IN THE USB HOST, PLEASE HELP!!!!

    Reply
  8. Jônas

    Hello, I need help,

    I have a USB Host shield from Sparkfun (new version) and I have to make it work with an Arduino Mega 2560, but still not getting success.
    I’ve done some tests like: connect D7 to reset, making connections SPI pins according to the mega, I used an external power supply, but nothing made ​​it work properly.
    Use version 2 of the Circuits @ Home library.

    ‘ve Got errors like:
    “Error: OSC Did Not Start”! (USB_desc)

    “Error: failed to assert OSCOKIRQ
    Circuits At Home 2010
    USB Host Shield QC test routine
    Press any key to continue …
    Reading REVISION register … Die revision invalid. Value returned: FF
    Test FAILED!!!
    Test Halted.
    0x55 pattern is being Transmitted via SPI to aid in troubleshooting
    Press RESET to restart test “! (Board_qc)

    I appreciate the attention and the help!

    Note .: I’m Brazilian, and I used the Google translator to translate this text!

    Reply
    1. Sudar Post author

      Hello Jonas,

      This sounds like a hardware problem to me. Do you have any other shield which you can test on?

      Also did you contact Sparkfun support?

      Reply
      1. Jônas

        Thanks for the reply!

        I am also suspecting that this is the problem!
        I have no Shield. And unfortunately I can not count on support from Sparkfun because the shield was purchased at a local retailer!

        I will continue trying to solve the problem!

        Thanks for listening!

        Note .: I’m Brazilian, and I used the Google translator to translate this text!

        Reply
        1. Jônas

          Hello, I’m here again,

          I made new tests with the sparkfun usb host shield with Arduino Mega 2560, and am now getting the board_qc the the following message:

          Circuits At Home 2011
          USB Host Shield Quality Control Routine
          Reading REVISION register … Die revision 03
          SPI long test. Transfers 1MB of data. Each dot is 64K ……………. SPI long test passed
          GPIO test. Connect to GPIN0 GPOUT7, GPIN1 to GPOUT6, and so on
          Test failed. Value written: 00 Value read: FF
          Press any key to continue …

          I do not know what to do !!!

          I appreciate the help!

          Note.: I’m Brazilian, and I used the Google translator to translate this text!

          Reply
          1. Sudar Post author

            What happens after this?

            GIPO test will fail because you would not have connected the GPIO pins. But does the other tests pass?

  9. Jônas

    Then I did a test with a mouse using the USB_desc example and it worked correctly.
    Then I did the tests with the barcode reader (which was what I wanted to do) and it worked correctly.

    My solution:

    Make a jumper between reset pin and pin 7.
    Make jumper between pins of SPI shield with the SPI pins of Mega 2560 (​​50, 51, ​​52, 53):

    10 > 53 (SS)
    11 > 51 (MOSI)
    12 > 50 (MISO)
    13 > 52 (SCK)

    That was my solution!

    I appreciate the help and attention, his contribution was very important to solve this problem!

    Reply
  10. Pavol

    Hello Sudar,

    I am using Arduino Due + USB Host Shield + official Ethernet shield.
    They use both SS at pin 10, so I have moved it on USB Host Shield to pin 7, updated the UsbCore.h. too and verified if working. So the USB shield uses now pin 7 for SS and it works.

    Ethernet shield was not modifed and so it should use Pin 10.
    It really works perfectly = ethernet shield is able to send/receive data, but only until Usb.Init() is called.
    It means, both devices work when connected to Arduino, but Ethernet shield doesn’t work after USB initialization.

    May I ask you for any advice?
    According to research I did on internet, what I did should have been sufficient.

    Reply
    1. Pavol

      Seems I have solved the problem:
      Before ethernet initialization it is necessary specifically require SPI for Ethernet shield.

      pinMode(10,OUTPUT);
      digitalWrite(10,LOW);

      Did the trick.

      Reply
      1. Tien Huynh

        SLAVE pin can be one of PWM pins. It is active low, which means you have to pull it LOW to select the slave for communication with MASTER. To be able to drive it, you need to specify OUTPUT mode on the pin .

        pinMode(10, OUTPUT); // pin mode. or DDRB |= (1<<DDRB4);
        digitalWrite(10, LOW); // put it LOW. or PORTB &= ~(1<<PORTB4);

        Reply
    2. Anisha

      Hi,
      Can I clarify with you if your Keyes ( as shown in the picture above) USB Host shield is compatible with your Due? Did you have to make any modifications to make them compatible?
      Would really appreciate your response.
      Thanks so much

      Reply
  11. chris white

    I’m using a Keyes use host shield by Funduino, but nothing I do seems to work with it. I’m using 2.0 library and mega 2560. Are the pin connection issues or compatability issues that you may be aware of, or do I possibly just have a junk shield? (so far I have found no support for this shield)

    Reply
    1. Sudar Post author

      Yeah that’s the problem. The library is created by circuits@home for their USH Host Shield, but released it under GPL so that other shield can use it. But they provide support only for their own shield.

      You have two options a) Try to find out if the buyer from whom you bought it has any support. b) Try to run the test program to see if there are any diagnostic message that gets printed.

      Reply
          1. chris white

            ok new problem, every time i try to upload board test to the arduino, i keep getting one error after another. like “stray \ in program” or “stray # in program”

          2. chris white

            so i got the board test to upload and when i start the serial monitor all i see is random characters… does this mean my shield is junk?

          3. Sudar Post author

            Did you choose the correct baud rate?

            Find out what baud rate is used in the program and use the same in the serial monitor.

    1. Sudar Post author

      From a hardware wise you should be able to connect it, but you may have to write lot of custom code to get everything to work together.

      Reply
        1. Sudar Post author

          Sorry Dili,

          I am able to understand anything about the shield since the description is not in English.

          Contact the seller of this sheild and ask them whether their sheild supports it or not.

          Reply
  12. Bryan

    Sudar, this is a great blog, thanks! I have the USB Host Shield from Circuits@home and it’s working fine to do things like read the device descriptor from a USB memory stick.

    My next step is to connect it to a USB port on a Xilinx FPGA board and use my USB host to continually read what the slave on other end is sending (like a console port). I was hoping it would be easy and rather generic, but all the USB host examples I’ve found seem to be quite complex and device-specific.

    Is there an easy way to read what a USB slave is sending, e.g. polling or something? It is a Silicon Image CP2103 Serial to USB converter (as the slave device).

    Reply
    1. Sudar Post author

      Nice to know that you like my blog.

      I don’t think there is a generic way to read data from USB Slave. But you may have to check with the author of the library to see if there is a way to do it.

      Reply
  13. Kev

    Trying to get SainSmart USB Host board to work with Uno and so far it has been a total failure. I have tried USB_Host 2 and 3. Tried the jumper and external power tricks mentioned above and I can’t get past usb.init(). The USB_desc sketch returns “OSC did not start. Other sketches yield similar results. I am a software engr. and just dabble with Arduino for fun, but this has not been fun at all. I have used several other shields and hardware successfully, but it seems the USB host boards, libraries, examples etc. are aconvoluted mess. I haven’t found a single place that just explains exactly what to do, step by step with a successful result.

    If anyone could sescribe exactly how to get the USB host shield working properly with a Uno or Due, I would be extremely grateful.

    thanks, Kev

    Reply
  14. parth

    hey…!!!
    i use kayes usb host shield with mega…
    i use it to connect PS4 to arduino…
    but everytime i take any input from analog pins(A0 to A6), my PS4 gets disconnect..
    why does this happen everytime?

    Reply
  15. Brian

    Hello Sudar,
    I just want to start off by saying, I have been reading your blog for quite awhile and have used it numerous times. Thank you very much for doing what you do, it helps me often as I am sure it helps many others.

    For the first time though, I have a question that I cannot find a good answer to.

    Backstory:

    I am creating an RFID based system with three readers, 350 tags, five arduino Mega’s , one sainsmart 16 channel relay board, one arduino.cc USB host shield, one barcode reader and one 82 foot long USB extension cable.

    Surprisingly I have everything working except that last part, the extension cable. The extension cable (I can supply more specifics on the cable and on the barcode reader if needed) seems to act as a USB 2.0 Hub. That , I believe is the key problem.

    Problem symptoms:

    When the system is operating nominally the barcode reader scans a barcode, this barcode acts as a conditional statement that changes the logic flow for the program. I have all of that working when the barcode reader is plugged directly into the USB host shield. However, when I plug the reader into the extension cable, and the extension cable into the USB host shield I fail to receive any data from the reader. That is the symptomatic problem.

    My question:

    Can you please help me with getting this to work?

    P.S.:

    I know I left a fair amount of specifics out of the post, I can supply you with any thing you need, just let me know.

    Very much looking forward to your response,
    Brian

    Reply
    1. Sudar Post author

      I am suspecting two issues

      – Signal loss due to cable length. You can test it out by connecting the cable directly to your PC and see if it is detecting the device.
      – Problem because of USB Hub. Generally being a USB Hub shouldn’t affect anything, but I am not sure whether this is a special type of hub or not.

      Reply
      1. Brian

        Thank you for your reply,

        The barcode reader works fine when connected through the cable to the computer.

        Below is a link to the extension cable.
        http://www.startech.com/m/Cables/USB-2.0/USB-2.0-Cables/USB-2-Active-Extension-Cable-25m~USB2AAEXT25M

        I have run the hub_demo program provided within the USB_host_shield_2.0-master when the cable and reader are connected , the program only detects (or at least outputs) the descriptive data for the cable hub. Unplugging the reader and having just the Cable connected yields the same result. Having just the reader connected the program outputs the readers description.

        Thank you again for your continued support,
        Brian

        Reply
        1. Sudar Post author

          Looks like either the hub in your cable is non-standard or the USB Host Shield library does not support the hub.

          USB debugging is very difficult. If you have the time (and skill) you can try to debug it by just running the hub program. Otherwise I would suggest you just use a cable which has no hub support.

          Reply
  16. Patrick

    Hello
    can I connect two ARDUINO with USB
    1x ARDUINO with a USB Host Shield and the other without USB Host Shield
    I want to comunicate from one to the next with ARDUINO SERIAL.READ and SERIAL.WRITE
    I need example
    greeting Pam

    Reply
  17. Balien

    TRENDnet’s USB 3.0 to Gigabit Adapter + USB Hub, type TU3-ETGH3, builds a Gigabit Ethernet slot and also 3 five Gbps Super high Speed USB 3.0 jacks to a Windows® or even Mac® PC.

    The TU3- ETGH3 is usually suitable with USB two and also one jacks. An enclosed additional electrical energy adapter delivers complete energy to energy greedy USB equipments.

    Reply
  18. Clement Adedeji

    Hello,

    I am struggling to get a connection between my new sparkfun usb host shield and arduino uno. The board_qc example finally detects my flash drive but now I am trying to detect like a usb cable mouse or bluetooth devices but they are not working. I have jumpered RST to D7. any help please

    Reply
    1. Anisha

      have you powered up USB shield? The power from your computer is not enough to support the power requirement of your shield. You would need to use an external power supply.
      Hope this helps!

      Reply
        1. Anisha

          Thats great!
          Would you be able to share how you got yours working?
          I’m actually having some trouble with my barcode scanner. My shield works fine with a mouse and I’ve used the code exactly as what a lot of tutorials have demonstrated. But I cant get it to work?
          Perhaps our solutions are the same!
          Quite desperate for any help now

          Reply
          1. Clement

            I finally decided to scrap using the sparkfun board as I was working towards a tight deadline. I got the Arduino USB host shield, tested the code and it worked fine. For your bar code scanner you might need to make changes to the code and there are libraries for that as well online if you have a look. Hopefully that is a little bit useful. IF you still having troubles let me know then I can have further look

          2. Anisha

            yeah, I gave up on the spakrfun shield as well.
            But because I chose to pick up the Keyes USB shield because it was more affordable!
            The keyes shield seems to be more reliable and I havent had any issues with it apart from the fact that my scanner does not work!!
            I am using a code that is specific for the use of a usb enabled barcode scanner with a USB shield.
            But I cant seem to have the code working. The code seems to work until the void set up segment, because it prints out the ‘barcode ready’ line, but not beyond that.
            I simply can’t tell what the issue is!
            the tutorial I referred to uses the same shield as well and board as well.
            So I find it quite odd that it does not work.
            Would you have any idea what I could be doing wrong? Do you think it might be a library issue or something?
            I sometimes get an error with some funcitons when compiling, but I pull out examples from the shield code and replace those functions and then it compiles! ( for example replacing hid.h with usbhid.h and so on)
            i have been referring to this tutorial : https://www.youtube.com/watch?v=t5gkg645xGE

            if there is anything you can help out with, I would much appreciate it!
            thank you for your time, Sir!

          3. Clement

            Hmm that does sound strange to be honest. Might be worth showing your code so we can try have a look at it incase we can spot the issues

  19. Anisha

    Hi Mr. Sudar,

    I am Anisha. I am currently working on a project wherein I use a barcode scanner with my USB shield.
    I originally purchased a sparkfun usb shield to work with my arduino mega. I followed several tutorials, but to my dissapointment, none of them seemed to work despite both the barcode and the shield being in operational condtion. ( I also checked the intef class, subclass protocols of the barcode scanner and found them to be compatible for USB communication with the shield).
    In desperation, I went ahead and picked up the same exact USB shield found on the website : http://www.electroingenio.com/arduino-en/bar-code-scanner-arduino-usb-shield-2/
    https://www.youtube.com/watch?v=t5gkg645xGE

    Having copied the exact same code as well, I simply do not seem to have it working.
    I really perplexed as to why this is not working.
    My barcad scanner appears to work as it would normally if connected directly to the computer. But when I scan, and after it beeps to indicate it has reach the code, I can’t read the scanned code anywhere.
    My code writes out the line ” Start”, but does not proceed beyond that.
    I am not sure what version my Arduino Mega 2560 is tho ( if this is important at all).
    I did read somewhere that the pins on the mega2560 that enables SPI communication where on pins 50,51 and so on..
    Am i expected to make physical connections using jumper wires from pins 10,11… to these pins?
    I also read a comment on a forum mentioning that we would need to change parts of the Usb.h library,, which I am a bit hesitant to do.
    Would you please be able to help, I’m desperate for help right now.
    Would truly appreciate any help!
    Thanks so much in advance.
    Kind Regards
    Anisha

    Reply
  20. Anisha

    Thanks so much for offering to help, clement

    This is a copy of my code ( Ive used it with an LCD screen)

    From my print line commands, it appears that everything is working fine.
    I just cant seem to get my barcode characters printed out.
    —————————
    #include
    #include

    //#define BOARD_MEGA_ADK

    #define I2C_ADDR 0x27 // <<—– Add your address here. Find it from I2C Scanner
    #define BACKLIGHT_PIN 3
    #define En_pin 2
    #define Rw_pin 1
    #define Rs_pin 0
    #define D4_pin 4
    #define D5_pin 5
    #define D6_pin 6
    #define D7_pin 7

    //};
    // Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.

    #include //Add to Oleg Mazurov code to Bar Code Scanner
    #include //Add to Oleg Mazurov code to Bar Code Scanner
    //#include

    LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
    #include
    #include
    #include
    #include
    #include
    #define DISPLAY_WIDTH 16

    //initialize the LCD library with the numbers of the interface pins//

    USB Usb;
    USBHub Hub(&Usb); //I enable this line
    HIDUniversal Hid(&Usb); //Add this line so that the barcode scanner will be recognized, I use “Hid” below
    HIDBoot HidKeyboard(&Usb);

    class KbdRptParser : public KeyboardReportParser
    {
    void PrintKey(uint8_t mod, uint8_t key); // Add this line to print character in ASCII
    protected:
    virtual void OnKeyDown (uint8_t mod, uint8_t key);
    virtual void OnKeyPressed(uint8_t key);
    };

    void KbdRptParser::OnKeyDown(uint8_t mod, uint8_t key)
    {
    uint8_t c = OemToAscii(mod, key);

    if (c)
    OnKeyPressed(c);
    }

    /* what to do when symbol arrives */
    void KbdRptParser::OnKeyPressed(uint8_t key)
    {
    static uint32_t next_time = 0; //watchdog
    static uint8_t current_cursor = 0; //tracks current cursor position

    Serial.print( (char)key ); //Add char to print correct number in ASCII
    lcd.print( (char)key ); //Add char to print correct number in ASCII
    };

    KbdRptParser Prs;

    void setup()
    {

    lcd.begin (16,2);
    lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
    lcd.setBacklight(HIGH);
    lcd.home (); // go home
    Serial.begin( 115200 );
    Serial.println(“Start”);

    if (Usb.Init() == -1)
    {
    Serial.println(“OSC did not start.”);
    }

    delay( 200 );

    Hid.SetReportParser(0, (HIDReportParser*)&Prs); //Here I change “Keyboard” for “Hid”
    // set up the LCD’s number of columns and rows:

    lcd.clear();
    lcd.noAutoscroll();
    lcd.print(“Ready”);
    delay( 200 );
    }

    void loop()
    {
    Usb.Task();
    Serial.print(“This line can be read on my serial monitor!!”);

    }

    Reply
  21. Clement

    Hi,

    So I have had a look at the code but couldn’t run it unfortunately because I do not have an Arduino board but following it, it seems correct, assuming you have included all the needed libraries. One thing i found though is that u also initialised a USBHub instance which I don’t think you need and it might be using your usb instance for no reason so maybe take that out. And also ensure ur includes are correct.

    you said the setup() function runs correctly yeah?

    Reply
    1. Anisha

      hi Clement!

      yeah, setup works correctly.

      hmm…tried the eliminating the USBhub line, but still behaves the same way
      my deadline is tomorrow! :'(
      thanks anyway man!

      Reply
  22. Adam

    I used my Arduino Mega ADK which has this Usb Host to work with mouse, keyboard etc. Now I have to send some data from my Arduino to computer via USB. Do you have any hints or examples how I should do this? I thith that MX 3421 should be in peripheral mode in this sitation but all exaplmes I saw were for host mode

    Reply
  23. Elizabeth

    Hi,

    I am currently switching over from a MEGA2560 to a Due because I realized I needed a more powerful microonctroller for my functions.
    I am also using a Keyes USB shield with my project. (http://www.thaieasyelec.com/downloads/EFDV521/Datasheet_Keyes_USBHostShield.pdf)
    I have been warned that the Due, unlike the mega operates at 3.3V and am concerned whether my USB shield would work with the Due.
    I am only using a mouse for my project. But having read through some websites, one sentence seemed a bit concerning : MAX3421E is 3.3V device and USB is 3.3V bus. Therefore, it is essential to always have 3.3V supplied to the shield during operation. USB-specified VBUS voltage is 5V; since all bus-powered devices are designed to be powered from 5V, some of them won’t work reliably or even at all from 3.3V. This is especially true for low-speed devices, like keyboards and mice (https://www.circuitsathome.com/usb-host-shield-hardware-manual/)

    I noticed the Due has a 5V pin and am confused as to what its functionality is? Does it serve the same purpose as the 5v pin on a mega? to supply regulated 5v ?

    will I need to make hardware modifications to my shield or need to consider alternative power options?
    Any help is greatly appreciated.

    Many thanks!

    Reply
  24. Pingback: How to make any USB device wireless?

  25. Djilu

    Hi,

    I am currently working on a project where I use USB Shield. I would like to recognize my touch screen.
    Where I have to change code of the USB Shield library please ?

    I would like to use my touch screen on my PC passing by Arduino. So, I tried to recognize my card like a touch screen but now i would to connect my touch screen at the Arduino.

    Sorry for my bad english.
    Thanks

    Reply
  26. MPRCTCL

    I know this is an 8 year old thread, but who knows? Maybe someone will read and answer my question.
    I have the C@H board and am using the USBHost2.0 library. After a lot of work, I got a sketch that works with my bar code scanner and another that works with an industrial controller. Both also work when connected through a hub. When I run the HUB demo sketch, it reports on the hub and both devices including their manufacturers and addresses: hub = Addr:41(1.0.1) controller = Addr:A(0.1.2) scanner = Addr:B(0.1.3). So I feel like I’m about there. WHat I can’t figure out is how to tell each sketch which device to access. In the end, I want to merge the two sketches so I can scan and send values to the controller, but I’m at a loss on how I use the addresses that the hub demo provides.

    Reply
  27. surv

    according to time s of your post, you must be posting this on
    european/asian/euro-asian,
    as to your board, i am not familiar with C@H board, in fact this
    is the first time i heard about it, i did a search on C@H board and
    found next to nothing, can you possibly show the spec+build of
    this board+which ide are you using to program this board ???

    Reply
    1. MPRCTCL

      I’m sorry that I wasn’t clear. I mean the Circuits @ home shield that is mentioned in the OP. Mine was built by HiLetGo and is AISN: B01MTU9OLM and available from Amazon. I’m working with the Arduino Windows ide using the USB host 2.0 library. There are minimal comments in the library, so I’m struggling to figure out how and where to pass parameters through, but since a hub demo utility is included, I assume that the information can be used to direct commands to different devices connected to the hub.

      Reply
      1. surv

        ok, thanks, for the clarification, 2020/06/12 i will try to look into this,
        i use this usb host 2.0 shield for hard drive attachment, so allow me
        a few days to look into it, and it is possible i found nothing, but i will
        definitely try , so take care+stay healthy

        Reply
      2. surv

        my apology for this delayed reply, i have been very busy,
        so, your usb host shield built by HiLetGo and is AISN, is
        identical to mine ( at least in appearance ), and mine
        works perfectly in a totally different function ( hard
        drive) ,
        so i am looking into this:
        https://github.com/felis/USB_Host_Shield_2.0/issues/323
        that described something similar to what you are doing;
        it will take me some time, if you can, check that webpage
        and tell me, whether the problem stated there is similar
        to yours;
        regards
        surv

        Reply
        1. MPRCTCL

          Thank you for your time and effort. That post was new to me and has some interesting information. I have gotten better resolution on my issue. I am using a very similar HID program for the scanner and it is working fine. I use the acm terminal example with slight adjustments with the controller and it works pretty well too. The problem is merging the two sketches. Even before I merge the code, the HID program works with both devices plugged in. The acm terminal works if I plug the scanner in after it is already running, but does not work if I boot with both devices plugged in. The problem is definitely with the enumeration of the acm terminal if the scanner is present on the hub.

          Reply
          1. MPRCTCL

            I narrowed down the problem by doing some logical experiments. It doesn’t work yet, but now I know that the HID program isn’t bothered by the presence of the industrial controller, but the acm program is completely confused if the scanner is attached.

          2. surv

            GREAT !!! well, i am glad , keep going !!! and all the best to you !!!
            bravo !!! bravo !!! bravo !!!

  28. JC

    Hi

    I’m trying to get usb host mini: https://www.aliexpress.com/item/32772731644.html

    I managed to get it working with a Nano. I connected a Xbox one controller. Now, I need to get it working with a mega2560. I follow the exact same connection as I did with nano but this time through a logic shifter since the usb host mini use 3.3v logic it seems. Has anyone got this working?

    Reply
    1. surv

      i have got that usb host 2.0 working on the uno and will be trying it out on mega2560+due( both r3) with an external hard drive, ide i am using is 1.8.12

      Reply
    2. MPRCTCL

      I used the USB host shield along with an Ethernet shield, so I had to play some tricks to make them work together. I no longer have the actual hardware (it was for someone else) but here are my notes on how I connected it to the mega2560,

      “` * Ethernet shield attached to pins 10, 11, 12, 13
      * USB Host connected to pins 7 (SS), 9 (INT), 51, 52, 53, 54
      USBCore.h modified for new SS to avoid conflict with Ethernet SS
      typedef MAX3421e MAX3421E;
      replaces
      typedef MAX3421e MAX3421E; “`

      I can’t be positive without testing, but I believe the USB Host connected to pins 7 (SS), 10 (INT), 51, 52, 53, 54 would work with your Nano code without changes to the USBCore.h file.

      Reply
  29. Pingback: click Here

  30. Aqsa

    Hey. I have got an xbox 360 controller and receiver, both of them are clone. When i connect it with pc it gets connected but when i try to pair it with arduino uno through usb host shield 2.0 it is not pairing. I have also tried enable debugging but is still giving the following error:

    Xbox wireless receiver library started
    You’ll need a wireless receiver for this library to work
    Unknown device connected-VID: 2563 PID: 0575
    XBOX 360 Init Failed, error code: D1

    We also have an original xbox 360 controller and an original receiver, it’s working perfectly fine with arduino and it’s not connecting with pc

    The problem is that we have to connect the clone version with arduino and usb host shield
    Please provide us with the solution

    Reply
  31. Pingback: marketing firm

  32. Pingback: learn more

  33. Pingback: read more

  34. Pingback: more info

Leave a Reply

Your email address will not be published. Required fields are marked *