Temperature monitoring with TEMPer USB thermometer
I like monitoring/graphing data, so I picked up this $10 TEMPer v1 [amazon text=USB thermometer&template=amazon search] from China for a DIY weather station. It is currently measuring the temperature outside my window.
The device is detected out of the box in Ubuntu Linux:
[89921.774619] input: RDing TEMPer1V1.4 as /devices/pci0000:00/0000:00:12.2/usb1/1-1/1-1.1/1-1.1:1.0/input/input18
[89921.775505] hid-generic 0003:0C45:7401.0009: input,hidraw0: USB HID v1.10 Keyboard [RDing TEMPer1V1.4] on usb-0000:00:12.2-1.1/input0
[89921.784326] hid-generic 0003:0C45:7401.000A: hiddev0,hidraw1: USB HID v1.10 Device [RDing TEMPer1V1.4] on usb-0000:00:12.2-1.1/input1
It still needs software to actually read data from the device. A suitable driver can be found here: https://github.com/petervojtek/usb-thermometer
git clone https://github.com/petervojtek/usb-thermometer.git
cd usb-thermometer/
make
Run as ./pcsensor
I needed something that would output in Collectd format, so I made some modifications, adding calibration and Kelvin output just for fun: https://github.com/standard-error/usb-thermometer
New options are:
-k output only in Kelvin
-o offset (in Celsius) added to all temperature readings
-g[n] output for data collection/graphing tools (0=mrtg, 1=collectd)
offset is a floating point number added to all readings for calibration, it can be negative.
In collectd.conf, I run like this: `
`
Probe is stated by vendor to be waterproof. I added some heat shrink just to make sure.
As for accuracy, it seems acceptable. Comparing to UK Met Office readings it is usually +/- 1 C, which is good enough for me.
RH Electronics MyGeiger Geiger counter review
A Geiger Counter is perhaps the ultimate geek toy, but the price of commercial devices such as the Gamma Scout have always been too high for me. Recently prices have been coming down as Fukushima mania subsides and sellers dump excess stock. A number of DIY kits have also appeared, tying in with the Raspberry Pi and Arduino market.
Enter RH Electronics “My Geiger”, a ~$50 DIY Geiger counter kit. This is an Arduino compatible PIC16F876A based device with graphic LCD and TTL serial output for data logging.
The kit can be ordered either unassembled or (mostly) assembled. I chose the assembled option as it does not add much cost. The package arrived just over a week later (priority mail from Israel). No instructions are included in the box but a link to the website provides a PDF manual. Even with the assembled version a small amount of soldering is required - three switches and an (optional) LED, but this is very basic stuff. You’ll also need to make an enclosure, for this a Dremel tool or similar is needed to cut holes for the LCD/switches/USB port.
The quality of the PCB and soldering is high.
The tube clips are designed to accommodate an SBM-20 or STS-5 Geiger–Müller tube, although any 400V tube can be used. I went with the slightly cheaper STS-5 from Ukrainian seller “any-devices” on Ebay.
Power and connection options are numerous: USB TTL - power (5v) and data USB (type B) - power only - but data is possible by soldering TTL module RX/TX to USB socket. NiMH batteries: 4.8v (4xAA) LiPo: 3.7v 5V DC adapter Other output options are Arduino (interrupts via ARD pin) and Geiger bot
Input voltage range is given as 3.7V - 5.5V. Stated minimum battery capacity is 1000 mAh, but 4xAAA 850 mAh works fine for me.
TTL serial output. The CPM figure is output every 10s.
The heart of the device is an 8-bit PIC16F876A MCU. The display output consists of CPM figure (10s moving average) with meter, dose reading in (micro)sieverts per hour (needs calibration to have any meaning - and the firmware allows this) and tube voltage. The firmware is closed source and no binaries are available, so no customisation is possible. External controls are only three buttons and a power switch. The buttons are speaker on/off, backlight on, and the top button is to enter calibration mode. Power switch is for USB or battery, it has no effect when TTL 5V is used.
Maximum reading is given as 500000 CPM. Luckily, I don’t have a source that will get anywhere near this. The highest count I have seen is from “fiesta ware” fragments held directly next to the tube: ~7000 CPM vs background here in south west England of ~20 CPM. An ionisation smoke detector gives readings of ~70 CPM externally.
Overall I’m pleased with the RH Electronics MyGeiger. I now have a fully functioning Geiger counter at half the price of even the cheapest commercial devices. My only complaint is that the firmware is proprietary. This is definitely a negative compared to similar kits, so I hope they will consider releasing the firmware at some point.
[youtube http://www.youtube.com/watch?v=mphglGKLTtI&w=560&h=315] Testing device with uranium glazed pottery.
Manual extraction/installation of .ipk packages on Gargoyle/OpenWrt
Occasionally it may be necessary to install a package manually on Gargoyle/OpenWrt firmwares due to bugs or incompatibilities preventing automatic installation. Here’s how to do it.
An .ipk file is just a regular tar/gz archive so we can extract the contents with tar. In this case I’m installing the Network UPS package on Gargoyle:
cd /tmp
wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/nut_2.6.5-2_ar71xx.ipk
tar zxpvf nut_2.6.5-2_ar71xx.ipk
This extracts three files: ` ./debian-binary ./data.tar.gz ./control.tar.gz `
data.tar.gz
is the file we want. To install to the router simply extract the files to root:
cd /
tar zxpvf /tmp/data.tar.gz
And you’re done. Keep in mind that many packages will have dependencies and you’ll have to install those yourself (manually or through opkg) if you want the software to work.
Simple web based system monitoring on Ubuntu Server
After switching my NAS box to Ubuntu Server I decided I wanted a way of monitoring the system remotely from a browser. Previously I had used MRTG but being short on time wanted something more “plug and play”. The box only has 512MB memory so resource usage is important.
The solution I chose is a combination of Collectd, Lighttpd and Collectd Graph Panel. Collectd has low resource usage out of the box and with a few tweaks can be even better. Separating data collection and graph generation means I can easily change the frontend in the future if required.
How to install and configure:
sudo apt-get install collectd
sudo service collectd start
sudo apt-get install lighttpd php5-cgi php5
sudo service lighttpd start
Enable cgi and php in Lighttpd:
sudo lighty-enable-mod fastcgi fastcgi-php
sudo service lighttpd force-reload
Install Collectd Graph Panel:
cd /var/www/
git clone https://github.com/pommi/CGP.git
Graphs should now be available at http://hostname/CGP/
To reduce CPU usage on the server you may want to enable client side rendering:
sudo nano /var/www/CGP/conf/config.php
Find the line:
$CONFIG['graph_type'] = 'png';
and change it to:
$CONFIG['graph_type'] = 'canvas';
This gives nice mouse scrollable/zoomable graphs but doesn’t work so well on mobile devices. Also there are other useful options there like page autorefresh and graph size you can configure.
Collectd has many plugins available. The configuration file is /etc/collectd/collectd.conf Enabling caching in the rrdtool plugin will reduce cpu and disk usage, at a cost of memory (and data will be slightly delayed): `
` Restart collectd after editing collectd.conf:
sudo service collectd restart
The final result: