Monday, October 4, 2010

Building a Recoverable Developer Computer

I wanted a developers computer that can easily be reimaged to a vanilla XP install at the completion of each project. My main reason for this is due to the fact that control systems software does not always play well with products from other vendors so it is best to start a new project with a fresh install.

The tool I ended up selecting to help with with this task was Parted Magic. This is basically a live cd Linux distribution that includes partitioning and cloning tools.

The computer I performed this setup on originally had one full size system partition with Windows XP installed. What I wanted was three partitions.

  • C: “System”
  • E: “Recovery”
  • F: “Data”

My plan being to store the vanilla XP System image on the Recovery partition where it can be easily restored over the used System partition at the commencement of a new project. The Data partition is the same as is seen everywhere to keep important data separate from OS installations.

The steps I followed.

  1. Download the Parted Magic ISO and burn to a CD
  2. Boot into the Parted Magic environment from the live CD
  3. Use the GParted tool as described on the Parted Magic site to shrink my System partition
  4. Boot back into Windows XP and create the Recovery and Data Partitions. I made the Recovery partition identical in size to the System partition to avoid potential problems with imaging later
  5. Setup the XP system to a state that I want to be able to restore to later
  6. Boot into the Parted Magic environment
  7. Select System Tools –> Clonezilla
  8. device-image
  9. local_dev
  10. sda2 (Recovery)
  11. Expert
  12. saveparts
  13. I used the name “Vanilla-XP-img”
  14. sda1
  15. Agree to default options
  16. Increase the size of image file splits to something large to prevent splitting e.g 51200
  17. Agree to defaults and start

This leaves an image file on the recovery partition that can then be restored to the System partition to get back to a plain “Vanilla” XP install.

The steps to recover a partition from an image are nearly identical to the above, with the exception of selection restoreparts instead of saveparts.

Tuesday, September 21, 2010

P2PU: Drupal Introduction #1

I’ve started two drupal courses through P2PU and want to keep my work on each separated.

To achieve this I need:

  • Two separate drupal folders
  • Two separate drupal databases
  • Two separate virtual sites for apache

I made the first site “drupalintro” in the same manner as outlined in my earlier post P2PU: Drupal Social Web Application #1 with the following changes.

  1. The drupal directory was named /var/www/drupalintro
  2. $ mysqladmin –u root –p create drupalintro
  3. mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupalintro.* TO ‘<drupaluser>’@’localhost’ IDENTIFIED BY ‘<drupalpass>’;
  4. mysql> FLUSH PRIVILEGES;
  5. mysql> \q
  6. $ vim /var/www/drupalintro/sites/default/settings.php
  7. edit:  $db_url = ‘mysql://<drupaluser>:<drupalpass>@localhost/drupalintro’;
  8. $ cp /etc/apache2/sites-available/default /etc/apache2/sites-available/drupalintro
  9. $ vim /etc/apache2/sites-available/drupalintro
  10. edit: DocumentRoot /var/www/drupalintro
  11. edit: Directory /var/www/drupalintro

Now to make the second site called “openhippel” I did the same again with the following changes:

  1. The drupal directory was named /var/www/openhippel
  2. $ mysqladmin –u root –p create openhippel
  3. mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON openhippel.* TO ‘<drupaluser>’@’localhost’ IDENTIFIED BY ‘<drupalpass>’;
  4. mysql> FLUSH PRIVILEGES;
  5. mysql> \q
  6. $ vim /var/www/openhippel/sites/default/settings.php
  7. edit:  $db_url = ‘mysql://<drupaluser>:<drupalpass>@localhost/openhippel;
  8. $ cp /etc/apache2/sites-available/default /etc/apache2/sites-available/openhippel
  9. $ vim /etc/apache2/sites-available/openhippel
  10. edit: DocumentRoot /var/www/openhippel
  11. edit: Directory /var/www/openhippel

Now to change between the two virtual sites I simply use the following (shown for selecting drupalintro)

  1. $ sudo a2dissite openhippel && sudo a2ensite drupalintro
  2. $ sudo /etc/init.d/apache2 reload

