Setting Up the Freeduino USB Host Board

Modern Device >>

This is first stab at some documentation for the Freeduino USB Host Board.

Getting your FHB up and running with an Android phone

What you need

  • Android phone
  • Freeduino USB Host Board (FHB)
  • USB A to micro cable – the kind with which you charge your Android phone
  • USB A to mini cable – the kind you may use on your camera – although cameras all seem to use their own variants now
  • Google ADK for Android phones

Getting and installing the software

  • Download and install Arduino if you haven’t done this already
  • The lastest version of the library is hosted at Github
    Just click the “zip” icon for a zipped version of the library
  • Unzip the package. This will yield an Arduino library titled: Freeduino_USB_Host_Board
  • Just move the Freeduino_USB_Host_Board folder into the libraries folder, inside of the folder where your Arduino sketches are stored.
    • If you don’t know where your sketches are stored, check the Preferences page in the Arduino IDE
    • If the “libraries” folder doesn’t exist (it may not), just create it and put the Freeduino_USB_Host_Board inside it.
  • Choose the demo sketch from the menu Examples->Freeduino_USB_Host_Board->FreeduinoHostBoardDemo01
  • Hook up the USB cable to your computer and hook up the FHB
    • You should observe the RX & TX LEDs flash as the board performs “USB enumeration”
    • If you look in the Arduino IDE Tools->Serial Port menu, you should see a new entry that will appear / disappear as you plug / unplug the FHB. The particular name for the serial port will vary by platform (OS).
    • If you don’t see anything appearing in the Serial Port menu, you need to install the FTDI drivers that come in the Arduino package
    • See the Arduino site for how to do this, if it doesn’t happen automatically.

  • Choose Tools->Board->Arduino Uno in the Tools menu to set the proper board.

We might finally be ready to have some fun.

  • Click the Upload icon at the top of the IDE (Its a right arrow that’s second from the right.)
    • If all goes well the Arduino IDE will compile the sketch and upload it to the board
    • You should see the RX & TX LEDs on the board flashing during upload

On to the phone

  • Download and install the Google ADK DemoKit App for Google’s Demo board.
    • We will use the app just to demonstrate connecting with the phone. The whole app is not supported
    • due to the smaller chip (and fewer pins) that the FHB uses.
    • Do not install the Google AndroidAccessory library however. The Freeduino version is a modified copy.

  • Boot the phone and get to the “home” screen. Then plug the phone into the FHB.
  • If all goes well, this should start the DemoKit app
    • Try sliding one of the sliders for LED 1. If the sliders will move (you’ll see yellow underneath),
    • you are connected the FHB.

  • You may need to plug / unplug the phone cable once or twice to get this to work.
    • As an alternative you can try starting the DemoKit app manually. When the FHB connects and DemoKit is open,
    • you should see a new copy of the app slide in from the right side of the screen, then test the sliders
    • to see if they are live.
  • Open the Arduino Serial Monitor (the icon on the top right) and set the serial speed for 57600,
    • at the bottom of the serial monitor. You should be able to observe some serial feedback for debugging.
    • If you connect a 470 ohm resistor in series with an LED from pins 3, 5 or 6 to ground,
    • you should be able to observe the brightness of the LED change as you move the DemoKit LED1 sliders on the phone.
    • Grounding the A0, A1, or A2 pins on the FHB will turn on the button icons in the DemoKit program.

Happy Programming

  • Check back for more detailed docs and pics soon
  • Questions answered on the forum

The post Setting Up the Freeduino USB Host Board appeared first on Modern Device.

Back to blog