Introduction: Arduino Throttle Body Syncronization Shield

Picture of Arduino Throttle Body Syncronization Shield

A common Motorcycle maintenance task is to synchronize the throttle bodies on the engine to smooth out any rough idle. This is done by monitoring the vacuum on each throttle body and using the idle screw to make the adjustment.

While this sounds rather advanced, with a little knowledge, a few standard tools to access the engine, and a TBS tool (Throttle Body Synchronization); the maintenance item really isn’t that hard.

Now you can buy a tool or build a TBS tool using fluids and tubes (there are examples of this out there on the interwebs), but I wanted to use an Arduino and some electronics to build my own to do the job. This instructable describes my journey in making my own Arduino Throttle Body Synchronization shield.

Step 1: Research

Picture of Research

A TBS tool is rather simple in what it does; it will measure the vacuum that each cylinder is actively producing when the engine is running.  To measure vacuum with an Arduino I needed to build a shield that would contain a vacuum sensor for each cylinder on my engine (4 in my case). 

There are many vacuum sensors available from your favorite electronics parts stores.  The interesting range that I need to measure is around -33 kPa (-4.78 psi).  This is the value that should be measured on my motorcycle on a single cylinder when the engine is warm and at idle.  You should consult a service manual for the specifics for your engine.  So I picked one that measured a range between 0 kPa to -50 kPa.

Then I needed to understand how to connect this to my engine.  The service manual helps here also, but I also found many great write ups on the web.  I just needed some standard engine vacuum hose with an inner diameter of 1/8th inch which will push onto a service nipple already present on the throttle body.  This same hose will directly push onto the vacuum sensor.  I found this in bulk at my local automotive store.  I needed four hoses each with at least 3 feet length so I could put the Arduino and sensors in a safe place.

Step 2: Designing the Shield

Picture of Designing the Shield

The sensor I picked required a pretty simple schematic.  It just needed three capacitors.  Further, providing that it got 5v to run on it would provide an analog voltage that represented the vacuum reading in the range of 4.6v ( at 0 kPa) to 0.1v (-50 kPa).  This is great for connecting directly to the Arduino analog input pins.

I used the free version of Eagle to design the first sensor schematic.  Eagle is a PCB design software that is commonly used by many hobbyist to design schematics and layouts for circuit boards. There are many videos and instructions on how to use Eagle, and like all moderately complex software it just takes a little time using it to become familiar with how it works. 

Then all I had to do was replicate the schematic for a single sensor four times and add the connector for pushing the shield onto the Arduino.

With the schematic complete, I switched to board layout mode and followed some other shield layouts to build an outline that would simply press onto an Arduino like all shields do.  I finished it by then placing all the parts and running all the trace lines.

Once I had the completed design and layout, I did research and found a company that did PCB prototype creation.  They accepted Eagle files directly, making it easy to upload, pick the number I wanted, and submit my order.  I then just needed to wait for my boards to be shipped to me.

Step 3: Assembling the Shield

Picture of Assembling the Shield
I collected all the parts, brought out the boards, and setup my tools.

(4) custom produce PCBs from SilverCircuits.com
(4) vacuum sensors MPXV5050VC6T1CT-ND
(4) 470.0 pf ceramic capacitors (surface mount 0603) 478-6201-1-ND
(4) 0.01 uf ceramic capacitors(surface mount 0603) 445-5100-1-ND
(4) 1.0 uf cermic capacitors(surface mount 0603) 311-1445-1-ND
 
I had pin headers from a previous project that split into eight sets, four sets of 2 pins and four sets of 4 pins.

I suggest a good quality soldering iron when soldering surface mount parts by hand.  There are many techniques to soldering surface mount parts, some are better when you have a lot of soldering to do; but I just do it by hand.  Again, searching the interwebs will give you lots of ideas. While a fine tip on the soldering iron is not a requirement, I found that a flat tip that wasn’t too large was very helpful.  Also use fine high quality solder. 

Having a solder helper is also very handy.  Mine has multiple alligator clips to pinch the board in and they can rotate to hold the board flat.  Further, mine also has a tray in the base to hold the solder spool.