Then I can browse to my localhost address and see the home page for the desired site.

Saturday, September 18, 2010

P2PU: Drupal Social Web Application #2

Just finished the first Tokbox session for the Drupal Social Web course. Bit of a bumpy start with the first session starting half an hour late!

I’m starting by forking three repositories from GitHub that will be used for this project. The repositories as I understand them are:

  1. hippel_idea the features package
  2. hippel_kit which will contain drush makefiles
  3. hippelicious a hippel theme

It looks like the idea this week is to make sure we can fork these and edit them locally before commiting, pushing back to our own github forks and sending a pull request to the original repository.

At this stage I will consider it an added bonus if I can make these work in my drupal install…

Technorati Tags: ,,

Wednesday, September 15, 2010

P2PU: Drupal Social Web Application #1

I’ve enrolled in a P2PU course called Drupal Social Web Application. Over the next 6 weeks I’ll be learning how to use Drupal and git while working on development of the Open Hippel platform. Most of this stuff is pretty new to me so I’ll be in over my head. I’ll also be moving house at the same time, hopefully without too much of a no interwebs period. When it rains it pours!

I’ve been getting acquainted with Drupal this week and after some trials with the Ubuntu drupal6 package I’ve opted for the manual installation of Drupal as outlined in the Ubuntu Community Documentation. The manual installation allows me some more flexibility in terms of where I keep my files and which version I use when compared to a package install.

Here is a brief outline of the steps I followed on an Ubuntu Server 10.04 virtual machine.

  1. $ cd ~
  2. $ wget http://ftp.drupal.org/files/projects/drupal-6.19.tar.gz
  3. $ tar zxvf drupal-6.19.tar.gz
  4. $ sudo mkdir /var/www/drupal
  5. $ sudo mv drupal-6.19/* drupal-6.19/.htaccess /var/www/drupal
  6. $ sudo mkdir /var/www/drupal/sites/default/files
  7. $ sudo chown www-data:www-data /var/www/drupal/sites/default/files
  8. $ sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php
  9. $ sudo chown www-data:www-data /var/www/drupal/sites/default/settings.php
  10. $ mysqladmin –u root –p create drupal
  11. $ mysql –u root –p
  12. mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON drupal.* TO ‘<drupaluser>’@’localhost’ IDENTIFIED BY ‘<drupalpass>’;
  13. mysql> FLUSH PRIVILEGES;
  14. mysql> \q
  15. $ vim /var/www/drupal/sites/default/settings.php
  16. edit:  $db_url = ‘mysql://<drupaluser>:<drupalpass>@localhost/drupal’;
  17. $ cp /etc/apache2/sites-available/default /etc/apache2/sites-available/drupal
  18. $ vim /etc/apache2/sites-available/drupal
  19. edit: DocumentRoot /var/www/drupal
  20. $ sudo a2dissite default && a2ensite drupal
  21. $ sudo /etc/init.d/apache2 reload
  22. From the host (or any machine on the same network) browse to “<server ip>/install.php” and follow the web based setup for Drupal
Technorati Tags: ,,,

Tuesday, September 14, 2010

Mount a Windows Share in Ubuntu Server

It is really ease to access a windows share from the console of Ubuntu Server. The following steps were performed on Ubuntu Server 10.04 to access a share on a QNAP NAS with no username or password required.

  1. $sudo apt-get install smbfs
  2. $mkdir ~/temp
  3. $sudo mount.cifs //192.168.0.x/public ~/temp

Now it is possible to cd into temp and ls the contents of the public share.

Technorati Tags: ,,,,

Tuesday, August 31, 2010

Git and GitHub

I recently brought up version control systems at a circuit hacking evening at the Artifactory. Not surprisingly for a room of open source/linux type people almost everyone was in favour of using git. I was even pointed to a youtube video of Linus Torvalds on git which is not a tutorial on how to use git but does provide a good overview of why it might be better than other version control systems. I also found the video quite amusing due to Linus’ famously abrupt manner.

My concern with using git was that I am a windows user and didn’t expect it to work natively with windows. It doesn’t matter how many ways git is superior to other version control systems, if it doesn’t work well on windows it’s not for me.

Fearing that I would be wasting my time I tried out msysgit (git for windows) which includes such goodies as shell integration that allows for a gui or bash interface for managing repositories. It actually turned out to be quite good. The interface is not as nice as TortoiseSVN but the distributed version control nature of git more than makes up for that.

The only way to properly test something like this out is to use it on a real project so I started using git for version control of my BalanceBot project on my laptop.

I don’t like to have anything which is important to me stored in only one location so after checking out my options I started a GitHub account. It’s a safe place to push repositories to and it’s free as long as your projects are open source. There is also a neat Watch function that allows you to track other interesting repositories, kind of like social media for code.

Monday, July 26, 2010

BalanceBot 2

I finally have communication between an Arduino and an ADXL345 accelerometer over SPI!

I used the SPI library from the Arduino playground but was still having trouble so in the end resorted to following the example source code provided by sparkfun for the ATmega328.

The following listing is copied straight from my Arduino environment.

#include <Spi.h>

/*
  BalanceBot
  Read from an accelerometer ADXL345.
  ADXL345 max clock speed is 5MHz, default arduino CLKi/o is 16MHz/64 (OK)
  ***SPI Pins***
  SCK    PB5    13
  MISO    PB4    12
  MOSI    PB3    11
  SS    Any    10
  Ben Caldwell
*/

