Once upon a time, I became interested in monitoring power usage of certain appliances and devices in my dwelling. In particular, the water heater and refrigerator. I wanted to be able to monitor their power consumption over a duration of time and knew I needed some sort of data recorder. I could purchase one but the better ones with 10 or 12 bit ADC accuracy were expensive. The lower priced ones seemed a bit underwhelming in feature as they were very basic. And yes, there were a few projects on “the net” at that time, even more nowadays. However, there was one thing they lacked and that was some sort of programmability.
Since I was very heavy into further enhancing AttoBASIC, I decided that it would be very easy to modify AttoBASIC by adding specific commands to support a data recording device. After all, I had recently added a real-time counter and “data recording to external EEPROM” features that would suit this project’s purpose very well.
What I came up with is the AVR Data Recorder, which is a versatile programmable device that can, among other things, be used to capture and store analog data for retrieval at a later date.
The programmability of this device is due to the AttoBASIC V2.xx interpreter with specific language extensions for use with the AVR Data Recorder. The interactive ability of AttoBASICmakes it easy to set up individual channel gain and attenuation levels, print measured ADC values when writing, debugging, data capture and recording programs.
AVR Data RecorderAlthough this project was completed mid-August of 2012, I have decided to post it in a more accessible location. The project can be found hereon AVRfreaks.net as well. Note that AVRfreaksrequires a free account to access its content.
I will post a series of blog entries to document the design and fabrication starting with it’s features.
Features at a glance- Processing core is an ATMEL ATmega328p running at 8MHz.
- Versatile; can be used as a stand-alone data capture and recording device or connected to a USB serial console for real-time display and capture of data.
- Portable; Internal Li-Ion rechargeable battery runs up to 14 days on a single charge.
- Two (2) channels of analog input;
- 8-bit analog resolution (9.8 mV / bit @ 1x gain, post-attenuation).
- Each channel is bipolar (+/-) with respect to ground, reading is positive only.
- Software selectable input attenuation for a range of 2.5volts, 25 volts and 250 volts.
- Software selectable input amplifier extends sensitivity to 250 millivolts per channel.
- One (1) channel of True-RMS reading, software selectable between either analog channel (post-attenuation).
- Current sensing input with a range of 0 to 250ma, 0.5Ω series resistance, externally extensible.
- Analog comparator input;
- Comparator source is software selectable between dedicated input with fixed 0 to 25 volt input range or either analog channel (post-attenuation).
- 8-bit programmable reference.
- Digital output for control of external devices;
- Open-drain “low-side” N-MOSFET solid-state switch with 175 mΩ “on” resistance can switch up to 60 volt loads with 1.5 amps of continuous current.
- DDS (direct digital synthesis) for toggling at a specific frequency (1 Hz resolution, 1 Hz minimum frequency).
- Digital temperature and humidity sensor
- 64K bytes of internal data storage capability in non-volatile memory.
- Pre-programmed “out of the box” to record a 24-bit time stamp and both analog channels every 60 seconds for data recording up to 218 hours.
- “Data” LED indicates data file access.
- Programmable;
- Uses AttoBASIC programming language, a Tiny-BASIC with an enhanced hardware-orientated command set.
- Programs can be saved in internal non-volatile memory for execution.
- Switch-selectable “self-start” feature enables immediate user program execution upon power-up or an interactive (command prompt) mode for test, measurement and programming.
- Programmability creates a stand-alone intelligent capture device with decision-making and basic data manipulation capabilities.
- AttoBASIC features;
- User programmable using BASIC-like command syntax.
- 8-bit data handling with 26 variables.
- Arithmetic, logical and relational operators allow manipulation of data before storage.
- 32-bit Real-time counter for time-stamping of data in resolutions of 1 ms, 10 ms and 100 mS.
- Extensions to language for direct control of the internal hardware, including the on-chip analog-to-digital converter, gain settings for each analog channel, analog comparator, analog comparator’s DAC reference generator, MOSFET digital output and the internal non-volatile “data file” storage memory.
- Direct data file access allows data dump in ASCII text CSV format for importation into EXCEL™ and other data-processing applications. Number of data fields per record is user programmable from 1 to 255 fields.
- USB interface via Virtual Communications Port supported by all major operating systems (WINDOWS™, MAC OS-X™, and Linux).
- Internal boot-loader allows AttoBASIC updates or user-custom application software to be uploaded to the AVR’s internal FLASH memory.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.