Friday, 10 May 2019

On-board Data Logging


Since last year, I have wanted to implement an on-board data logging system for the bike for a number of reasons.

  1. On-board logging would mean all trips could be data logged automatically without needing to consciously connect to the ECU and start logging.
  2. Logging the engine data as broadcast via CAN-Bus would enable logging at a higher frequency than is available through the RS232 connection. 50Hz vs c.15Hz
  3. The CAN-Bus data broadcast from the ECU also gives access to far more data channels than are available to log via RS232 which includes many very useful diagnostics channels and calculated channels which I feel really should be included in the RS232 data stream such as injector deadtime.
  4. Having data log capabilities external to the ECU opens up the flexibility to add more data inputs either via CAN-Bus or analogue inputs. These could be additional engine sensors that are not currently required by the ECU to run the engine (oil pressure, oil temperature, EGT) or else they could also include chassis data such as brake pressure, GPS & IMU data, wheel speed, etc.

I found that most units on the market that would log CAN-Bus data were just too expensive for my needs so decided to use the opportunity to build on my existing skills and build my own.
I decided to use the Teensy 3.2 development board as the heart of the logger mainly due to the on-chip CAN-Bus interface but also because of its small package size and ease of programming via Arduino IDE.

The circuit layout and PCB design for the Teensy including the peripherals needed was relatively straight-forward. I was familiar with the CAN-Bus interface on the Teensy from other projects and, as a MicroSD socket and coin cell holder were the only other major components required, the physical aspect of the logger did not take long to complete.

Modelled Assembly

PCB Layout



PCB Board

Assembled Board

While the physical aspect was completed quite quickly, the software side of things took a bit of time to get to a state that worked well enough. While I was familiar with the CAN-Bus reading aspect, I had not had any experience with logging data to an SD Card so I went through a few iterations of code before settling on an approach that worked.
As I do not come from a software/coding background, any of my microcontroller projects always start with existing code that does something similar to or a particular aspect of what I want and then modify it to my needs.

The software workflow is relatively simple. On power-up, the microcontroller would read the date & time from the RTC and create a new data file on the SD card using the RTC timestamp in it's filename. This ensures unique filenames are used and makes the data easier to manage later.
Once the file is created, the controller reads any data contained in the CAN-Bus recieve buffer and adds it to the appropriate position in a data struct. At defined intervals corresponding to the desired logging frequency, the data contained in the struct is written to the SD card. In between writing the data to the SD card, the controller cycles through reading the CAN-Bus buffer and passing the recieved data to the struct as quickly as possible.
The cycle of data read & write is continued until power is removed from the module (i.e. ignition off). This does mean that there is the potential to lose some data not written to the card on power down but the period spanned by the lost data is unlikely to be more than 2-3 log intervals and is deemed acceptable for the purposes of the project.

Software Main Loop Basic Workflow

Writing data to the SD card was very straightforward as long as the number of parameters and logging frequency was kept low but problems started cropping up when more parameters were added to the datastream and the rate was pushed higher than c.10Hz.

I began by wanting to log data to a human readable .csv file on the SD card purely for convenience. However, with the number of data channels I wanted to log I ran into issues with SD card write latency at write speeds above c.10Hz which was causing me to lose a number of data points every now and then while the program waited for the SD card to finish writing. I could help the issue by adding data to a single long data string and then writing that to the SD in one go. However, the data string took up too much memory with the number of channels I was trying to log so it was not really a viable option. This also didn't completely eliminate the issue.

In the end, after experimenting with minor changes to the same basic method, I opted to write the data to the SD card in binary format and then post process the data after it had been downloaded from the SD card to create human readable .csv files with headers.
By writing the data in binary format, I was able to use a C struct to contain the data variables which was much easier to update within the software and also very easy to simply write the entire struct to the log file whenever it was needed. It also seems to have made the SD write latency issues disappear. I have not yet verified data frequency consistency over a long period of time and at higher logging rates at the time of writing but I have verified writing over 60 data channels to the card at 20Hz for several minutes without any loss of data. While logging directly to .csv file, I was getting data inconsistencies even with only 10off data channels and 10Hz logging rate.

