Email Address:
Password:

Lost your password?

This is the legacy website; please use the new website.

Digital/Analog USB Data Logger

Based on a PIC micro, this simple project can log lots of data to a memory card. It can read from many types of digital and analog sensors and features a real-time clock and calendar to "time-stamp" the data. It has a USB port and comes with a PC host program, allowing you to configure the sensors, change settings and charge the battery.

By Mauro Grassi

USB Data Logger: Main Features

• Uses an MMC/SD/SDHC memory card (FAT file system) for up to 32GB of storage capacity.

• USB full speed (12Mbps) interface for connection to a PC.

• Host PC program for Windows-based PCs.

• Up to six digital sensor inputs with support for I2C (Inter-IC Communications) and One Wire Dallas protocols. Also supports a Full Duplex Serial Port UART (Universal Asynchronous Receiver Transmitter) interface (eg, for connecting a GPS module).

• Up to four analog inputs (two shared with digital inputs) with 12-bit A/D conversion and ±5% accuracy. The analog inputs can also accept frequency signals up to 192kHz or can function as a 32-bit event counter.

• Custom scripting language allows a wide range of different digital sensors to be used.

• Low power consumption (around 1.5mA in standby mode).

• Flexible power options – can be battery-powered (using two AAA cells), USB powered or powered from an external 5-7V DC power source.

• NiMH cells can be trickle-charged using USB power or an external power source.

• An external voltage reference can be connected for greater than ±5% accuracy on the analog inputs.

• Battery protection to prevent over-discharge.

• Includes an on-board Real Time Clock Calendar (RTCC).

This low-power USB Data Logger is useful for a myriad of applications, especially where you need to log data over a long time period. It logs to an MMC/SD/SDHC memory card (with FAT file system), which means you can store up to 32GB of information. That’s a lot of logged data.

The average current consumption is typically less than 1mA and it can be powered using two AAA cells (either NiMH rechargeable types or alkaline). Alternatively, it can be powered from a USB port on a PC or an external 5-7V DC supply.

If NiMH cells are fitted, these will be recharged whenever the device is connected to a PC (via the USB port) or powered from an external DC supply.

The logger can accept inputs on up to eight lines, with a maximum of up to six digital lines and up to four analog lines. Many different types of analog and digital sensors can be used and the digital inputs can also be used for frequency measurement or event counting. It is even possible to connect a GPS (Global Positioning System) module to log geographical coordinates as well.

For storage, just about any MMC, SD or SDHC memory card can be used. They are ideal for this application because they are cheap, reliable, have low power requirements and are available in capacities ranging from 16MB up to 32GB.

Typical applications

A typical application for this device would be to log data from a remote weather station. For example, let’s say you wish to monitor a weather station with humidity, wind speed, rainfall, temperature and barometric pressure sensors. With this device, you can log their values over many days into a CSV (comma separated values) file on the memory card. Then, when you’ve finished logging, you can connect the USB Data Logger to your Windows-based PC and download the file via the USB port.

Alternatively, you could simply remove the memory card and use a memory card reader. The downloaded log file can then be opened using Open Office or Microsoft Excel. From there, it’s easy to graph the readings and analyse them.

Another use involves diagnosing a problem with a car engine. You can monitor the relevant engine sensors and log them while driving, then later analyse the data to locate the problem. You can even log your route if you connect a GPS module to the USB Data Logger.

These are just two examples and there are lots of other uses, including monitoring industrial processes, collecting all sorts of field data, trouble­shooting and testing. We’ve made the logger as flexible as possible by making it compatible with a wide range of sensors.

PIC microcontroller

The USB Data Logger is built around a PIC18F27J53-I/SP microcontroller (IC1). This is an 8-bit microcontroller with 128KB program (Flash) memory and 3KB of SRAM (Static Random Access Memory). It’s a 28-pin device and is well suited to this application due to its impressive list of internal peripherals and low price.

The following peripherals are used in this project: the USB device controller; the integrated RTCC (Real Time Clock Calendar) with separate oscillator circuit; the SPI, I2C and UART serial peripherals; ten output compare/capture peripherals; one of three comparators; the 12-bit A/D (Analog-to-Digital) converter with internal band gap reference; and the comparator voltage reference.

Share this Article: 

Privacy Policy  |  Advertise  |  Contact Us

Copyright © 1996-2018 Silicon Chip Publications Pty Ltd All Rights Reserved