USB Datalogging with Arduino using V-USB


Adding USB functionality to your Arduino projects used to be a pain, but thankfully, the V-USB project came along and gave your ATMEGA328 the ability to control the USB lines directly and mimic simple (low-speed) USB peripherals. [Ray] shows an implementation of the V-USB project by logging the status of the Arduino’s I/O pins to an open Excel spreadsheet

V-USB (Virtual USB) is especially useful for those of us who build standalone Arduino projects with the ATMEGA328. Unlike the Arduino Leonardo and its ATMEGA32U4, the ATMEGA328 does not have a built-in USB controller. The circuit required to tie into the USB lines is made up of just a few basic components, and [Ray] provides a reference schematic and BOM to get you started. The Arduino is programmed to mimic a keyboard, so the datalogging is achieved by allowing the Arduino to ‘type’ the data into an open Excel spreadsheet. In this example, the status of 8 digital pins and all 6 Analog Input pins are logged.

For those of you who prefer the PIC microcontroller and are in a similar position of not having a built-in USB controller, there is the 16FUSB project to help you out.


  1. aegip says:

    Awesome! Now you can log state of your toilet doors with a simple ATmega. Great hack!

  2. Squirrel says:

    Okay, having the pinout on top of the chip is genius, if you ask me

  3. Lord Nothing says:

    never been able to get v-usb to work. though i think it was more window’s fault than anything.

  4. tekkieneet says:

    I used V-USB for a couple of projects with my own code from scratch (i.e. No Arduino etc) and they work fine. I am using Win7 X64+libusb and use Vendor Specific commands only. I am using external crystal with ATmega8.

    Win7 X64 is strict about non-complaint stuff like bulk transfer at Low Speed, so CDC won’t work without mucking around with unsigned drivers.

  5. Gregg Levine says:

    And the other problem is that the code was written for a release of the Arduino IDE that has been superseded. That’s right it wants 15 or 16 of the product, and most of us have gone ahead and installed release 1 and later ones.

  6. matt says:

    So using someone elses library in its intended use is now a hack? Whats next, a article on someone writing a Hello World project for a Arduino?

    • mh says:

      Using someone elses electronic parts for their intended purpose to build a working device is now a hack?…

      I think the “what is a hack” has been covered enough before. do you have to keep asking? Search the archives. And let newcomers to the arduino have a recent post about V-USB to Excel over USB logging.

      There might even end up being good info in the comments on more advanced subjects to move on with.

      You can also skip articles when you see the title and think its beneath you.

      • James Stoffel says:

        Well said @MH. In fact I pulled a couple of links that I had forgotten about just in the comment section alone!

        • mh says:

          “in fact” usually means “i just made this up” ;-) But thanks for your support.

          It is like when people complain that a hack is too simple or “everyone knows this”. as if there are never new people joining or different levels of skills, or even value in an alternative explanations of the concepts (i personally do not like video-posts, but i understand many people really enjoy them. other people might not enjoy my prefered way which is reading long detailed (boring?) texts). I think we have all tried looking for a solution to some problem and every guide on the subject out there except one hard-to-find one is omitting the one detail we needed – often because it is “obvious”.

          • TacticalNinja says:

            “It is like when people complain that a hack is too simple or “everyone knows this”. as if there are never new people joining or different levels of skills, or even value in an alternative explanations of the concepts”

            It’s like a quarrel between an old timer who got used to film photography, and a kid who calls himself a photographer for having a DSLR camera.

          • mh says:


            What? you and your subject do not have the patience for a handpainting? Kids these days! :)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,345 other followers