The post processing script was written in GNU Octave which is an open source alternative to Matlab. The script is written in a way that it reads information about the C struct (variable names, units and precision) from a text configuration file so that it knows how to interpret the binary data. The script then reads the raw binary file, arranges the data into a matrix which matches the configuration file input and writes the processed data matrix to a .csv file along with header lines that define the channel names & units. The necessity to have a configuration file which matches the logger C struct means that I need to be particularly meticulous when it comes to documenting changes to the logger software and I need to have good version control.

Version 1.0 of the logger software & post processing script leaves some room for improvement but I am happy that I have an easy to use and reliable datalogger that I can fit to the bike and use while I work on further improvements.

Some improvements which I have in mind are:
  1. Remove the CAN message processing from the Teensy software and log raw message values. The post processing script will be capable of doing the data conversion as well as the binary to decimal conversion. Removing the processing from the logger just means that I can free up some processing power & main loop time to help increase reliability at higher data rates. Logging single bytes also will have the advantage of reducing the size of the struct as it currently pads variables out to the largest precision value (32-bit float). If all variables to be logged are full CAN message data sizes (64-bit) there will be no need for any additional padding.
  2. Add one or more data buffers to the logger software. This should help logging reliability and increase the potential logging rate by not requiring the SD card to be ready for writing on each data write loop. 


I 3D printed an enclosure for the board in ABS plastic. The case is not fully sealed as I have left a slot in the side to allow me to remove & insert the SD card without opening the case.

To complete the logger connection to the bike, I made up a short adapter harness which is sleeved & booted at the connector end. The adapter harness is then cable tied to the PCB board via 2off small slots which I had cut in the board for this very purpose. This just serves to provide some strain relief for the header pins & socket. I also printed a wire seal from TPU as an experiment to help seal the area where the harness exits the case. I also added a label to the harness to identify the module. Because.... well... it looks nice.

Bike interface connector

Adapter harness in position

Case with cable seal

Monday, 6 May 2019

Making an Exhaust Silencer

It has been quite a while since I updated this! Apologies. I need to be more diligent in posting updates.


During my last track day of 2017, the exhaust silencer on the TSR system suffered a mild failure where the perforated tube broke off from the main body and dropped down into the link pipe.

I treated this failure as a perfect opportunity to get a new silencer for the bike. I had thought that the silencer that came with the TSR system looked tired and was also too long to suit the look of the bike.

Naturally, option #1 was to purchase a ready made exhaust silencer from an aftermarket supplier and do a straight swap. Unfortunately, I found that the entry diameter for the TSR silencer is not very common (45mm) and while it was possible to purchase a direct fit silencer from one or two aftermarket manufacturers, all the exhaust designs were either far too short or had far too large an exit diameter to suit my taste. I did not want the silencer to look like a race style or a stubby.

Option #2 was to request one of the UK-based exhaust manufacturers to make a silencer with a bespoke entry design to suit the TSR link pipe. This seemed like a good route to begin with but as the design progressed, it became clear that the entry pipe design would be compromised by an external diameter change to allow the manufacturer's standard tooling to fit. The silencer would have had a swaged neck in the entry pipe which I felt would have looked unsightly on the finished product.

Option #3 was to attempt to repair the original silencer myself. I found a local supplier from whom I could purchase carbon tube in the correct diameter (also not standard) as well as the perforated tube and packing material for reasonable cost so the decision was made to have a go at doing it myself.

The optimum aesthetic length of the silencer was chosen by applying some basic photoshop "skills" to a photo of the bike and I decided to reduce the silencer length from 450mm to 350mm. This made the silencer look much more in proportion to the rest of the bike in my opinion but without making it look like a short stubby silencer.

Original
350mm
300mm
250mm 



When the old TSR silencer was dismantled, a few items stuck out as needing to be changed.

  1. The rivet holes in the old end caps had been damaged so most were oversize. To provide a better surface for the rivets to hold on to, a new strip of stainless steel would be added inside the end caps
  2. The old perforated tube was smaller than the silencer entry diameter and was only tack welded to the end cap in 2 places. It was also not supported at the exit end of the silencer which allowed it to vibrate and eventually break the tack welds and fall down into the link pipe. I sized the replacement perforated tube to be nicely supported on the exit end. As this still left the diameter of the perforated tube smaller than the entry diameter, I flared the end of the perforated tube to match and welded it fully around its circumference.
  3. The sleeve of the TSR silencer had been riveted directly to the end caps. I wanted to add rivet straps at each end both to provide a barrier between the rivets and the carbon sleeve and to provide a decorative finish to the silencer.

