KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
The quick version: What algorithm could I use to determine the "phase difference" between two square wave signals with different frequencies, if the only information that I have is the time at which each rising edge occurs? The detailed version: I'm working on an embedded software project, and I have run across an interesting problem. I am collecting data from two hall-effect speed sensors , which are each aimed at one of two meshed gears, as shown in the following diagram: note: As Jaime pointed out, the signals in this diagram would actually have identical frequencies. The real hardware has several more gearing stages between the two target gears, some of which are connected by shafts instead of meshed teeth, so I do end up with two square waves that have different frequencies, and the ratio between them is still a constant. I wanted to simplify the diagram to get to the meat of the matter, but it looks like I simplified it too much! /note The speed sensors output a square wave signal whose frequency is directly proportional to the rotational speed of each gear. The rising (and falling) edges of the square wave occur when the leading (and trailing) edges of a single gear tooth pass by the sensor. I know how many teeth are on each gear, and based on this information I am able to accurately measure the rotational speed of each gear based on the frequency of the square wave signals. To measure the frequencies, I have each speed sensor signal connected to a high-speed capture timer pin on t
Tags (comma-separated)
Save Edits
Cancel