Saturday, February 8, 2014

Literal USB Stick


Just a quick hack/mod this weekend.  I got a promotional USB Drive during the week and wanted to do something interesting with it.  I was looking for something to hide it in something interesting like a toy car or some Lego, but I'd seen that done many times.  Then I thought, hang on, people call these USB sticks, why don't I create a Literal USB Stick!  This has been done before (link) but I already had the drive and I have plenty of sticks in my backyard, plus buying things is no as much fun!  Here's how I did it.
  1. Select your USB Drive.
  2. Select a stick that is thick enough to fit your USB Drive in.
  3. Cut the stick to the desired length.
  4. Sit your USB Drive on the end of the stick and trace around it.
  5. Plan and mark where to drill your holes to maximise the wood removal and minimise clean up later.  I drilled three 5.5mm holes (see below).
  6. Figure out how deep you need to go and drill the holes.
  7. Cleanup the hole until your USB Drive fits in snuggly.
  8. Optionally silicon in your drive (mine seems tight enough without it for now).
  9. Action Shot!!

A link to my Google+ Gallery is below.

Saturday, January 18, 2014

Raspberry Pi CD-ROM Case

So, I like building electronics into recycled cases and the Raspberry Pi is a good platform for doing this as it is small but has high utility. I have previously built one into a old VHS case to be used as a media centre (Gallery here), but this time I wanted something different.

I have been using a Pi as a headless downloader for a while now that just stores downloads on a USB drive. In future though it'll be writing to network storage so the server will need to be on at the same time as the Pi. Given the Pi is headless I don't care where it is as long as I can access it over a network. So I got to thinking how can I ensure the server and the Pi are on at the same time? Well, if I use the power supply from the server then that would work. But how am I going to mount it inside the case and power it. Well, a CD or DVD Drive has a power connector on it and all the mounting hardware so why not use that! I quick chat with the IT at work turned up an old 52x CD-ROM drive that nobody will ever use again and the project got started!

Step 1 - Pulling it apart
I got lucky with this drive as this was really easy. 4 screws undid the base plate which revealed a PCB. I disconnected the drive mechanism from this and removed the PCB. All I was left with was the mechanism which just unclipped from it's rubber mounts. What I decided to keep was the PCB and the case and toss the mechanism. The PCB is held in by the screws and has the power connector on it so it'll work nicely as a place to mount the Pi. Unfortunately I don't have photos of the dismantling.

Step 2 - Making way for the Pi
I had to think about what connections I wanted access to on the Pi and where to place them on the drive. In the end I decided that ethernet was key and it should be out the back of the drive so the front still looks stock. This has the added advantage of letting me use the USB ports until I get the server running. It also means the front of the drive is free for extra goodies that could be accessed through the drive door.

I hacked away any chips that were in the way and removed the IDE connector from the back of the drive making sure I didn't damage the power connector.


Step 3 - Mounting and Power
I reused the base of the clear case I already had, just drilled some holes and bolted it to the PCB.  Then I carefully cut the power connector from the PCB and soldered wires to the 5V lines and spliced it into a micro usb connector so I could power the Pi.


I then hacked a 5V power adapter to power the drive.  This is only until I get the server running.


Step 4 - Putting the Pi in place and Rear Panel Clearance
Now it was just a matter of putting the Pi in and seeing how much I needed to cut out of the rear panel.


Turned out there wasn't too much to remove and the cuts don't look too bad condering I used a hacksaw, a dremel and a file.


Step 5 - It Works!
From the front it looks like a normal CD-ROM Drive.  In the future I'll see if I can't use those buttons and LED for something!


But the back reveals more.


Here it is working with a USB stick for now.


Here is a link to the Photo Gallery.

Friday, November 22, 2013

The Mx - RB30 Throttle Position Sensor (TPS) Mod

I shall tell this story via a photo gallery, but first an explanation as to why.  I have installed a Megasquirt into my 89' 1.6L Mx5 and by default it ignores the TPS because it is crap.  You see the stock TPS is a switched type which tells you 3 states: No throttle, some throttle, Wide Open throttle.  This doesn't help the ecu much and definitely doesn't help if data logged.  So I needed a new one.  A few forum posts said that an RB30 TPS had an extra connector that would work for what I wanted so I ordered one off ebay.  When it arrived it is quite a bit smaller than the stock one, but the mounting holes do line up with some other holes on the throttle body.  The problem though is the throttle shaft is too long, so I need a spacer.  A few hours in Sketchup and a call to a mate later and I had an adapter printed.

Now to problem two.  The variable signal comes out of a separate connector on the TPS and it is different to the plug on the stock loom.  I could just buy two new connectors, chop up the loom and connect it that way, but that would mean definitely no going back to the stock ecu unless I modified the stock TPS as well.  But then I noticed something.  The hard connector on the RB30 TPS was the same as the stock TPS. I just had to internally re-wire it so the variable signal comes out of that connector.  And that is where the photo gallery begins!

