Skip to content

Electrical Signals

NSFW edited this page Oct 5, 2018 · 1 revision

This first picture shows what all the signals should look like. The top signal is from the optical crank position sensor, and the two lower signals come from the factory cam position sensors. Cam angle is determined by the time that elapses between the leading edge of the crank position signal and the leading edge of the cam position signal.

Early in the project I was getting erratic readings from the crank sensor. After struggling to figure it out, someone wiser than I suggested buying an oscilloscope. So I did. And when I figured out how to zoom in to 50 microseconds, the problem was pretty obvious. The signal transitions from high to low and back many many times during what should have been a single high-low or low-high transition. Since the Arduino calculates RPM based on the time between high and low transitions, this meant that I was getting very, very erratic values sometimes.

The solutions was a .1uf (104) capacitor:

The cam sensor signal had its own surprises. The top trace here shows the raw signal from the cam sensor. Ignore the middle trace. The bottom trace shows a blip when the Arduino sees a transition from high to low or vice-versa. The interesting thing is that noise in the raw signal causes the Arduino to see as many as three transitions when the signal is approaching the high state. The actual timing math is done during the high-to-low transition, but these extra transition still bothered me.

Before I started doing actual cam control, I was calculating RPM based on signals from all three sensors (the crank and both cams), and the extra transitions caused by this noise would result in wild RPM numbers. That meant I couldn't trust the sensors; I didn't want to attempt cam control until I could at least get solid RPM readings.

The solution was to average a number of samples after each transition detected by hardware, and only recognize a transition when the average clearly indicates a transition. Unfortunately I didn't think to get a picture of the scope after I got that working, but the logic for that is spelled out pretty clearly in the code.

Clone this wiki locally