Wavelet DSP Knock Project

I’ve been hacking in the automotive domain for over a decade now. I have done a few engine swaps, but my MR2 was the first time I ditched the factory engine control unit (ECU) in favor of an aftermarket standalone unit. The stock Toyota ECU makes no provisions for tuning or calibration tweaks. The aftermarket ECU I chose from Haltech would allow me completely define the spark and fuel parameters, along with a host of auxiliary features. It came with a flying lead harness, so I had create the entire engine loom; routing and connecting every wire.

When tuning an aftermarket ECU, special tools can help monitor the engines health. Historically tuners and modders relied on reading the condition of the spark plugs, and a good ear to listen for any audible anamlolies. Today there are a number of more sophisticated technologies avialable. One tuning aid that I sought was a knock detection system. With a background in electrical engineering and signal processing, I began to scour the market for suitable devices. After an exhaustive search, I was not impressed with the available options and decided to tune my car without the aid of knock detection device.

Not long after my car was finished, I enrolled in a senior level signal processing course at NIU. There were two projects for the course: one midterm project which was constrained, and one final project which was completely open ended. I chose to tackle the knock detection system as my final course project.

I set up the standalone ECU to give me two maps: one that would run the engine normally, and one that would make the engine combustion detonate.

I recorded the signal from the knock sensor for a preliminary analysis. Here is what the recorded signal sounds like:

Using Goldwave software I performed a time-frequency plot. You can see the signal of interest shifts a bit higher in frequency when detonation is occuring.

I deceided then to dig deeper and isolate the combustion events. Here is the knock signal slowed down:

The waveform of a single combustion event looks like this:

Combustion event waveform

I fed an example of the knock waveform onto the Matlab wavelet toolbox:

Post in progress…

Pulsejet Control System


My senior design project at NIU was a collaboration between myself and a Joshua Ott. Joshua is a mechanical engineer who had been designing a unique pulsejet engine design. The unique features included a twin combustion chamber design and a self starting mode. To accomplish his mission, Joshua needed a digital control system designed and implemented for this pulsejet engine. The result of our efforts were a really cool engine, new skills, and Second place senior desing awards from our college in both the mechanical and electrical departments.


This system uses an Adruino Mega interfaced with some other peripherals:

  • LCD Screen
  • Rotary 10k potentiometer input knobs
  • momentary push button
  • injectors drivers
  • ignition drivers
  • fuel pump relay

The control system is interrupt driven and makes use of three of the arduino mega’s timers. The pulsejet contiains no moving parts: presesnting an intersting challenge for determining the phase of the combustion cycle. I decided to overcome this problem using the following method: the timing of the system is referenced to a reoccurring portion of the combustion cycle. The pressure sensors trigger the arduino interupts upon crossing their zero refernce point. This is the begining of the control sequence for each cycle.

Control Sequnce Overview:

  1. Determine operation frequency of the engine and resolve the fuel delay (specified in degrees) and spark delay (also in degrees) into a time delay. This has to be done each cycle because the engine may change its operational frequncy and the spark/fuel time delays need to be dynamically recalculated.
  2. Set the fuel timer to interrupt the proccessor when it’s time to begin injecting fuel (based on the previously calculated delay time)and set the spark timer to interrupt the proccessor when it’s time to begin charging the coil (a static amount of time before it needs to fire; also based on the previously calculated delay time)
  3. The fuel delay timer has elapsed and the processor begins its fuel interrupt routine. The injector signal is asserted and a software semaphore is set to track that the injector is on. The timer is set with a new value for when the injector needs to turn off. This is based upon the amount of fuel desired.
  4. The fuel timer elapses again and the fuel interrupt routine checks the semaphore flag. The logic specifies that the injector now needs to close, and the injector signal is de-asserted.
  5. The spark delay timer elapses and the the processor begins its fuel interrupt routine. The spark signal is asserted and a software semaphore is set to track that the coil is charging.
  6. The spark timer elapses again and the spark interrupt routine checks the semaphore flag. The logic specifies that the coil is done charging and now needs to fire, and the spark signal is de-asserted.

That is an overview of the realtime control logic. Note that those steps are occuring for two separate combusitons chambers concurrently. Some other house keeping functions are running periodically to poll the A/D convertor to get the input positions of the knobs, update the LCD screen, and send logging data out over the USB cable.


I was looking for some way to make a sturdy aesthetically pleasing enclosure. Plastic project boxes didn’t appeal to me and I wanted somthing metal. I decided to repurpose an airbag computer module from a Toyota MR2. I stripped out the original pcb and made room for my components.