I found having some sort of vision enhancement was a requirement.  While my vision is still very good, I could not imagine soldering such small parts without some magnification.  I found using reading glasses with a decent magnification works really well. I only lost two capacitors out of the 12 I had to solder in.  They were close to the size of a grain of sand.  Next time I will use larger SM parts.

I applied a little solder flux liquid (comes in a bottle) to each SM pad and a little between.  This stuff is sticky and helps hold the part to the board while you solder.  Then I lightly press the soldering iron to one side while being careful not to move the part.  I then hold some solder to what little of the pad that is left showing next to the part lead, and it will just flow around the pad and lead.   Let it cool for 15 seconds and then repeat for the other leads.

Once complete, I used some alcohol and a Q-Tip to wash away any left over solder flux  to clean up the board.

Step 4: Writing Some Software

Picture of Writing Some Software

My software came in two parts.  One part ran on the Arduino and collected the ADC values, filtered them, and sent the summary out the serial port.  The second part ran on the PC and listened for the data from Arduino and provided a nice UI to visualize the results.

On the Arduino, I just needed to read the ADC pins to get values, and then convert these into kPa.

    Int Sample1 = analogRead(A0);
    Int Sample2 = analogRead(A1);
    Int Sample3 = analogRead(A2);
    Int Sample3 = analogRead(A3);

Since the ADC reads as 0-1023 for 0v-5v, the sensors will read 0.1v as 50 kPa and 4.6v as 0 kPa; I can then use the following snippet of code to convert them.  Note that I am using integer math (no decimals) so I treat the actual values as the number * 1000 (thus the addition to the name with kPa1000).

    const static long kPa1000PerAdcUnit = 54; // 0.05425347 per ADC unit;
    const static long adcValueFor0Kpa = 942; // 4.6v
    long kPa1000Value = ((adcValueFor0Kpa  - adcValue) * kPa1000PerAdcUnit);

I applied some filtering, collected min and max values over a period, and a few other things with the primary goal of reducing the amount of information that gets collected.

The values can then be sent to the PC using the serial feature where the second part of the software comes in.

On the PC, I wrote a Windows WPF application in C# that listened to the serial port for data coming from the Arduino, and then had it draw four bar graphs to display the data along with useful values. I added a few buttons and serial commands between the Arduino and PC to control calibration and when to start and stop sampling and spewing all the data.

Step 5: Syncing My Throttle Bodies

Picture of Syncing My Throttle Bodies

Once I thought I had everything working, it was time to attach my new tool to my motorcycle and sync the throttle bodies.

For my motorcycle this required that I lift the gas tank to get the maintenance vacuum ports. Once I had access, I just needed to spot them in all the complexity. They were pretty simple, they were little rubber nipples with a wire clip to help retain them. I had to remove these rubber covers and attach my hoses to all four of the ports.

Then I started my software, requested a calibration, started the engine and let it warm up. The PC software will update real-time graphing the results and showing the readings. I then use the idle adjustment screws to adjust the values per service manual instructions and I am done.

In the image, the red box is one of my hoses connected to the maintenance ports. The red circle shows the adjustment screw for the idle setting for that cylinder. There are four of each of these.



I will continue to fine tune my software but it was good enough to get the job done.

For the hardware, I would like to 3D print a nice box for it that supports and exposes the hoses while protecting the electronics.

I now have a nice idling motorcycle and very nice tool in my tool set.

Step 6: Sources So You an Buid Your Own

I have shared all the project files on GitHub so that that this project can evolve and grow with contributions from others.

Schematics for the Shield: Git Hub Eagle Files

Arduino Library for the Shield: Git Hub Arduino Shield Library

Arduino Sketch for the tool: GitHub Arduino Sketch

Windows C# Application for the tool: GitHub Windows Project

Comments

flaquito (author)2012-05-21

Very nice! What was the part number for the sensors that you used? Also, any chance of sharing your code for either the Arduino or the PC? (Preferably both... :))

Makuna (author)flaquito2012-05-21

Thanks,

Look for an update to the article in next day or so, I will include the part number for the sensor and few other requests.

I am planning on having a follow-up Instructable that will include more of the software side of this project with explanations; where more of the code will be shared.

xocoatl (author)Makuna2014-07-17

Hi, Makuna,

Could you please share the PCB designs?

Makuna (author)xocoatl2015-01-18

I have included a link to the PCB design, and all the source code. If you make it better, please contribute with GitHub.

