Logging Station v1

index

The larger project tries to log many variables into a common database and further on do different analyses on these data.

Table of Contents

1 Intro

The following describes as a first step towards this aim the setup of a sensor logging station using an ASUS WL-HDD 1 with openwrt 2 (whiterussian) and an arduino 3 ATMega168 board.

2 Setup

The setup consist of a number of different elements which are described in turn.

2.1 sensor board

this board is pretty simple at this stage of the project. For temperature measurement a Philips KTY81/210 silicon temperature sensor is used in a voltage divider arrangement, with R1 = 100KΩ . The resulting voltage is fed through an amplifier to scale the signal into the full 5V range of measurement provided by the atmel microprocessor.

logging station v1/logging station v1 sens01.png

qucs file is here

The photo sensor (BPW21) is used in reverse bias at the arduino's 5V voltage level, thus acting as one half of a voltage divider, the other resistor being a 100K trimmer, set to 44kΩ. This signal is used without amplification so far, due to problems with the inverting amplifier. In a couple of tests, the BPW21 could easily generate enough current to cover the range of measurement, so it would need to be scaled down. At the moment the trimmer is set to an empirical value.

The board is enclosed in a black plastic box with a window for the photo-sensor. A ribbon cable goes under the closed window into an RJ45 socket, 3m of CAT5 cable break out into the arduino analog input pins 0 and 1. Noise collected during tranfer is ignored so far.

There is a third sensor connected to the system, situated on a different board, this board is based on descriptions on the digitemp 4 site. It's measuring inside temperature and logging is done via the digitemp program.

logging station v1/31032009424.jpg


logging station v1/31032009425.jpg


2.2 arduino setup

The atmega is programmed to read the analog input pins 0 and 1, where photo- and temperature sensors are connected every 30 seconds and transmit the values over the serial link. Code can be found here with a makefile. Use

make

followed by

avrdude -p m168 -P /dev/ttyUSB0 -c stk500v1 -b 19200 -F -u -U flash:w:logging-avr.hex

to upload the program to the arduino.

logging station v1/31032009426.jpg


2.3 openwrt setup

The WL-HDD has been flashed with a current whiterussian pre-fab image with the flash.sh script provided (using the tftp method), since i couldn't get the USB hotplugging to work with either 2.4 or 2.6 based kamikaze images. Generally, the WL-HDD seems to work a bit smoother with the whiterussian image anyway. I removed all the networking, firewalling and router stuff, installed kmod-ide-core, kmod-usb-serial-pl2303 and -ftdi and libusb (for digitemp). After that, USB devices show up in /dev/usb/tts/ as 0, 1, …

Now only digitemp and a custom serial reading program need to be compiled and installed. i put both apps und build_mipsel in the whiterussian build directory and set the makefiles from there, basically by setting CC = ../../staging_dir_mipsel/bin/mipsel-linux-gcc at the top of digitemp-3.6.0/Makefile.

Reading data from serial and printing to stdout is done via these files: log-avr.c, makefile or makefile.mipsel. Use the mipsel makefile for building the thing for the wrt box.

Additionally i am using these init scripts to mount the harddrive, and start the loggers along with this crontabfile.

The conversion applied to the measured 10bit integers might be a bit off due to various factors like using a linear approximation for the KTY's characteristic curve, using ideal values for the other components, ignoring temperature drifts, etc.

3 Todo

Footnotes:

1 http://usa.asus.com/products.aspx?l1=12&l2=44&l3=0&model=460&modelmenu=1

2 http://openwrt.org

3 http://www.arduino.cc

4 http://www.digitemp.com/documentation.shtml

Author: Oswald Berthold <opt@xdv.org>

Date: 2009-03-31 16:49:02 CEST

HTML generated by org-mode 6.21b in emacs 22