Thursday, December 29, 2016

RB30 TPS to Mazda Mx5 B6 Throttle Body Adapter

Recently there has been some interest in fitting a variable TPS to the 1.6L Mx5.  Like me a lot of people aren't too keen on cutting the TPS shaft and taping the extra holes on the throttle body.  For those people I give you a link to the Google Sketchup files I used all those years ago when I made mine.


  • You will still need a tap for the inner holes (reuse the stock bolts).
  • Slight modification might be needed to get it to fit (see picture below).

Saturday, October 17, 2015

How to read Diagnostic Codes on an Australian Delivered 98' Toyota Camry

The Story

Recently I've been having some trouble with my newest car.  When cold it would have trouble idling and warming up.  While driving there would be hiccups every now and then, jerking the car around.  The worst though was cutting out at lights and not starting straight away.

While these problems are bad, it wasn't a major problem because the engine light would come on during these times which means the car knows what's up!  Easy I thought, I'll just do a quick google search to figure out how to read the cars diagnostic codes and then I'll know exactly what to replace.  Poor foolish me.

The car in question is a  Australian delivered 1998 Toyota Camry Wagon, the base model, 5-speed manual and the 4 cylinder 5SFE engine.  Had I lived in America the car would have had an OBDII port which with the proper bluetooth tool off ebay would have told me everything about the car.  Mine doesn't have one because Toyota Australia decided to neuter our cars in the hope people would go to the dealer if there was a problem.  Some quick googling pointed towards a diagnostic connector under the hood telling me to connect pins TE1 or TE2 to E1 and then the car would reveal it's secrets.  There was a problem though.

When I looked in the diagnostic connector there were no terminals in the spots marked TE1 and TE2.  Grrr...!  Thankfully though paying attention to a random page on the internet and running an experiment has showed me how to read codes on the Australia models.

How to read the Diagnostic Codes

  • Under the hood, near the firewall and on the passenger side (Right Hand Drive cars in Australia ;) ) there is a black plug marked Diagnostic.
  • Open this and locate the TC and E1 terminals.
  • With the car off. Use a plain paper clip or similar to bridge these terminals.
  • Now sit in the drivers seat, close the door, turn the lights off (interior and exterior), fans off, etc...
  • Now under the tacho is the check engine light.  This will flash in a sequence so get ready.
  • Turn the car to ignition, and count the flashes of the check engine light.  If it just continually flashes with no pauses then your car is fine (but I doubt it is otherwise you wouldn't be here!).
  • Write down all the flashes.
  • Now go here: to figure out how to interpret them and what the codes mean (mine ended up being 22 which was a coolant temperature sensor).

Clearing Diagnostic Codes

When googling I couldn't get a clear answer on how to do this and the first few things that were suggested didn't work, but I did find the way.  Once you believe you have fixed the problem, you should clear the codes by:
  • Under the hood, on the far passenger side up against the wheel arch is a long fuse box.
  • In this fuse box locate the 15A EFI fuse.
  • With the car off, pull this fuse out for a minimum of 30 seconds (I did 60 seconds just to be sure).
  • Put the fuse back in and check the codes again (you should see a continually flashing light about 2 per second).
  • If there is still a readable code, try clearing again and leaving the fuse out longer.

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!

  • 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!

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.


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.