First the silencer assembly was modelled in 3D to ensure all parts fit as intended.


Modelling the exhaust assembly allowed me to get the rivet straps just right. The profile was laser cut from stainless steel sheet and bent into shape.

The perforated tube was flared and welded to the entry cap.

 The silencer was first dry assembled using clecos and test fitted to the bike.

Then the parts were riveted together.

And the packing material added.

Overall, the repaired silencer looks much better in my opinion and makes for a cleaner look than the old TSR silencer. The sound from the exhaust is not significantly different from before so that is a plus. There are a few things I would improve on or do differently if I was to do the job again but I am happy with the end result.


Tuesday, 16 January 2018

Rear Shock & Track Sessions

I just realised that I never updated this blog in the later half of last year so I owe it to people now even if it is a few months late coming.

Since the last update, I haven’t done a lot more with the EFI side of things other than improve the cold starts.

I ended up doing two more track days on the bike in 2017 which were in the dry so I could really see the areas which needed improving on the bike.
The first track session was carried out with the same setup as I had run in Mallory Park in February 2017. This session highlighted that the back shock was way underdamped and also a little undersprung. (not that I didn't know that already) I also felt I lacked just a little bit of drive out of corners but felt that was mostly my own fault for not being spot on with my gears.


After that first track session, I made the following changes to the setup

  1. Installed new custom rear shock
  2. Set up front and rear preload to my weight with the new shock
  3. Installed 54T rear sprocket for slightly shorter gearing


I had purchased a Nitron rear shock some years back supposedly designed to fit the mc22. When I came to fit it, it became clear the top mount was too large and fouled the frame. Nitron advised the frame would need to be ground down to make the shock fit which I was not willing to do. I made several enquiries in the years that followed to try and find a proper replacement shock for the basic and now tired stock unit. Penske were the only other company that listed a shock to fit the mc22 but that had the same issue as the Nitron. The issue was actually worse as their top mount was larger and so would need even more material ground from the frame. I approached BG Motorsport, my local Ohlins dealer, some time back about building a custom shock specifically to fit the mc22 with my requirements built in and they were quite happy to relieve me of some cash to build a unit for me.

The shock was completed at the end of June and I must say I was very happy with how the whole package turned out. The entire assembly including the remote reservoir fits nicely under the stock fairings making it quite discreet.

Rear Shock Installation - RH Side

Rear Shock Installation - LH Side


From the get-go, the improvement the shock made to the handling was obvious. Even without making any adjustments, the bike tracked the road much better and felt much more stable on the road compared to the stock unit.

After setting the preload on the front & rear to my weight, this improvement just got bigger.

I also installed a 54T rear sprocket on the bike to get slightly shorter gearing. This was the shortest I could go while sticking with the standard 428 pitch chain. I may look into the 520 conversion in the future to give me more gearing options.

On the second track session after the above adjustments were made, the difference in handling was night and day. I am extremely happy with the way the bike handles now compared to the stock setup. I do have a few more items on the wishlist but these are things that will get done over time.

I have been playing around a bit with some software that overlays data from the ECU onto video which seems to work quite nicely. The GPS data was captured from a smartphone so it is not very accurate and lags a bit. That just affects the track map and lap times really. Still, it makes it very handy to review the video and get an idea of what the bike was doing when.


Wednesday, 1 March 2017

EGT Instrumentation & Dyno Calibration

EGT Instrumentation

To try and close out the base fuel & spark calibration once & for all, a deadline of mid February was imposed by booking a track day at Mallory Park. That provided some additional incentive to get the bike on a dyno in January to do the base calibration.

First, a few small loose ends on the electronics side needed to be tidied up. One of these was to try and implement EGT measurement to provide a second metric to determine optimum fuelling and make sure exhaust port temperatures were under control.

Initially the plan was to simply read EGT values and display them on a screen live and then keep an eye on them while running the bike on the dyno.

However, there would be several advantages to being able to feed the data into the ECU so that it could be logged with all other engine parameters. Unfortunately, due to the limited I/O capacity of the Microsquirt ECU, the only way of getting four additional data streams into the ECU would be via CAN-Bus. That meant using a microcontroller to read the EGT data from thermocouple amplifiers, arrange the data into a CAN message in a format that the Microsquirt could read and load the message onto the bus. 

To prove the concept, an Arduino Uno and CAN Shield were used to get the data processing & CAN code working together properly. The Megasquirt CAN-Bus protocol was the most difficult part of the task as it is quite different from the standard 11-bit or 29-bit header protocol that I am familiar with.

Once the hardware and code combination was proven, a single PCB was designed and manufactured which used an Arduino Micro as the controller and contained the thermocouple amplifiers, CAN controller, CAN transceiver and other peripherals that were required to make the board work on the bike. The finished board is quite large due to being conservative about component spacing to allow hand soldering of components and only used one side of the board for component placement. For future PCBs, component spacing could be tightened up, a dual layer PCB and a microcontroller with inbuilt CAN controller could be used to significantly reduce the board footprint. 
A protective case for the completed board was 3D printed.

EGT CAN-Bus Module Board
Cased Board

On the instrumentation side, 1.5mm K-Type thermocouples were installed as close to the exhaust ports as possible using compression fittings without interfering with the fitment of the radiator or making exhaust fitment difficult. The small diameter probes would allow shorter temperature stabilisation but at the expense of thermocouple life. This was determined to be a reasonable compromise as the main purpose of the thermocouples was to monitor temperatures during dyno runs and short road tests only. As they would not be used for long term control, durability was not deemed critical.

Thermocouple Tip Position In The Exhaust
Thermocouples & Flanges In Place


Exhaust Header Flange Upgrade

While the exhaust was removed for drilling & welding, the opportunity was grabbed to rectify the much annoying issue of the exhaust header flanges bending while the nuts were being torqued up on the studs.

The problem with the Honda design is that the flanges do not clamp between the nut and the cylinder head but rather the flange is designed to be clear of the cylinder head when fully torqued up so the flange has a tendency to bend around the header collar as the nuts are being torqued up. This may not be an issue if the specified torque was always adhered to but on both sets of headers I have owned (OEM & TSR), the flanges had been bent previously. Bent flanges mean that more preload on the stud is required to achieve the same torque which only amplifies the issue and risks stripping the threads in the cylinder head. The studs also bend as the nut tries to sit flush with the flange which can make removing the flanges difficult.

To try and combat this issue, a new set of flanges were laser cut from 316 stainless steel plate. Compared to the TSR exhaust flanges, the new design uses thicker material (8mm vs. 6mm) and also adds c.2mm of material around the outer profile. These changes have the effect of making the new flanges approx. 3 times more resistant to bending at their weakest point compared to the TSR flange.

Exhaust flange comparison, Redesign (left) vs. TSR (right)


Dyno Fuel Calibration

With the EGT instrumentation in place it was time to get the bike on the dyno and complete steady state fuel calibration.

The dyno was an eddy current braked dyno which allowed any speed and load to be held for a period of time to ensure engine conditions could stabilise at each calibration point. The only downside was that as it was a car dyno designed for much higher power vehicles, it was impossible to hold the engine at the lower speeds and throttle angles. Therefore only the area above 4,000rpm & 10% throttle angle could be successfully mapped. As this represents the area where the majority of riding is carried out then that was not much of a problem.

After the fuel mapping was carried out, an attempt was made to see if there was any additional power to be had in the ignition timing. The bike seemed to be very insensitive to part throttle, steady state ignition timing changes although this can be very difficult to judge on a chassis dyno, especially one with quite high inertia.

A few full throttle pulls from 8,000rpm to 16,000rpm were carried out with varying ignition timing to determine what effect it had on engine power. Baseline timing was the Bluefox ECU timing. It was found that a global timing offset of -2° produced a negligible change to engine power. Both +2° & -4° global ignition timing offset produced measurable power losses across the engine speed range. Given that the Bluefox ignition map is c.1.5° more advanced than the OEM Honda curve in that region, it suggests that Honda did a pretty good job of mapping the engine to MBT timing from the factory.

For anyone who cares about these things, the final figure on that particular dyno was 37 bhp measured at the rear wheel at 14,700rpm. No gains over the standard bike were expected with EFI and given the engine is in an unknown state of repair, it was considered a reasonable result. The bike was never dynoed before the EFI conversion and even if it had been, the comparison wouldn’t have been possible on the same dyno and therefore not comparable.

It became apparent from studying the power & torque curves was that the original 18,000rpm rev limit is totally unnecessary as power drops off quite sharply after the peak. A graph of driving torque in each gear shows that there is no point in going faster than 16,000rpm in any gear as, above 16,000rpm, there will be more torque available in next gear up. As such, following the dyno testing, a soft limit at 16,500rpm and a hard limit at 16,700rpm was imposed with the aim to shift up at 16,000rpm.


Calibrating The Bike On The Dyno

The dyno run completed base fuelling & spark for a given barometric pressure and manifold air temperature. All other starts and runs from here on out will help to apply appropriate air temp & barometric pressure corrections and dial in the transient fuelling corrections.



 
Trackday

As planned, the bike was taken on a trackday at Mallory Park after dyno testing to see how it would manage. Unfortunately the chosen day turned out to be cold, wet & snowy but still proved to be a great test of the bike’s rideability with the EFI system.

It was also hoped to use the track day as an opportunity to get a lot of data logging done to help dial in the transient fuelling but as luck would have it, the brand new lambda sensor installed died within minutes of the bike being started so no fuelling data was recorded throughout the day.

Despite this setback, the bike rode really well on the track and throttle response & power were as good as could have hoped given the lack of any form of transient fuelling corrections.

Trackday

Tuesday, 21 February 2017

The Search For Electrical Overhead

Due to the additional electrical load being placed on the bike from the EFI system, the charging system needed some attention. It was suspected from the very beginning of the project that the original reg/rec may not able to cope with the constant drain on the system from a high pressure fuel pump and twin headlights. This became very apparent as the bike was being used more and more recently.
The battery could not be kept charged when either the dipped beams or main beams were switched on. There was a definite drop in battery voltage depending on whether the lights were switched on or not and it was noticed that the reg/rec was getting quite hot after night-time rides so it was likely that the reg/rec was going to fail sooner rather than later.

A new Shindengen FH020AA mosfet reg/rec had already been purchased for an upgrade further down the line but given the circumstances, the upgrade was moved to the top of the priority list. The installation of the new reg/rec was relatively straight-forward. The FH020AA is quite a bit bigger than the OEM reg/rec but still fits under the fairing in the same place. Just about. One additional hole had to be drilled in the mounting plate to accommodate the wider hole spacing of the FH020AA and the standard connector was chopped from the loom and replaced with the dual connectors required for the FH020AA.

FH020AA vs OEM mc22 reg/rec

An immediate improvement in voltage regulation and stability was observed with the FH020AA fitted and the reg/rec merely ran warm to the touch as opposed to hot. Although, since the reg/rec can only improve regulation efficiency and can not force the stator to provide any extra power, the bike was still a little short of electrical headroom. It was not bad enough to risk running the battery flat during a long night-time ride but rather meant that battery voltage with the lights on at idle tended to hover around 12V as opposed to the 14V which was observed at idle with no lights. When a current clamp was placed on the battery earth strap, it became apparent that with lights on, the predominant flow of current was out of the battery. As such, a way of either a) boosting the generated power or b) reducing the electrical load on the bike had to be found. Of the two, option b) was clearly the preferred route. Given the headlights represented the single largest current draw on the electrical system, they were the chosen target for modernisation.

