Learning to use the V-USB (AVR USB firmware) library

The V-USB library is a pretty handy piece of code that lets you add USB connectivity to ATtiny microcontrollers (it was previously named tinyUSB). But if you’ve ever looked into adding the library to your own projects you may have been stymied by the complexity of the code. There are many examples, but there’s a lack of a concise quick-start for the uninitiated. [Joonas Pihlajamaa] has been working to correct that shortfall with his four-part V-USB tutorial series. It’s not for the absolute newbie; you should already be comfortable working with AVR chips but that’s the only real prerequisite we can see.

He starts the series with a look into the hardware considerations. USB provides a 5V power rail but the data lines expect 3.3V logic so this must be accounted for. With the test rig built on a breadboard he moves on to pick apart the code, covering various user-defined variables that you’ll need to set based on your project’s needs. We’re going to keep this on the back burner and hopefully the Troll Sniffing Rat will get a makeover (although we must say comments have been a lot nicer as of late… keep it up!).

We’ve embedded links to all four tutorial parts after the break.

Comments

  1. Stan says:

    V-USB is very intuitive to use, highly recommeded. There is bit of learning curve, once passed possibilities are endless.

    I did an example project a while back that includes SHT-11 sensor, if anyone interested, it’s available:

    https://github.com/baracudaz/usb-sht

  2. YS says:

    That’s really great! I have already tried to start with V-USB, but it really looked too complicated for kick-start without proper tutorial. Now I hope things will get a lot better and I will finally be able to start using USB in my projects.

    Thank you!

  3. Steve-O-Rama says:

    Perfect timing, yet again. 🙂 I’ve been having an interesting time getting an ATmega32U4’s USB to work as I want it, and this looks like a great help to better understanding how it works, particularly the fourth part of the tutorial. Thanks, HaD!

    And look, no tArduino stuff! 😀 WOOHOO!!!!

  4. macegr says:

    Nice tutorial…have loved V-USB since back when it was AVR-USB and I used it in the Capslocker project. Just this week I set up V-USB on an ATtiny45 as a custom class device, to act as an I2C gateway to a ChronoDot (trying to re-create the Maxim DS3231 live demo). The V-USB documentation wiki is also pretty useful.

  5. macegr says:

    Also, doing USB device interfacing on Linux or Mac is SO EASY compared to Windows. I would say that USB interfacing using LibUSB is actually easier on Linux, in some cases, than RS232!

  6. Drevious says:

    Sadly, serial is still much easier to use.

  7. bob23 says:

    libusb is great for developing, but a PITA for non-technical end users.

    Where possible, I try to make HID or MIDI devices.

    Hardware:
    http://hackaday.com/2011/08/26/dev-board-from-an-avr-programmer/

    Software:
    http://cryptomys.de/horo/V-USB-MIDI/index.html

    Done!

  8. patrick says:
  9. follower says:

    If you are interested in using V-USB with Arduino I ported it a couple of years back:

    http://code.google.com/p/vusb-for-arduino/

    I haven’t checked if it needs to be updated for 1.0 though.

  10. Drone says:

    Those are some loooong wire runs on those breadboards Pilgrim. You sure are lookin’ for trouble there. You’d also do right to add a lot of bypass caps to those power rails.

  11. jokkebk says:

    Thanks for every reader who visited the tutorial, I was really happy to see such interest and hope many found the articles useful! As a thanks, I added a post on turning the project to a USB HID mouse:

    http://codeandlife.com/2012/02/11/v-usb-tutorial-continued-hid-mouse/

    Those are some loooong wire runs on those breadboards Pilgrim

    If you were referring to me then yes, placing ATtiny, regulator/USB circuit and ISP programming header on different corners of the breadboard for clarity made for some long wire runs. Don’t try this at home! 😉

Speak Your Mind

*

Related Hacks in Microcontrollers

  • Morse Code interpreter
  • One wire reads the keypad from the APRS radio mic
  • Level conversion with plenty of options
  • Music visualization generator with a Propeller
  • Metal detection using an inductor instead of a clock crystal.