Computer Data Logging

These are really inexpensive ways of getting data into a PC, typically under $30 or even free.
I will put projects in reverse order of age, with the really obsolete stuff at the bottom.

Dataq to Excel Spreadsheet with Macro uses lines to make plots from data taken every 50 seconds for 24 hours (1728 points). Start macro at 30 seconds until 0:00 UTC to avoid a retrace line. Set rate to .02 Hz when asked. Other rates may be set and the total time to fill the spreadsheet will be 1728 / rate, in seconds. (1728 / .02 = 86,400 seconds or 24 hours)

New Dataq to Excel Spreadsheet with new Macro that takes data every 10 seconds for 24 hours (8,640 points). Use points to make the plots on your graphs to avoid retrace lines. The large number of points will give relatively smooth curves. Set rate to 0.1 when asked by the new macro. Other rates may be set and the total time to fill the spreadsheet will be 8640 / rate, in seconds. (8640 / 0.1 = 86,400 seconds or 24 hours)

These files are Excel spreadsheets with macros that can read a DI-148U from Dataq and enter the data into columns. (Run the macro from the "tools" menu.) The first 8 columns have data from the 8 inputs and there are 8 plots scattered around the spreadsheet - just delete the ones you don't need, or put them on other sheets.

The ninth column has the time the measurement was made. There are cells for inputting gain and offset for each channel to scale the data for the graphs to get desired units. The macro records data in a 24 hour loop, determined by the rate and number of samples. The first spreadsheet records 1728 data points and the second records 8640. The time axis on the graph is a little hard to set up because the indexing amount to get the right number of minutes per row is a strange number (basically 1/number of divisions. For a 24 hour plot with time printed every 2 hours, that would be 1/12  or .08333333 for the major axis, and 1/24  or .04166666 for the minor axis). Set the sample rate to use up the number of points in the desired time. For example a sample rate of 0.02 Hz (50 seconds) will use up 1728 points in 24 hours and a sample rate of 0.2 would fill the same number of points in 2.4 hours - the time axis of the graphs may be changed accordingly to display the data in the best format.

The DI-148U became obsolete within weeks of my buying it - that's always how it goes for me! Anyway, the macro is fairly easy to understand and it should be straightforward to modify it to work with their newer products, like the DI-145. It has four channels instead of eight, so a little modification of the macro is in order. Hopefully, it is clear what I did, but I'm open to questions. I used a sample macro from the Dataq website as a guide to make this macro, so I'll be the blind leading the blind, if you need help.

I use this macro to generate my online charts. Microsoft Excel makes the chart, A 1X "magnifier" written with AutoHotKey selects the chart, Irfanview captures the image in the magnifier every five minutes (your choice) and saves it to a local Dropbox folder, and Dropbox makes the image available to my website. Rube Goldberg would love it.

You may wish to build a Meter/ Data Acquisition Amplifier for your Dataq device. I'd use a 74HC14 in place of the CD40106 for a little more current, and use a low-power quad op-amp to make a four-channel version for the DI-145.

Note: Using the 1X magnifier with Irfanview is a nice way to capture portions of any application automatically with clean boarders. For example, you could size the magnifier to capture a small portion of a security camera's window and automatically save that little view to a folder every few minutes. It basically lets you automate the custom rectangle capture, where the rectangle is defined by the magnifier. The view could include more than one window, too. Remember to click on the magnifier's title bar at the very end so that it has the focus. I typically drag it over to another monitor to get it out of the way. To show you a typical result, I'll use the technique to snap an image of the corner of my current screen:

That's the entire image that was automatically saved by Irfanview, and it will keep saving that area until I stop it. In Irfanview, select options/capture screenshot.../Foreground window - Client area/Automatic - time delay (your choice) seconds/Save captured image as file: and fill in the blanks. Start the magnifier, size it and move the cursor to capture the desired area. The folder will start filling up with captures. It can also overwrite a single file, if desired - that's how I make the live plot - just don't include any sort of indexing in the file name.

AutoHotkey Scripts for Serial to PC data transfer

If any of this sounds hard, it's my wordiness - this is really easy to get working.

