Hi Walter,
You are correct and just a minor "brain cramp" with the * vs /. With the logic analyzer results (Pulse Width.doc) the results showed a T1 of 502 which is why I used this number. The sensor document, 28017, says the "duty cycle" can be from 48.7% to 51.3% so the logic analyzer reading of 50.2% made sense. In the formula they use 50%. It is also assumed that the pulse timing is 10 ms which would be true if if the PWM signal were 100 hz. Again the logic analyzer show a frequency of 101 hz so the overall timing becomes 9.9 ms. Okay, both are minor corrections. You can not do a divide by 9.9 as it is not a whole number so to change the *2 to *20 allows the divide by 99 (9.9). Where I am having trouble with the formula is that if you point the sensor front edge down by 30-40 degrees then xRaw reading becomes about 414 which results in a number in the 65,000 range as 414 - 494 will give a result of -80. My best guess is that one would have to a lower number such as the 414 rather than 494 for the range of the sensor pointed down? Thanks, Ed
Bookmarks