Sunday, November 22, 2009

Complete 3D Model of Butterfly MP3

I hope to use this data to do some stress analysis of the case design using CAE Linux and look at geting the case built using SLA or SLS techniques.

The Sketchup model is at

Saturday, November 14, 2009

3D Model AVR Butterfly

I've been playing with Google SketchUp for a while as a free tool for doing electronics enclosure design (ie. MP3 Player cases). It seems quite capable although not really targeted at designs in the mm range. I think I will use a larger scale like 10:1 or 100:1 next time to see if that makes things easier.

Here is my first attempt at an AVR Butterfly model for use in case designs on the data logger and MP3 player. You can download in skp and stl format. To export SketchUp files as STL I have used the plugin from

Stereo Lithography (STL)
SketchUp (SKP)
Image (PNG)

Battery Capacity Logger MkII

A minor update to my battery logger script to tidy up the format of the log file and to make a slightly nicer (maintainable) script file.

# : Log the battery capacity to a file
capacity=`system_profiler SPPowerDataType |grep "charge capacity"`
count=`system_profiler SPPowerDataType |grep "Cycle count"`
echo ${date} ${capacity} ${count} >> ${filename}

This gives a log file output like the following
Sat 14 Nov 2009 13:45:06 GMT Full charge capacity (mAh): 4740 Cycle count: 163

To create the log file in a sensible place like /var/log/ I did the following:

sudo touch /var/log/batterycapacity.log
sudo chmod 666 /var/log/batterycapacity.log

I've also switched to using periodic instead of cron as I can't seem to get cron to work reliably. To make it work with periodic I simply place my script in the directory /etc/periodic/daily/

NOTE: I've had a couple of issues lately with pasting from the web into a script file and finding i get the following error:
No such file or directory´╗┐#!/bin/sh

I've found that this problem is due to binary characters in my text file. I think they are UTF-8 encoded characters that have slipped in from cutting and pasting. To solve this problem I use the command vim -b script. This will load up the file in binary mode so I can see what funny characters have found their way into my file. After deleting the offending character or characters the script functions as expected.

Labels: , , , , , , , ,

Wednesday, November 11, 2009

Battery Capacity Logger

I just replaced the battery in the 2005 ibook G4 today, great to return to the days of 4 hours of use. I decided I'd like to monitor the life of the battery and so wrote a quick cron job script to log the battery capacity every day. I also have installed this on my main laptop which still gives me 3 hours after 18 months of use.

Write the script.
# : Log battery capacity to a file
date >> ~/batteryCapacityLog.log
system_profiler SPPowerDataType | grep "charge capacity" >> ~/batteryCapacityLog.log

Make it executable and put somewhere sensible.
chmod 755
cp /usr/local/bin/

Make sure it is activated daily by adding the following line in crontab using crontab -e which will make it run at 5:10am every day. This time is chosen to not clash with other actions executing should my laptop be awake at 5am and also to ensure it run each morning when I wake the laptop up.

10 5 * * * /usr/local/bin/

The format looks like the following:

Wed Nov 11 20:03:26 GMT 2009
Full charge capacity (mAh): 4859
I may improve the format in the future and add some nice "gnuplot" plots but this gives me the info I want right now. For the record, the outgoing battery was showing a capacity of around 350mAh. This translates to roughly 10-15 mins of use. OS X 10.5.8