Here's a zipped folder with a couple of AutoHotkey scripts. The .exe versions will run without any other software and the .ahk versions require AutoHotkey (but then they can be edited). These programs receive serial data, say from a PicAXE microprocessor, or anything, really, and send the data to any program, in the case of the "any" versionr or to an Openoffice.org spreadsheet in the case of the "calc" version. The "calc" version attempts to open an openoffice.org spreadsheet and then waits for you to "save as" to start. (Don't Forget to "Save As" or it will just sit there!) The "any" script prompts you with a pop-up window, giving you a few seconds to click where you want data to go, and will let the external device send data to any program, blindly - it just starts typing!

You will need to know what serial port your device is using. To start, hook your serial device to the computer, typically a USB device or USB adaptor, then go to "Devices" and see what COM port was assigned, and remember that port. (If you are using a PicAXE, you can also discover the COM port by running the PicAXE editor and selecting "options" then "serial.") Run the script and answer the questions. If you are using a PicAXE's programming serial port, set the baud rate to 4800 and leave the other settings as-is.

PicAXE and other serial devices have a short list of "commands" available in the script for navigating the spreadsheet, and these are easily modified or eliminated by opening the .ahk file using AutoHotkey:

My script "hijacks" three direction symbols, replacing them with the desired navigation commands for the spreadsheet.   The "up" arrow is replaced with "ctrl-home" to go to the first cell, the left arrow with "home" to go to the first cell in a row, and the right arrow with "tab" to jump one cell to the right. I  did that to make the PicAXE programming easier. Those 'if' statements could be easily stripped or commented out from the .ahk version of the script, if the symbols are needed for some other application. The PicAXE editor recognizes "CR" and it is unmodified by the script. It is used to drop down to the next row in the spreadsheet. A description of the function of these altered characters in an openoffice.org spreadsheet appears when the script runs.

This can be a cheap setup! If you buy a simple PicAXE, make your own programmer (two resistors, basically), and buy a cheap serial to USB converter, this just might be the cheapest way to get data from your experiment directly into a spreadsheet or other program. I think I could start from scratch and do the whole task for under $15. And, the spreadsheet has all sorts of features for making pretty charts and graphs, not to mention embedding the data into documents.

Here's a little PicAXE program that sends 3 columns of numbers for 20 rows, then starts over - just for testing out the system. In your project, those variables would contain data, instead of a sequence of numbers. There are comments in the listing that explain how it works. Here's how to use it:

bullet

Install Openoffice.org on your computer, if you don't already have it.

bullet

Plug the PicAXE serial cable into the computer, go to "Devices and Printers" to learn what COM port was assigned to the serial interface (or select "options" and "serial" in the PicAXE editor).

bullet

Load the PicAXE program into a suitable PicAXE chip.

bullet

Close the PicAXE editor program so that it releases the COM port.

bullet

Run the AutoHotkey .exe script on your computer, using 4800 for the baud rate and using the COM port you discovered for the serial interface.

bullet

Select "save as" in the spreadsheet and the data should start to appear. You might have to say whether or not to write over an existing file, if one already exists.

The "any" script is similar in function, except that you click on "start" then quickly click where you want the data to go, perhaps in a cell in a spreadsheet or on a page in a text editor. (You don't have to be quick if the serial device isn't sending data yet.)

Notice that you program the PicAXE over the serial cable, then it immediately starts sending data back over the same connection! It does mean that you have to close the editor or the spreadsheet so that they don't compete for the same port. Don't worry, the computer will remind you.

By the way, I purchased a few different serial-to-USB adaptors, typically costing $6 on Amazon, and all but one worked fine with the PicAXE processors. (I like the blue-green ones. : )  I think the one that didn't work complained of not having enough power to run the PicAXE. Even a really old one was recognized by Windows 7, and worked great.

Keyboard Wedgie takes 10 bit data and types it directly into a spreadsheet. The "deluxe" version features some "fun" ideas.

This device simulates a keyboard and could be used with just about any operating system or computing device. A drawback is that the device requires the complete attention of the computer; it will start typing data into whatever application has the focus. It's great for dedicated setups, where installing software is out of the question. I use mine all the time because I can simply plug it into any computer and off I go. You will need to "gut" a keyboard to get the PCB.

Serial Port A/D  - 12 bits, no power, cheap!

Here's a cute but obsolete way to use an old serial port's handshake lines to get data into a Windows 98 and earlier computer. The circuit toggles a 12 bit counter, driving a 12 bit D/A, and uses a comparator to detect when the D/A output passes the input voltage. It works really well, but good luck getting Qbasic to run!

24 Line Parallel Interface for the PC (or just the schematic)

This is a really old parallel port for the PC, back when Windows 3.11 was all the rage.