After much deliberation, research and changing of mind back & forth, it was decided to install LED bulbs. The options were either HID or LED but eventually the LED won out due to being actually able to package the ballasts in the front of the bike, being more adjustable for beam pattern and having lower overall current draw although they were almost twice the cost of the HIDs for a quality set from a reputable manufacturer.

Each H4 LED bulb is rated at 20W compared to the 60W/55W rating of the standard halogen units so, in theory, a set of two should have freed up c.6A capacity which would be more than enough to cover the additional load the fuel pump, lambda heater & injectors placed on the system. Before installing the LEDs, a charge current of -7A (draining battery) at idle with dipped beam on and -6A at idle with main beam on was measured. With the LEDs installed, charging current was measured at +3A at idle with both dipped and main beams on, leaving ample headroom on the charging system.

The physical installation of the bulbs was reasonably straight-forward. The heatsinks on the back of the bulb made it all a bit bulkier than the standard setup but the heat sinks are well hidden given they are black in colour. The two small ballasts found a nice place to sit either side of the clock stay bracket where they do not interfere with anything else. Getting the beam pattern right took the most time but the adjustment in the bulb housings worked a treat. There is also the advantage that the LED headlamps are quite a bit brighter than the halogens which makes night-time riding quite a bit more enjoyable.

Friday, 9 September 2016

