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.

18 thoughts on “USB Datalogging With Arduino Using V-USB

        1. Just in case there is any confusion; I have nothing to do with this project.

          Thanks for expanding on my info. I just did a quick search, so the link i got was pretty “random”. Always better to get it directly from the horse’s mouth (no offense ;-)

  1. 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.

    1. I’ve also had problems getting V-USB to work with more modern releases of the Arduino IDE, but it is possible. I’ve written two blog posts that should get you started

      First up we have the Caffeine Button ( which is very similar to the example in this post, ni that it simulates a USB keyboard to send data back to the PC. While this works, personally I don’t think it’s particularly useful as you need to essentially leave the PC alone while the device is running otherwise the key strokes go to the wrong place.

      A better alternative is to implement a lower level protocol for passing data backwards and forwards. In the example I blogged about ( this essentially gives you a bidrectional channel (a bit like the standard Serial lib) for communicating with the device.

      The examples circuits in the above actually show it in use with a full Arduino UNO which is probably a bit silly (given that it has Serial support), but you can definately use the same circuits and sketches in a circuit with a standalone ATmega328P, and I describe how to program one of those in another of my posts:

      Hopefully you’ll find that lot interesting/useful

    1. 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.

        1. “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”.

          1. “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.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.