USB Data Logger

How to add USB pen data logging

If you want to add USB pen drive data logging to your system the Vinculum VDIP1 USB host controller works really well.

There are a couple of places you can get the board, farnell stock them for £13.94.

There are already some good guides on using the board with an Arduino. I found these two most useful. I recommend reading these to start with to get a good idea of how it all works. I've added a couple of things to increase the functionality and get rid of write errors which are documented below.

Guide 1 - Writing data to Usb Memory Stick – by Nick on the Arduino playground.

Guide 2 – Usb Storage and Arduino – by Sven Steinbauer

Additions

Wait for 'ok' response

The Vinculum board is controlled using DOS commands and so every time you send a command if the command is executed successfully the board sends a “D:\> ” response that indicates its ready for the next command. If you try and send commands faster than the Vinculum board takes to execute them and don't wait until after the Vinculum board has sent the “D:\> ” ready for new command response, I found I would get errors in the data stored and it would sometimes crash.

To solve this the arduino sketch code listens for a response from the Vinculum board after it sends each command, if it receives “D:\> ” which I've called the ok response then it can go on to send the next command. If it receives “No disk” it stops trying to write to a non existent disk and waits until a disk is inserted and the start write button is pressed.

Start/stop write button and led indicator

Just a simple start/stop write button. To start writing you hold the button down for 2s and the led comes on to indicate writing. To stop writing you hold it down again for 2s and the led turns off. If the arduino wait for 'ok' response code receives a 'no disk' response. The led is automatically turned off.

Hardware

Vinculum VDIP1 wiring diagram:

Start/stop push button + led indicator circuit diagram:

Layout suggestions

A piece of stripboard to mount the Vinculum VDIP1.

Start/stop push button + led indicator

Installation example in the home energy monitor main unit


Arduino software:

The arduino sketch here works with the board independently of any of the other energy monitor hardware and code. It will just write the values set in the variable declaration to the board as an example.

  1. Download the Data logger Arduino sketch
  2. Compile and upload the Arduino sketch to the Arduino. For a guide on compiling and uploading the sketch to the Arduino have a look here.
  3. Check your Arduino serial monitor for write status. Once you have pressed the button you should see the following output if its all working correctly:

Started
O D:\>
W D:\>
C D:\>
O D:\>
W D:\>
C D:\> 

...

If your getting the above, press the button again to stop writing (you should see "stopped" come up)and check the usb pen to make sure the data is there.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options