ECU Modifications

There were two further modifications I wanted to make to the control system before getting the bike back on the road for a decent period of time and collecting data.

  1. Bluetooth connectivity
  2. Barometric Pressure Sensor


Bluetooth Connectivity

I had been looking at incorporating Bluetooth connectivity on the Microsquirt for quite a while and had purchased an RS232 to Bluetooth module for the purpose. I never got around to installing it permanently though as I needed to add a separate power connection for the module.
When I was building the new ECU harness recently I added a switched 12V power & ground connector with the intention of using this connector to power a Bluetooth module.

However, getting into the detail, I became less happy with the RS232 to Bluetooth module option. This option meant I would still need to use a 2.5mm jack to RS232 cable between the ECU harness & the Bluetooth module which not only made the setup bulky but also introduced more connectors than required  with the potential for connection issues.
I researched alternative serial-Bluetooth modules and came across the HC-05 & HC-06 modules which are commonly used in Arduino projects and can be easily reprogrammed using an Arduino. I decided upon using a HC-06 module as I did not have the requirement to switch between master/slave modes. The physical size of the module was a large part of the attraction. The plan was to use a linear voltage regulator to drop the switched 12V supply down to an acceptable level for the HC-06 and enclose the module in a small case with a flying lead terminating in a 2.5mm jack to communicate with the ECU. However when this setup was tested, the software would recognise a Bluetooth device was connected but it could not read the firmware signature. The signature appeared as though the baud rate was incorrect even though it wasn’t. After much frustration & further research, it was found that the HC-06 works with straight serial data and cannot deal with RS232 serial as it was receiving via the 2.5mm jack in the ECU harness.

