how to detect the real zero crossing of an AC signal that caries an unkown dc offset
Rate quality
Private research annotation
Sign in to add a private research label or note.
- User
how to detect the real zero crossing of an AC signal that caries an unkown dc offset
- Assistant
To detect the real zero crossing of an AC signal that carries an unknown DC offset, follow these steps:
-
Measure the maximum and minimum voltage values of the AC signal using an oscilloscope or a voltage measuring device.
-
Calculate the average value of the AC signal by adding the maximum and minimum voltage values and dividing by 2. This will give you an estimate of the unknown DC offset.
-
Subtract the calculated average value from the measured signal to remove the estimated DC offset. This will leave you with an AC signal that is centered around zero.
-
Use a zero-crossing detection circuit or an algorithm to identify the precise moment when the AC signal crosses zero.
Note: If the DC offset is not constant but changes over time, you may need to continuously update the calculated average value and subtract it from the measured signal to accurately detect the zero-crossing points.
-
- User
can you provide me with an algorithm that i can use
- Assistant
Certainly! Here's a simple algorithm that you can use to detect the real zero crossing points of an AC signal with an unknown DC offset:
-
Set a threshold value for determining when the signal crosses zero. This threshold value should be a small positive or negative value close to zero (e.g., +/- 0.1 volts).
-
Initialize two variables, "previousValue" and "zeroCrossingTime", to track the previous sample value and the time of the last zero crossing respectively.
-
Iterate over the samples of the AC signal:
3.1. Read the next sample value, "currentValue".
3.2. Check if the previousValue and currentValue have different signs:
code
-