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.
- http://codeandlife.com/2012/01/22/avr-attiny-usb-tutorial-part-1/ (primer)
- http://codeandlife.com/2012/01/25/avr-attiny-usb-tutorial-part-2/ (hardware)
- http://codeandlife.com/2012/01/29/avr-attiny-usb-tutorial-part-3/ (software)
- http://codeandlife.com/2012/02/04/avr-attiny-usb-tutorial-part-4/ (wrapping up)
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
Very cool. Thanks for sharing, Stan.
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!
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!!!!
I believe the 32u4 uses LUFA, not V-USB for the usb interface.
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.
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!
Sadly, serial is still much easier to use.
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!
Hi,
Let me share my tutorial on V-USB:
http://www.workinprogress.ca/v-usb-tutorial-software-only-usb-for-mega-tiny/
Regards
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.
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.
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/
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! 😉