Then I discovered an article online that described installing a HC-06 Bluetooth module inside the Microsquirt case. 5V power & ground connections were taken from the development header on the main board and Tx & Rx were soldered directly onto the main board prior to the RS232 chip. This installation had the immediate attraction of being extremely tidy as everything would be hidden inside the ECU case with no external wiring. I added a toggle switch to the 5V power connection so that the Bluetooth module could be switched on & off from outside the ECU, allowing the choice of connecting to the ECU via Bluetooth or via direct RS232 serial cable.

The internal installation worked great the first time and has made datalogging and loading calibrations onto the ECU significantly easier given that every ride can now be datalogged using a smart-phone in the pocket without requiring a laptop with wired connection to the ECU to be carried around in a backpack. It will significantly increase the rate of data collection and usability of the bike.

HC-06 Bluetooth Module

Barometric Pressure Sensor

Given the location of the lambda sensor on the TSR exhaust system, it is impractical to run closed loop lambda correction during daily use and so the intention was to dial in the fuelling as best possible and run open loop fuelling. In order to correct fuelling for varying atmospheric pressure and riding at altitude, the preference was to add a separate barometric pressure sensor which would allow constant fuelling corrections with pressure/altitude.

The simplest option was to add a second MAP sensor which would be dedicated to atmospheric pressure measurement. However, MAP sensors tend to be able to measure across a larger range of pressures than required so accuracy would be compromised. I also had not added the external wiring necessary when I renewed the ECU harness.

