Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinZikmund/64749aedffdd200a2412c34a0c490549 to your computer and use it in GitHub Desktop.
Save MartinZikmund/64749aedffdd200a2412c34a0c490549 to your computer and use it in GitHub Desktop.
Yes, you're on the right track with your proposed circuit design. You'll want to implement a high-pass filter in your conditioning/amplifier circuit to isolate the knock frequency of interest (around 7.6 kHz). This will help eliminate unwanted low-frequency noise that could falsely trigger your knock control system.
Here's an outline of your circuit with the high-pass filter included:
Input protection: Use a TVS diode with a breakdown voltage slightly above the max voltage to protect against voltage spikes.
High-pass filter: Implement a high-pass filter to isolate the knock frequency (around 7.6 kHz). This can be done using a passive RC filter or an active filter with an operational amplifier (op-amp). The choice will depend on your requirements and available components.
Rectifier stage: Use a full-bridge rectifier to convert both positive and negative AC voltage signals into a positive DC voltage.
Amplification stage: Use a non-inverting amplifier with an op-amp to amplify the filtered and rectified signal.
Output protection: Use a 5V Zener diode connected to ground to protect the output from exceeding the 5V limit of the MegaSquirt 2 analog input.
When designing the high-pass filter, you will need to calculate the appropriate component values for the desired cutoff frequency (7.6 kHz). For a passive RC filter, you can use the following formula:
f_c = 1 / (2 * π * R * C)
where f_c is the cutoff frequency, R is the resistor value, and C is the capacitor value. For an active filter, you may need to consult the specific op-amp configuration's design equations.
Once you've designed and built the circuit, test it with a known knock signal to ensure that it functions correctly and provides a reliable connection to the MegaSquirt 2. After successful testing, you can integrate it into your knock control system.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment