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.