I had seen some examples of Microsquirt ECUs modified to include an internal MAP & Barometric pressure sensor such as the DIYAutotune MAPDaddy board. This particular solution did not appeal to me though as it is relatively expensive, includes 2 pressure sensors when only one was needed and the sensors are 4 Bar sensors which are likely to be quite inaccurate when trying to measure in such a small range of the sensor’s capability. This did however open up the idea of using a board mount pressure sensor located within the ECU case.

I looked at using a Bosch BMP sensor but as the output is digital I would need additional electronics to convert the signal back to analogue 0-5V so that the ECU could read it. A Honeywell pressure sensor was also an option as it gave an analogue output and being a through-hole package, it could easily be mounted on standard stripboard. However the cost was prohibitive being over half the cost of the dual sensor MAPDaddy board and the physical size and measurement range was still larger than I would have liked.

In the end I have chosen an Infineon KP235 Barometric pressure sensor as it is low cost, designed for use in automotive applications, narrow useable measurement range & small package size. The one disadvantage was that the surface mount package and small size meant I had to design and make a PCB to mount it and allow it to be connected to the ECU but this was a small price to pay for the size and cost of the unit.

A PCB was designed to accept the KP235 sensor and include smoothing capacitors on the input & output voltages as recommended by the manufacturer. Surface mount 0805 package capacitors were used to help keep the size of the board down and the interface with the ECU would be through standard size header pins and DuPont connectors. This way the board size was kept down to 25mm x 12mm.

Copper board was painted to mask the copper layer. Then a negative of the PCB layout was etched in the mask to expose all the unwanted copper. The exposed copper was then removed using an acid solution before removing the paint mask and protecting the remaining copper with a liquid tin solution. The header pin holes were then drilled and the components soldered in place. For additional protection and isolation from vibration, the completed board was coated in a layer of silicone rubber.

Completed Sensor & Board

Protected Sensor Board

5V power & ground were taken from the header pins on the main board as with the Bluetooth module and the output signal wire was soldered to the SPAREADC2 pin on the Ampseal connector between the connector and the ECU board. A 1.5mm hole was also drilled in the ECU case to allow pressure inside the case to equalise to atmospheric pressure.

Sensor Installed In The ECU

Both the Bluetooth module and barometric pressure sensor are held in place using hot glue. The Bluetooth module is located underneath the topside of the Ampseal connector and the barometric pressure is located underneath the lower side of the Ampseal connector. The Bluetooth switch is located on the RHS of the ECU and is easily reachable when it is installed on the bike.


Following these two upgrades to the ECU, the physical install is considered as good as complete. The bike is now back together again and on the road where the goal over the next few months is to collect as much data as possible and continue to refine the calibration.


Friday, 19 August 2016

Idle Control Valve & More Wiring

Idle Control Valve

One of the things that was bugging me about the whole install was the fact that because I had converted the carburetors to throttle bodies and disabled the choke, cold starting was still a bit of an issue. There was a fine line between setting the throttle stop such that the engine would run when cold and still not idle massively high. I had got it to a point where it would idle at c.2,000 rpm when hot but when cold it would struggle to life & I couldn’t touch the throttle until a reasonable amount of heat had built up in the engine. It was OK for the short term but it wasn’t good enough for a road engine so I started looking into getting some form of idle control implemented.

As most idle control valves are based on a stepper motor driving open the throttles when cold I began to look at these. I contemplated mounting a stepper motor to the throttle bodies to drive the throttle stop screw in and out so that I could vary the closed position depending on coolant temperature. The issues with this were the placement of the stepper motor & also the stepper motor drive. The Microsquirt does not have a stepper motor output so I would need an external unit to convert the PWM output of the Microsquirt into something that could be fed into a stepper motor. Space constraints won out in the end. The thermostat housing is located pretty much exactly there the motor would need to be mounted and I had already moved the thermostat housing as much as possible just to get the fuel rail to fit.

I also considered a mechanical system with a thermostat that would retract a plunger as coolant temp rose and close the throttle more but the same space constraints also killed that idea.

