Battery Voltage Recorder

From Wiki
Jump to: navigation, search

Overview

This device is intended to record battery voltage over a long period of time. A scenario would be a lock installed on a door, and desiring to record the battery voltage on a regular and continuous basis.

The BVR contains a MMC/SD card, typically 1GB. At a 100ms recording interval, this would provide approximately 621 days of recording time ((2^30 / 2) / (10 * 60 * 60 * 24 )). A 16GB card would be able to record approximately 27 years worth of data (however, it's unlikely the batteries would last long enough).

The BVR has two switches, a record/stop switch that determines whether the BVR is currently recording or stopped, and a mass/comm switch that determines the role the BVR will play when connected to a USB host.

Files on the MMC/SD card are named as YYYYMMDDhhmmss.txt, where 'YYYY' is the year, 'MM' is the month, 'DD' is the day of the month, 'hh' is the hour, 'mm' is the minute, and 'ss' is the seconds that the recording was started at. When the BVR exits a reset condition (typically be replacing the batteries), the starting date will be 1970/01/01 00:00:00. The date may be updated by using the comm commands, detailed below.

When plugged into a host USB port with the record/stop switch in the 'stop' position and the mass/comm switch in the 'mass' position, the MMC/SD card will appear as a removable media mass storage device (MSD) with a drive letter. Files may be copied and/or deleted from the MMC/SD card. Setting the mass/comm switch to the 'comm' position will cause the MSD to disconnect, and a virtual comm port (VCP) device to be created. ProComm or another terminal program may then be used to connect to the BVR to set the date and time, format the MMC/SD card, query the firmware version, and other miscellaneous commands.

Switch Behavior

USB R/S Switch M/C Switch Mode
Connected Stop Mass MMC/SD appears as mass storage device
Connected Stop Comm MMC/SD appears as serial port device
Connected Record n/a No action
Disconnected Stop n/a If a recording session is in progress, it is stopped
Disconnected Record n/a New recording session started, recording starts


  1. The MSD/VCP will not appear until the switch has been moved to the 'stop' position.
  2. Changing the comm/mass switch will cause the BVR's role to change to selected position.
  3. Once connected and the switch has been seen in the 'stop' position, further R/S switch changes will be ignored.
  4. If the switch is in the record position when the USB cable is disconnected, a new recording session will immediately start.
  5. When disconnected, moving switch from 'stop' to 'record' will start new recording session.

LEDs

USB LED Color On Duration Off Duration Condition
Connected Green Continuous n/a MMC/SD card present, connected to host PC
Connected Red Continuous n/a MMC/SD card not present, connected to host PC
Disconnected Red Continuous n/a MMC/SD card not present or write-protected
Disconnected Red 10ms 1990ms Recording, operating normally, low battery
Disconnected Green 10ms 1990ms Recording, operating normally

Commands

Command Parameter Effect
version (none) Display current version number
settime YYYYMMDDhhmmss Set RTC to date/time specified
gettime (none) Display the current date/time
interval [period] Set/display sample interval[1]
dir (none) Display the contents of the root directory of the MMC/SD card
format (none) Format (erase) the MMC/SD card
free (none) Display the MMC/SD card total size, space remaining and space used


  1. The period may be expressed in milliseconds, seconds, minutes or hours. Valid values for milliseconds are 100ms, 250ms, and 500ms. Seconds are a whole number, optionally followed by the letter 's', i.e. '30' and '30s' are both 30 seconds. Minutes are a whole number followed by the letter 'm', i.e. '9m' for 9 minutes. Hours are also a whole number, followed by the letter 'h', i.e. '4h' for 4 hours.

Features

  • USB 2.0 connection to PC
  • Battery powered
  • 10+ bit ADC resolution
  • Programmable interval recording

Parts

Manufacturer Quantity Part # Description Source Datasheet Notes
Fairchild 1 FDC602P P-channel FET Digikey PDF Measurement
ON-Semi 1 NSR15DW1 Schottky Diode Digikey PDF Measurement
Bourns 2 CRT0805-BY-1002ELF 10K resistor Digikey PDF Measurement
Microchip 1 PIC18F46J50 Processor Digikey PDF

Odds & Ends