blkadder (author)2017-09-15

Great looking project here. I think I may be able to use this when synchronizing the twin carbs on my MG.

kevinlieb (author)2017-08-28

Nice! Please let me know if you have a pre-assembled board I can buy.

lxshooter made it! (author)2017-04-28

Hello,

Thanks for sharing.

I was able to build mine.
I had an undetected card problem, but by making a small modification on the code of the windows software it works well now

Makuna (author)lxshooter2017-05-23

Can you share your change by making a PUSH to the github project?

lxshooter (author)Makuna2017-06-24

It is good, I have create a pull request to solve the problem.

lxshooter (author)Makuna2017-05-25

Yes I can, but I don't know how do that. It is the first time I use Github

Can you explain to me ?

JustinB240 (author)lxshooter2017-05-30

Where you able to upload this to github? I'm having the same issue and have been for months now. I've even tried multiple arduino's.

SzabolcsM1 (author)lxshooter2017-05-26

Can you send it to me on e-mail please? subee19@gmail.com

SzabolcsM1 (author)lxshooter2017-05-23

I have the same problem! "Make sure the TBS unit is plugged in before strating this application". I can't modifing the Windows software. Can you send it for me on e-mail. subee19@gmail.com

ZdeněkH9 (author)2017-06-12

Hello,

Thanks for sharing.

The problem with the program for windows I solved this way

In line : 251

I wrote "bool found = true;" instead of "bool found = false;"

Makuna (author)2017-01-17

You could alternatively use an external Analog to Digital converter that has a higher resolution; there are cheap 16 bit i2c AD chips available; integrate that on the board and have the communications between the board and the Arduino just be digital could be very interesting.

Randy Lahey (author)2017-01-16

I'm planning on making this, but have a few questions. What changes would you recommend for the PCB? And does the vacuum ever exceed the tolerance of the sensor? Based on an analog gauge that typically goes down to -30 psi (-105kpa), maybe a MPXV6115V sensor might give a bit more range.

Makuna (author)Randy Lahey2017-01-16

I definitely would recommend some changes to PCB.

Start with a standard Arduino Shield Layout and make sure it fits on that. The current layout was just a linear line that made sure the pins would plug into a an Arduino directly. But at least for the smaller boards (non-Mega) it hangs out the end and also isn't secured with the other pins. With this I would also add a few pins to the other side just for mechanical structure when connected to the Arduino.

For my motorcycle, the vacuum did exceed the range but only when I increase the throttle to near 66% which happens only quickly (blip of the throttle) and isn't really needed when synchronizing. Vacuum at 50% throttle should be fine and most instructions don't even ask you do anything other than idle.

When ever you increase the range of the sensor, you decrease the resolution of the readings. The Arduino only has 10bits of resolution(0-1024), spread that across 0-50kpa versus 0-100kpa for example you would loose half your resolution. Ultimately its design decision also based on what level of vacuum you need to measure; for my application the one I picked was good.

Randy Lahey (author)Makuna2017-01-16

Thanks for the reply. I was thinking a sensor with a wider tolerance could theoretically be left on the bike while riding for tuning/troubleshooting/curiosity purposes. To achieve a more accurate resolution from a wider range sensor, I suppose one could impose a lower analog voltage reference maybe?

tinoxplosino (author)2016-11-20

Hi, great instructable!

Is it possible to measure positive pressure with this? For example when you have an intake valve that's not closing completely and you get a backpressure from the cylinder?

Or would you have to use a differente sensor to achieve this? A -50kPa to +'anything' sensor basically?

Makuna (author)tinoxplosino2016-11-20

You would have to use a different sensor. They do have the "same" sensor with different ratings and several of them do positive pressures.

tinoxplosino (author)Makuna2016-11-21

I've spent a lot of time searching for a sensor that's capable of such a range, but they are hard to find or really expensive. Any thoughts about splitting the tube with a T-connector and using a positive sensor (e.g. MPXV5050GC6T1) in parallel with the one you suggested? Off course then I would have to read 8 analog inputs...

JustinB240 (author)2016-10-08

I'm getting the message "Connect the TBS shield before starting this application" I've changed the com port of the arduino to 11 and 12 with no luck. Is there something else I'm missing or have done improperly?