byte tmp;
byte readData; //The byte that data read from SPI interface will be stored in
byte fifo[6]; //data read for x,y,z axis from the accelerometer's FIFO buffer
float x,y,z; //The ranged x,y,z data
float range; //The range of the x,y,z data returned

// The setup() method runs once, when the sketch starts

void setup()   {               
  Serial.begin(9600);
  Spi.mode((1<<SPE) | (1<<MSTR) | (1<<CPOL) | (1<<CPHA) | (1<<SPR1) | (1<<SPR0));

  Serial.println("Starting Setup");
  //Set SS high, slave disabled waiting to pull low for first exchange
  digitalWrite(SS_PIN, HIGH);
  delay(4000);
  //Wait for POWER_CTL register to go to correct state
  readData = 0x00;
  while (readData != 0x28)
  {   
    //POWER_CTL register: measure
    digitalWrite(SS_PIN, LOW);
    Spi.transfer(0x2D);
    Spi.transfer(0x28); //Measure
    digitalWrite(SS_PIN, HIGH);
    delay(5);
    digitalWrite(SS_PIN, LOW);
    Spi.transfer(1<<7 | 0x2D); //Set "read" MSb
    readData = Spi.transfer(0x00); //Send dummy byte to keep clock pulse going!
    digitalWrite(SS_PIN, HIGH);
    Serial.print("POWER_CTL: ");
    Serial.println(readData, HEX);
    delay(1000);
  }
  //Set FORMAT
  digitalWrite(SS_PIN, LOW);
  Spi.transfer(0x31);
  Spi.transfer(0x08);
  digitalWrite(SS_PIN, HIGH);
  delay(5);
  //Readback FORMAT
  digitalWrite(SS_PIN, LOW);
  Spi.transfer(1<<7 | 0x31);
  readData = Spi.transfer(0x00);
  digitalWrite(SS_PIN, HIGH);
  readData = readData & 0x03;
  switch (readData)
  {
    case 0:
      range = 2.0;
      break;
    case 1:
      range = 4.0;
      break;
    case 2:
      range = 8.0;
      break;
    case 3:
      range = 16.0;
      break;
  }
  Serial.print("FORMAT: ");
  Serial.println(readData, HEX);
  //Set FIFO
  digitalWrite(SS_PIN, LOW);
  Spi.transfer(0x38);
  Spi.transfer(0x00);
  digitalWrite(SS_PIN, HIGH);
  delay(5);
  //Readback FIFO
  digitalWrite(SS_PIN, LOW);
  Spi.transfer(1<<7 | 0x38);
  readData = Spi.transfer(0x00);
  digitalWrite(SS_PIN, HIGH);
  Serial.print("FIFO: ");
  Serial.println(readData, HEX);
  delay(4000);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()                    
{
   //All x,y,z data must be read from FIFO in a multiread burst
  digitalWrite(SS_PIN, LOW);
  //Start reading at 0x32 and set "Read" and "Multi" bits
  Spi.transfer(1<<7 | 1<<6 | 0x32);
  for (int i=0; i<6; i++)
  {
    fifo[i] = Spi.transfer(0x00);
  }
  digitalWrite(SS_PIN, HIGH);
  delay(5);
  //The measurements in the FIFO 10bit 
  x = (float)((fifo[1]<<8) | fifo[0]) * range / 512.0;
  y = (float)((fifo[3]<<8) | fifo[2]) * range / 512.0;
  z = (float)((fifo[5]<<8) | fifo[4]) * range / 512.0;
  Serial.println("********************");
  Serial.print("[X,Y,Z](g): [");
  Serial.print(x);
  Serial.print(",");
  Serial.print(y);
  Serial.print(",");
  Serial.print(z);
  Serial.println("]");
  delay(1000);

}

 

References

  1. The SEN-09156 breakout board:
    http://www.sparkfun.com/commerce/product_info.php?products_id=9156
  2. Sparkfun example code:
    http://www.sparkfun.com/datasheets/Sensors/Accelerometer/ADXL345-talktest.zip
  3. Arduino SPI library:
    http://www.arduino.cc/playground/Code/Spi

Friday, July 9, 2010

Convert DVDs to MKV

I’ve been looking at options for ripping my DVDs to my home NAS that I connect to with a media streamer. Anyone who has ever tried ripping DVDs will know that this can be an overly complicated and often disappointing task.

I recently had the most success to date using a utility called MakeMKV. This utility takes the files in the Audio_TS and Video_TS folders and encapsulates them in a single .mkv file for each title on the DVD.

My WD TV Live plays MKV files perfectly, the quality looks the same as the original DVD to me. For PC playback I was disappointed to see WMP does not play MKV files out of the box, but there are plenty of options out there in the form of codecs and alternative free players.

Tuesday, June 29, 2010

BalanceBot

I decided on a new project while at circuit hacking night at Artifactory last night. In my head it looks something like an unmanned segway…

For the controller I’ll be using an Arduino Duemilanove that I already have, and the accelerometer will be an ADXL345 3 axis accelerometer with a SPI/I2C digital interface. It seemed less than elegant to me to use an accelerometer with analog outputs as a digital signal would need to go through a D/A converter before travelling through a length of hookup wire then through an A/D converter where it can finally be used by my program in the Arduino.

So my first step is going to be getting data from the accelerometer to the Arduino, and not knowing the first thing about SPI or I2C is going to make this a steep learning curve!

I’ve created a BalanceBot library in Eagle and created an ADXL345 device. This should allow me to not only create a schematic for bread boarding but a PCB later if I’m so inclined.

Monday, June 21, 2010

Remove Linefeeds from an Excel Document

I recently received an Excel document that needed to be massaged to suit the requirements of a DCS. One of the changes required was the removal of line feeds from within cells.  There were over 500 rows nearly all with multiple line feeds so I did not want to do this manually.

Some googling revealed an easy way to do this and a cool new tool to try – immediate mode in VBE.

  1. On the Excel worksheet select all cells that may contain a line feed to remove
  2. Open VBE using alt+F11
  3. Enter Immediate mode by pressing ctrl+G
  4. In the Immediate box type Selection.Replace Chr(10),”” In Immediate whenever you hit enter your command is executed.
  5. Go back to the worksheet and all line feeds are removed

Note that the argument for the Chr function is a char code. Char codes are the same as ASCII codes for the first 32 control code characters so line feed is alt+0010 or Chr(10).

References:
http://www.ozgrid.com/forum/showthread.php?t=20451

Monday, June 14, 2010

GanttProject

In a previous post I mentioned that I was looking into open source project management software. I was a little sad to find that most of the software I tried had one glaring oversight or another. The program that I tried initially and then kept coming back to was GanttProject.

The GanttProject features that I use are:

  • Gantt chart
  • Linking (start-finish, start-start etc.)
  • Resources can be created/imported and assigned to tasks. Resource utilisation is calculated automatically
  • Completion tracking on the Gantt chart

This is a simple feature set and by far the best of what is on offer from the open source world for project management.

Tuesday, May 4, 2010

HP Flight Button Fixed with a ROM Update

I’ve been mildly annoyed for the last week with a malfunction of the flight mode button on my HP 6730s laptop. Out of the blue the button started toggling between wifi and bluetooth radios. Pressing the button allowed me to choose between bluetooth or wifi but I could never turn both radios on, or more importantly for flying turn both radios off!

After a short and very helpful online chat with HP support I updated my BIOS and everything is fixed! HP support has been awesome every time I’ve needed it.

Wednesday, April 28, 2010

Creating a WCF Web Service with VS2010 Express

Last night while I was reading up on OPC-XML the interwebs took me on a merry trail of SOAP, XML-RPC and the like that ended with WCF Web Services. I found a very good tutorial on WCF Services at http://www.xvpj.net/2008/03/08/wcf-step-by-step-tutorial/ but this was for Visual Studio 2005. I only have express versions of Visual Studio 2010 so there were some things that needed to be done differently. In the interests of posterity here is how I wrote a very simple WCF web service and a WPF client that accesses it using only Visual Web Developer 2010 Express and Visual C# 2010 Express.

Configure the Development Environment

  1. Install Microsoft Visual C# 2010 Express
  2. Install Microsoft Visual Web Developer 2010 Express installed (you can download all Express editions on one iso image at http://www.microsoft.com/express/Downloads/#2010-All)
  3. Enable Windows features:
    1. IIS Metabase and IIS 6 configuration compatibility
    2. IIS Management Console
    3. ASP.NET
        iis_features
  4. In IIS Manager, under Application Pools right click DefaultAppPool, select Basic Settings then change .NET framework version to v4.0.x
    iis_manager
  5. Install Windows SDK. This can be downloaded from http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en 

Create the Web Service

  1. First we will create the web service. To do this we need to run Visual Web Developer 2010 Express with administrator privileges so hit the start button type in “web dev” or similar and when Web Developer is highlighted press ctrl+shift+enter. This will start it as an administrator and show the UAC prompt. Alternatively locate Web Developer in the start menu then right click and select run as administrator.
  2. Select File –> New web site and choose WCF Service and name it MultiplyService
    new_web_site
  3. Add code App_Code / IService.cs  
    IService
  4. Add code to App_Code / Service.cs
    Service
  5. Run the service by pressing ctrl F5 and click the Service.svc link in the page that opens. Nothing much to see here yet, you need a client to view this data. As indicated on the page you need to run the svcutil.exe utility to generate code that will be used by the client application
    svcutil1

    The svcutil.exe utility is installed with the Windows SDK and can be found at c:\Program Files\Microsoft SDKs\Windows\v6.0a\bin

    To create the Service.cs file on the desktop try the following in a cmd prompt:
    svcutil2 
  6. That ends the WCF service. Leave all of this running, including the internet explorer window that Web Developer opened and open Visual C# Express to start on the client application.

 

Create the Client Application

  1. Start up Visual C# 2010 Express and select File –> New Project. Select WPF Application and name it MultiplyClient.
  2. Add a Service Reference
    service_ref

    In the Service Reference dialog paste in the address from the internet explorer window that web developer opened. Select the service and select OK
    Service_ref2
  3. Copy the Service.cs file on the desktop that was generated by svcutil into the root folder of the project
    add_cs
  4. Add two entry textboxes, a multiply button and a result textbox to the MainWindow.xaml
    mainwindow
  5. Add code to MainWindow.xaml.cs to call the service when the multiply button is clicked
    mainwindow2
  6. Modify the app.config file. Simply change the contract value from “ServiceReference1.IService” to “IService”
    appconfig
  7. Press ctrl+F5 to run the WPF application. Enter two values to multiply and hit the Multiply button, you should see the answer in the result textbox!
    clientapp

 

References

  1. The basic gist of WCF services:
    http://www.xvpj.net/2008/03/08/wcf-step-by-step-tutorial/
  2. Adding IIS features:
    http://www.howtogeek.com/howto/windows-vista/how-to-install-iis-on-windows-vista/
  3. Where to find the svcutil.exe utility:
    http://www.dotnetspider.com/forum/239950-Where-find-svcutil-exe.aspx

Friday, April 9, 2010

OpenVPN on Windows 7

OpenVPNI had some trouble getting OpenVPN to work on my Windows 7 laptop. After a lot of messing around it turns out to be a fairly simple operation, so to save others the messing around part here are the steps to follow.

  1. Download the latest OpenVPN windows installer from http://openvpn.net/index.php/open-source/downloads.html I used openvpn-2.1.1-install.exe
  2. Completely uninstall any previous versions of OpenVPN from your machine
  3. Install OpenVPN
  4. On the start menu right click “OpenVPN GUI” and click properties. On the Compatibility tab select “Change settings for all users” then tick the box “Run this program as an administrator”
  5. This step is not so obvious. Open the network and sharing centre and click on “Change adapter settings”. There should be a Local Area Connection with the type TAP-Win32 Adapter, right click on this and select properties. Tick the boxes next to “Internet Protocol Version 6 (TCP/IPv6)” and “Internet Protocol Version 4 (TCP/IPv4)”
  6. Copy your config and credentials files into the C:\Program Files\OpenVPN\config folder
  7. Now click OpenVPN-GUI in the start menu. You’ll have to enter your Administrator password to run it. When it’s running just right click on the OpenVPN icon in the system tray and select connect

And that’s it! I hope it works for you too, leave a comment to let me know…

Wednesday, March 24, 2010

Open Source Project Management Software

I work for a small business and lately it is becoming apparent that we need some project management software. The budget price at the moment is $0 so to stay legal I’m investigating what options are available from the open source side of the fence.

Our primary business is the development of automation software but the scope of projects often includes managing third party hardware production and procurement. The features I’m looking for in project management software are:

  • Task scheduling
  • Resource scheduling
  • Time tracking
  • Percentage completion tracking
  • Charting – Gantt charts at least

Using the above criteria in a trawl of the web I found the packages Redmine, OpenProj, Gantt Project and ClockingIT. I will follow up with a post on my experience with each of these in the coming weeks.

Thursday, March 18, 2010

The Machines are Breeding

I checked out the Artifactory space in Mt Lawley on Monday night and was really impressed with the enthusiasm of everyone there and the quality of what people are working on. There were a couple of very impressive homebrew CNC machines downstairs and three 3D printers in various stages of completion upstairs including two MakerBots.

MakerBotOne of the really exciting things being built here is a RepRap or Replicating Rapid Prototyper. This is essentially a 3D printer that is capable of producing components that can be assembled to make a replica of itself, a concept that is both liberating for makers and incredibly scary at the same time. This ability to rapidly create new and improved generations of 3D printers using the current generation will ensure rapid improvement in this technology over the next few years.

The 3D printing process is something akin to a hot glue gun being controlled by a robot with 3 axes of movement. A long plastic extrusion (I’m told the plastic is the same stuff as Lego is made from) is fed into a heated extrusion head which squirts a very thin trail of molten plastic in layers to build up a 3D object.

RepRapThe white plastic component pictured here was printed on a 3D printer and is currently mounted on a RepRap that is under construction. The designs for these components are made freely available on the web allowing anyone with the time and inclination to get started on 3D printing.

One of the most interesting stories I heard at Artifactory was that a 3D printer being used to print a referee whistle – with the pea inside! This design was published on the web and within a very short period of time had been reproduced at several locations around the world. Something very significant to come from this event was the fact that the whistle was printed in places quicker than it could have been shipped there. If this concept was developed sufficiently we would have something approaching teleportation possible for printable objects.

I will definitely be heading back to Artifactory soon to catch up on what’s been happening with the RepRap and maybe even get my hands dirty with a bit of 3D printing this time.

Wednesday, March 17, 2010

Wind Down

I went for a windsurf at Scarborough last night and sadly it feels like the season is winding down and we’re heading into that time of year where we have marginal winds and early sunsets.

I’ve decided not to mothball my windsurfing gear completely this winter. I’ll try for a sail every few weeks so I don’t go backwards too far before next summer. The swell is much better in winter but the wind can be difficult so I’ll be trying out a few new spots to see how they handle the prevailing onshore storms or early morning easterlies.

I’ll probably keep the spots a secret though…

Thursday, March 11, 2010

My New Arduino

To my horror I recently turned 30. The experience was sweetened significantly by some great and thoughtful gifts, one of these being an Arduino Starter Kit.

It literally took me fifteen minutes from opening the box to playing a touch sensitive musical instrument that I built using a Softpot in a resistive divider and a magnetic buzzer. I was able to reuse the code from an example that comes with the Arduino environment, just modifying the frequency range I wanted the buzzer to work in. The code from the example Arduino sketch shown below is C and uses some very user friendly libraries for Arduino specific functions.

/*
  Pitch follower
Plays a pitch that changes based on a changing analog input circuit:
* 8-ohm speaker on digital pin 8
* photoresistor on analog 0 to 5V
* 4.7K resistor on analog 0 to ground
created 21 Jan 2010
by Tom Igoe
http://arduino.cc/en/Tutorial/Tone2
*/

void setup() {
  // initialize serial communications (for debugging only):
  Serial.begin(9600);
}

void loop() {
  // read the sensor:
  int sensorReading = analogRead(0);
  // print the sensor reading so you know its range
  Serial.println(sensorReading);
  // map the pitch to the range of the analog input.
  // change the minimum and maximum input numbers below
  // depending on the range your sensor's giving:
  int thisPitch = map(sensorReading, 0, 1000, 50, 3000);

  // play the pitch:
  tone(8, thisPitch, 10);

}

The open source nature of the Arduino hardware and software allows amazingly rapid realisation of a project. The hard work done by others previously can be used as customisable building blocks, which can then be shared for use as the building blocks of the next project.

We live in exciting times!

Wednesday, March 10, 2010

BabelFish

A colleague recently recommended using BabelFish as a data historian after viewing it in action on an oil and gas site.

I’ve only had a quick look at the website but based on the features listed here and described to me by the colleague I think BabelFish bears a detailed review, which I will post here if time and trial versions permit.

Tuesday, March 9, 2010

Pathping Command

I’ve just discovered a new windows command line utility called pathping today. I’m a bit of a purist and hate installing extra utilities to use from the command line so I was happy to see that this one was included with my Windows 7 Professional installation.

This command produces something similar to the output from both the ping and tracert commands but if you are prepared to wait for the data collection period it provides statistics of each node based on data collected over that time.

This is the output from pathping google.com:

Tracing route to google.com [66.102.11.104]
over a maximum of 30 hops:
  0  ######### [192.168.0.5]
  1  192.168.0.1
  2  nexthop.wa.iinet.net.au [203.59.14.16]
  3  te7-1.per-qv1-bdr1.iinet.net.au [203.215.4.18]
  4  gi15-1-1.syd-ult-core1.iinet.net.au [203.215.20.4]
  5  as15169.sydney.pipenetworks.com [218.100.2.97]
  6  66.249.95.232
  7  64.233.174.242
  8  syd01s01-in-f104.1e100.net [66.102.11.104]

Computing statistics for 200 seconds...
            Source to Here   This Node/Link
Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
  0                                           ######### [192.168.0.5]

                                0/ 100 =  0%   |
  1    5ms     0/ 100 =  0%     0/ 100 =  0%  192.168.0.1
                                0/ 100 =  0%   |
  2   22ms     0/ 100 =  0%     0/ 100 =  0%  nexthop.wa.iinet.net.au [203.59.14
.16]
                                0/ 100 =  0%   |
  3   20ms     0/ 100 =  0%     0/ 100 =  0%  te7-1.per-qv1-bdr1.iinet.net.au [2
03.215.4.18]
                                0/ 100 =  0%   |
  4   81ms     1/ 100 =  1%     1/ 100 =  1%  gi15-1-1.syd-ult-core1.iinet.net.a
u [203.215.20.4]
                                0/ 100 =  0%   |
  5   81ms     0/ 100 =  0%     0/ 100 =  0%  as15169.sydney.pipenetworks.com [2
18.100.2.97]
                                0/ 100 =  0%   |
  6   76ms     0/ 100 =  0%     0/ 100 =  0%  66.249.95.232
                                0/ 100 =  0%   |
  7   79ms     0/ 100 =  0%     0/ 100 =  0%  64.233.174.242
                                0/ 100 =  0%   |
  8   82ms     0/ 100 =  0%     0/ 100 =  0%  syd01s01-in-f104.1e100.net [66.102
.11.104]

Trace complete.

I had to wait 200 seconds for these results but they are pretty comprehensive. The link looks pretty good – only one packet lost on the hop between Perth and Sydney.

Thursday, February 11, 2010

Flood Gates

Things have been crazy busy at work for the last few weeks. My phone has been ringing non stop and there is often a line of people standing next to me with requests.

When I am in this situation my natural tendency is to hurry to try and get through everything that needs to be done and satisfy the queue of people. My observation this week has been that this is absolutely counterproductive. Hurrying has caused some stupid mistakes on my behalf that I would normally not make. In fact when relating one experience to a good friend who is close enough to be brutally honest he chastised me with “you should know better”.

So what is the answer? For the next week I will be making a conscious effort to improve my “flood gates”. When work piles up and everyone wants something from me, rather than scramble to compress the time that everything takes to please everyone I need to take a moment to prioritise then let a manageable trickle through the flood gates.

Engineering is a tricky thing that requires concentration and time, it is not something that should be done when in a rush. I have a queue of people at my desk because people are happy with my work, I can’t then let the pressure of that queue cause the quality of my work to drop.

Tuesday, January 5, 2010

Finished Longboard Repair

By the way, that longboard repair I was working on earlier turned out quite well. Here is a quick follow up for Brenden, so far the only confirmed reader of this blog…

2009-08-09 11.58.19

Once the divinycell repair was cured and sanded back to a smooth uniform surface I masked off the board with newspaper, found some (sort of) matching spray paint from the Repco shop down the road and went to town.

After a few previous failures painting surfboards I decided to spray the paint directly onto the foam then glass over the top. I had some concerns that a layer of paint between the foam and the glass would weaken the bond and the end result would have less strength, but it does  looks as though this is what is typically done in surfboard construction. This might be a good argument for buying unpainted boards though….

After spraying a number of very thin coats of paint, in fact heaps of white coats of paint to cover up the dark coloured divinycell, I applied resin and a couple of layers of glass. After squeegeeing out the excess resin I left what looked like a very neat repair to cure. But when I came back to my horror there was a large air bubble. It seems that there was a small void somewhere in the divinycell which heated up during curing and blew a bubble under my glass. Arggghhh!

2009-09-18 16.10.27So, next step was to drill a couple of small holes in and around the bubble then syringe in a brilliant two part expanding urethane foam I have in the shed. About 20ml of mixed foam completely filled the hole plus about 2 litres of whatever buckets I could find to contain it! After curing, I sanded back and applied another glass and resin patch to my glass and resin patch.

So after sanding this final patch back with increasingly fine grades of wet and dry sandpaper I have the fairly pleasing result shown here. Not as neat as I would have liked, but not too bad considering!