Saturday, November 9, 2013

Continuous Integration Presentation - Part 2

Continuing from Part 1, here is a step by step explaining how to setup Jenkins with MSBuild and Mercurial complete with links!

Assumptions:
  • You are running Windows
  • You already have some flavour of Visual Studio installed
  • You already have NUnit Installed (if not click here)
  • You already have TortoiseHg installed (if not click here)

Step 1 - Install Jenkins
  • Download and Install Tomcat - Link
  • Download Jenkins Zip - Link
Copy the Jenkins WAR into the 'webapps folder of your Tomcat install.  It should be somewhere like this: 'C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps'.  Make sure the Tomcat server is running and then navigate to http://localhost:8080/jenkins/.

Step 2 - Install Plugins
You'll now want to click on 'Manage Jenkins' on the left hand menu, then 'Manage Plugins' from the middle.
On the 'Available' tab you'll want to click the following:
  • Green Balls
  • Jenkins Mercurial Plugin
  • Jenkins MSBuild Plugin
  • Jenkins NUnit Plugin
Then down the bottom of the page click 'Install without Restart'.

Step 3 - Configuring Plugins
Go back to 'Manage Jenkins' and click on 'Configure System' in the middle.  The setup for the Mercurial and MSBuild plugins is pretty much the same, just providing a name and path information.  For Mercurial you need to specify the directory that houses 'hg.exe' in the 'Installation directory' parameter.  For MSBuild you need to specify the full path to 'msbuild.exe' in the 'Path to MSBuild' parameter.

Step 4 - Creating and populating a Mercurial Repository
Create a folder somewhere on your file system.  Right click on the folder, go to 'TortoiseHg' then select 'Create Repository here'.  Click Ok in the next dialog (the defaults are fine), and congratulations you have a repository!  Now create a Visual Studio Solution in this directory with some code in it to compile and some NUnit tests to run.  Now we need to first Add the important files into the Repository and then Commit them.  First of all, right click on the folder you first created, goto 'TortoiseHg' and select 'Add Files...'.  In the next dialog box select everything except bin and obj, you don't need the generated binaries in source control.  Now right click on the original folder again, goto 'TortoiseHg' and select 'Commit'.  Put a message in the next dialog and click 'Commit' in the bottom right hand corner.

Step 5 - Creating your first Build (or Job)
From the Jenkins dashboard click 'New Job'.  Give it a 'Name', select 'Build a free-style software project', and then click 'OK'.  Then setup similar to the pictures below.
Now click 'Build Now' to test and hopefully it will go Green!

Troubleshooting
If your build breaks the main source of information will be the 'Console Output' from the build, and contrasting the paths in your configuration with those in the 'Workspace'.  The Workspace is the place that Jenkins downloads the repository files to and such all paths in the configuration are relative to that.

I hope this has been helpful, Good Luck!!

Continuous Integration Presentation - Part 1

Last week I gave a presentation at the Coders Group on how to do basic Continuous Integration using Jenkins, MSBuild and Mercurial. The slides are embedded below along with a link.



Presentation

Stay tuned for Part 2 which gives a step by step on how to setup the environment and get a build happening on your machine.

Wednesday, June 5, 2013

Clean Code + Unit Testing Presentation

Tonight I gave a presentation with my team mate Klee Thomas on Clean Code and Unit Testing. The presentation was received well and we all had a few stories to tell of some not so clean code.

Below is a link to the presentation slides in my Google Drive and a link to the Github repository with the code used in the Unit Testing part. Feel free to fork the repo and clean up the game of life implementation as I know the code is quite dirty ;)

Presentation

Handout

Repository



Thursday, December 27, 2012

Pedal Board

I got a little bit of money for Christmas this year and decided to buy a new tuner pedal (I got the TC Electronics Polytune Mini).  I decided to use this opportunity to make a change to my pedal board that I've wanted to do for the past 2 years.

My pedal board is based off this case:

And has a false floor covered in carpet:

But before today the lid was always attached which wasn't too bad but made it a little unwieldy when opened.  I've always wanted to remove the lid and attach it with more suitcase clips but never got around to it.  Given I've got time off at the moment I though I'd give it a go.  I bought 4 clips from Bunnings at $6.50 each and proceeded to drill holes and attach them.  This was easy for the part that was attached to the board as I could use long self tappers and they'd be hidden under the false floor.  The lid part I had to attach with the included split pins and work out a way of using a g-clamp and some screwdriver bits to get the split pins split enough.  The whole thing took 3 hours to complete mainly because of this and because I took my time at the start planning.

This is what the lid looks like now:

And here is a close up of the clip:

This is what it looks like with pedals:

I am quite happy with how it turned out and I finally have the pedal board I've always dreamed about!  For more information and more pictures see my gallery below.