Makuna (author)JustinB2402016-10-08

Finding the port is a hard problem that is finiky based on how many comm port devices are attached.

This is where the code starts,
https://github.com/Makuna/Tbs4RpmWin/blob/master/Tbs4Rpm/MainWindow.xaml.cs#L291

and it calls this to enumerate ports
https://github.com/Makuna/Tbs4RpmWin/blob/master/Tbs4Rpm/MainWindow.xaml.cs#L228

and uses this to identify the port as being the TBS
https://github.com/Makuna/Tbs4RpmWin/blob/master/Tbs4Rpm/MainWindow.xaml.cs#L262

You would have to debug the code to see why its skipping the port you have it on.

JustinB240 (author)Makuna2016-10-15

I've been trying to get it read all week. In the arduino program I see Idle 0 and idle 1 going back and forth. When the program runs the rx light on the arduino flashes once then I get the above error. could I have something soldered wrong and it's not reading any values from the sensors?

homerisback (author)2016-06-06

With Visual Studio 2013, I've been able to, sort of, compile the win app. As my arduino uno R3 is identified as COM6 on my PC, it wasn't detected by the app and reported "

make sure TBS is connected before..."

I tried to force COM6 as the portName.string and when I start the app, leds start blinking on arduino board but no window shows up (the one with the graphs). My TBS shield isn't ready yet so it may be the reason nothing appears but no error reported...

Waiting for the parts to build the shield.

PatrikL1 (author)2015-12-07

Hi !

Well i continue to have problems with this setup.
I will get the "make sure TBS is connected before..." message everytime.I can see that the PC software is trying to communicate with the Arduino but then nothing happens. I have tried COM ports with single and double digits without success.
Windows 7 32bit and Windows 10 64bit is also something i have tried.
The PC software is built without a problem, aswell as the compilation and uploading of the Arduino program. I have a Arduino Mega with the Atmega communication circuit, not the FTDI. So i have ordered a TTL to USB with the FTDI circuit to connect directly to the Arduino to see if that solves the issue. Any other suggestions is wellcome.

\Patrik L

s_krstjnssn (author)PatrikL12016-06-05

Did it resolve your issue?