I then thought that I could bleed air past the butterflies by using the carb sync nipples that I was already using to measure MAP from. Having air leaking in here results in rough running on a carbureted system but with the FI system I would have the ability to add fuel to compensate and make use of the additional air being drawn in. A solenoid valve could be driven by PWM directly from the Microsquirt to regulate the flow of air past the butterflies and the MAP sensor could be T’d in between the solenoid & the split to all the ports so that MAP could still be sampled in the same way as before.

After a little research I purchased a Bosch canister purge valve used in many cars and a selection of silicone hose & T pieces to plumb in the system. The diagram below shows a schematic of the plumbing I ended up with.


The idle control valve so far has only been tested for a very short time on the bike but so far it is looking very promising. When the engine is warm, the difference in engine speed between valve closed & valve open is 1,000 rpm and I can also use the valve to control to a target idle speed in closed loop mode. It certainly needs more running to dial in the settings but it is a big step in the right direction.



Wiring Harness Issue 02

Given the addition of an idle air valve, I needed to run the signal wire from the ECU to the injector harness to drive the valve so that required a small change to the ECU harness. Small changes spiral quickly with me though and this was no exception.

Even though I had spent some time this time last year tidying up the wiring harness, I had become pretty unhappy with it as time went on. In diagnosing a faulty main relay some months back I became sceptical about the quality of connections I had made in the harness. Since most of these connections were made at the very beginning of the project when I had little experience and were added on a “when needed” and “where is accessible” basis, I did not have a clear idea about how reliable they were and where the connections were physically located within the harness. The harness was also far bulkier than I cared for and was generally not up to my current standards.

At the time I started to doubt the harness I had decided that I would build a completely new main bike harness incorporating the ECU harness and dash and a few other upgrades that would make the bike a bit more modern so I thought the old ECU harness would do the job until I got the main harness built.

However, having to run a single wire along the harness presented the perfect opportunity to tear it all apart and start again to make the ECU harness tidier and more reliable until the upgraded bike harness would be ready to drop in. The main aims for the new ECU harness were:

  1. Remove all unused wires from the harness. Previously I had just chopped the unused wires back but they still ran within the harness up until the front of the pillion seat.
  2. Replace any wires within the harness which were deemed overkill for the level of current they are expected to carry.
  3. Replace all previously spliced wires with new more reliable spliced connections.
  4. Tidy up the power connections around the fuse box & add proper relay connectors to make removing and replacing components more foolproof & straightforward
  5. Tidy up how the external coil driver box interfaced with the harness
  6. Mainly use the process to create a complete & up to date harness drawing and pinout chart including connector specs, wire routing, wire sizes, splices & splice locations and harness lengths. All this would take more time now but would really help with any fault diagnosis and harness alterations in the future. It would also get me one step closer to a full set of documentation to capture all the alterations & modifications I have made to the bike throughout this project.

While drawing up the new ECU harness I decided to change the way injector power was being delivered to enable me to fit in the idle valve wiring in the same connector that was already in the harness. Previously, each injector bank (2off) had its own fused power supply so I merged these two supplies into one which also provided power to the idle valve and allowed me to use a 4-way connector between the ECU & Injector harness. That change did however force a rebuild of the injector harness even though I was reasonably happy with that. At the same time it was a good excuse to make a few nice changes and make it altogether more robust.

First was to remove all the wires from the ECU Ampseal connector that were not being used. Also any signal wires which had been cut and spliced previously were removed and replaced with fresh wire. The harness was then laid out and laced together with the branches coming off the main trunk at the correct locations. Then connectors were added and the whole lot wrapped. Installed on the bike it is now far easier to install & remove the harness and it looks much tidier also.

Laced ECU Harness

Installed ECU Harness
While that all looked good, I felt that wrapping the harness tended to twist the bundle a little when wrapping and the wrap was also a little untidy around the areas where the branches broke away from the main bundle so for the Injector harness I took a slightly different approach. I sleeved the wire bundles with DR-25 and then covered the joints with adhesive lined heatshrink to provide some rigidity. I also redesigned the harness so that the main bundle would be tied to the throttle bodies just below the airbox rather than onto the fuel rail where it was previously.

Completed Injector Harness

Installed Injector Harness

Installed Idle Valve