Wednesday, February 28, 2018

USB Host Shield for Arduino

USB Host Shield for Arduino to Monitor USB data


Sparkfun has USB host shield that can work with Arduino.
I think this is great for the user who want to monitor USB data during the prototyping phase.
It is also great for my latency test project that I posted previously.
It seems like this is original done by Circuits@Home and it is super great work!
This post will focus on the setup of the tool and hopefully I can use this for other projects that I am working on.

Setup
Software preparation:
Launch the Arduino IDE.
There is library available through the library manager.
To launch the Library Manager, follow this.

Sketch > Include Library > Manage Libraries...

In the Library Manager, there is a search bar at the upper right.
Type "USB host shield" and you will find the library by Oleg from Circuit@Home.
In my case "USB Host Shield Library 2.0", and here is the screenshot  after the installation.










After the installation, restart the Arduino IDE and you can now refer to the example codes using the library from "File" menu.

File > Examples > USB Host Shield Library 2.0

So many examples here!

Hardware preparation:
Before you use this board, you need to solder the header pins so that you can stack the board on top of the Arduino.
Once you connect the board to Arduino, make sure the power switch is ON position and you will see the red LED is on. 


Test

For my test, I just used USB mouse.
Connect a USB mouse to the USB connector on the shield board.
From the Arduino IDE, select the exmaples.
I used USB HID descriptor example.

File > Examples > USB Host Shield Library 2.0 > HID > USBHID_desc

Upload the code to the Arduino.
Then, open the "serial monitor" from the Arduino IDE (small icon at the upper right).
You will see the data read from USB mouse as you move the mouse.




















Done!



                  

No comments:

Post a Comment