Curious as I seem to have stumbled into the same issue. :-(

s_krstjnssn (author)2016-06-04

Has anyone else run into issues when trying to get the Windows part (C# code) working?

I am running a Windows 7 (x86) with Visual Studio Community 2015, with an Arduino Uno R3 plugged in.

I am stuck with System.TimeoutException errors concerning the .ReadLine (when trying to read the version query result).

If I pop up the Serial Monitor or other utility to connect to the port, I see the <idle0> and <idle1> along with the version if I send the command/query for it.

What gives? :-(

DSR2 (author)2016-04-06

Excellent work Makuna. I have one question regarding the Arduino model. Does your app work with the Arduino MEGA 2560 with ATmega16U2 USB-serial chip?

Makuna (author)DSR22016-04-06

There is nothing specific in the code about the connection to computer. It treats it as a serial device. But I have never tested this configuration.

The connection to the sensors also follows standard pin setup so it should work if plugged into any 5v Arduino.

DSR2 (author)Makuna2016-04-08

Hi Makuna. I have sucessfully uploaded the SW to the Arduino, but I have problems with starting the Win app. It replies with the following popup "TBS Sensor Unit not found. Make sure the TBS unit is plugged in before starting this application"

The arduino is detected as COM7. Any idea what could be the issue.

Thanks.

Makuna (author)DSR22016-04-08

In the method

private string FindPortName(List<string> portsSkip)

you will see this line

if (portName.Length > 4) // skip COM5

this is the problem. I had to add that due to have other USB devices that exposed a serial port that would choke if probed by the code in another place. This is suppressing all com ports that are single digit.

DSR2 (author)Makuna2016-04-12

Hi Makuna.

I can not solve this problem. Simply does not find the COM port even if I change the port to COM10 or above. Tried on different PCs and the problem is the same. Can you send me your already compiled app to try.

DSR2 (author)Makuna2016-04-08

I've noticed that line during troubleshooting and I tried with different COM port settings, unfortunately with the same outcome. Can you suggest which lines to delete or add in the code so I can try again. I'm not so much in to writing codes. I've tried with some simple arduino codes for reading analog input and plotting to serial port just to check if my sensors work and that was successful.

stp715a (author)2016-03-30

Hi. Great work! Thank you. Could you please either post or email the pin connections between the shield to the arduino?

Thanks for sharing.

Makuna (author)stp715a2016-04-06

In this [picture](https://www.instructables.com/file/F9K6S5XH2G5ZUVS) it shows the board layout, with labels showing connecting to the Arduino A0 - A3 directly.

The board was designed as a shield, so it just plugs directly on the top of the Arduino.

rockstarcustomz (author)2016-02-29

I could really use that ounce I'm down with my carbs

oldspark (author)2015-09-16

Hi Makuna, I thought this would be a nice project to sync the three throttle bodies on my Triumph Sprint 955i. I have fitted the sensors onto an arduino shield and plugged that into an Arduino Mega2560 board. The Arduino shield program runs nicely and I can see the output on the serial monitor. I have not been able to build the Windows TBS4 program. On Visual Studio10 Error messages are "cant find MainWindow.xaml.cs and TBS4win.exe file. Are these missing from the zip files that you posted? Thanks On-on

Makuna (author)oldspark2015-11-02

it was there and for some reason I deleted it. In the spirit of Halloween I reserected it.

PatrikL1 (author)2015-10-31

Hi !
Have anyone solved the issue with the missing Mainwindow.xaml.cs file ?
This is the last step for me before i can actually try this project on my bike.

\Patrik

Makuna (author)PatrikL12015-11-02

Check github again, this just got fixed.

rpotts2 (author)2015-09-15

is this syncing a maintenance issue or engine management?

Makuna (author)rpotts22015-09-15

This work was aimed at maintenance. The concepts could be extended to management but this was not the goal.

rpotts2 (author)Makuna2015-09-15

Okay, thanks! I was thinking this could help with an ITB idea I had for my car.

peter.valencic (author)2015-03-15

I'am doing the same thing with other vacuum sensors. I have done also android UI.

It's a simple UI with 4 progress bars indicating pressure on each channel..

Can you please modify your library to support 3V sensors?

rpotts2 (author)peter.valencic2015-09-15

just use logic converters.

Makuna (author)peter.valencic2015-04-22

In the article there is a section that describes the relationship of the readings in voltages and the calculation to turn this into Kpa. If you are using a 3.3v Arduino this needs to be adjusted as its ADC range is 0v-3.3v instead of 0v-5v.

You will need to know what voltage your sensor outputs at the highest and lowest reading values. You can rely on the sensor specs for this; or attach a vacuum pump to a sensor and watch the ranges it provides as you increase and decrease the vacuum.

adc Value For 0 kPa = 4.6v * 204.8 = 942.08

adc Value For 50 kPa = 0.1v * 204.8 = 20.48

Then you can calculate the scale constant (kPa1000PerAscUnit)

kPa Per Adc Unit = (sensor range) / (Adc voltage range)

Inserting the numbers above, and due to using integers rather than floating point, scale by 1000, you get...

kPa 1000 scale = (50 * 1000) / (942 - 20) = 54;

Find these lines below in the code and adjust per new calculations for 3.3v instead of 5v and what ever range your sensors has and it should work.


const static long kPa1000PerAdcUnit = 54; // 0.05425347 per ADC unit;
const static long adcValueFor0Kpa = 942; // 4.6v
long kPa1000Value = ((adcValueFor0Kpa - adcValue) * kPa1000PerAdcUnit);

ValerioF (author)2015-06-23

Hi, the project it's a little old, but very interesting, have you ever thought to integrate a couple of steady fixed stepper motors and a bit of logic to do the syncing work for you?

MarkD41 (author)2015-06-10

A couple questions:

1. When ordering the PCBs from Silver Circuits, did you just accept the defaults on the ordering page? http://i.imgur.com/QxUAIpj.png

2. Can you suggest appropriate pin headers from digi-key? I think I have some spare headers that can with my arduino but I'd like to order more.

jerseydesigns (author)2015-06-01

That is very cool.

About This Instructable

65,399views

121favorites

More by Makuna:Maker Faire Canopy FootingMini Card Deck HolderElectronics Tips: Surface Mount Soldering By Hand
Add instructable to: