Tonight, I took a break from my Rotor Master and picked back up trying to figure out measuring motor timing. I haven’t forgot about this project, but progress is slow… Hopefully though, I have made a breakthrough. After some pondering about the issue, I finally decided to put look at the signal for the virtual common created by the resistors tying the 3 phases together. I expected this to be a more or less stable voltage that was ½ the bemf voltage on the phases. But that is not the case. The duty cycle (pwm frequency) plagues the common neutral just as much as it does the bemf signals, also the neutral is a trap wave as well. So using a comparator on the crossings of 2 inverting signals, both cut with pwm, no wonder I was having issues. A while back a made a board that had a few sensors on it and some resistor divider networks so when I wanted to “tinker” I could use it and run wires to an Arduino from it. So I broke that out, along with the SkyRC analyzer, and my Arduino nano with a bread board and a bunch more resistors.
So here was my thought for the evening, instead of using the virtual common created by the phase wires, I would use the power source with a couple of voltage dividers. My setup is using voltage dividers on the bemf to start, so I used the same divider on my battery then another voltage divider configured to half that again. Thus in theory giving me a stable output around 1.65v. I would then use this as my non inverting signal for the analog comparator in the Arudino.
Now, the second issue to overcome. PWM on the bemf signal. Sure, full duty cycle gets you the signal with no pwm, but I really want to get to a point where I can measure timing under the full duty cycle. Tonight I decided to try a low pass filter on the bemf signal. I tried a few different cutoff frequencies and watched the response of the signal on my scope. What I came to realize, was making the cutoff too low made the rise time on the signal too long. What this does is ultimately push the “zero crossing” out a bit. With that in mind I had to make a filter with a cutoff of approximately 30khz. Which isn’t low enough but it is a start. The experiment was a partial success. The filter did attenuate the pwm signal enough that I was able to get timing at about 90% duty cycle.
There are still some tweaks to work out, one being the voltage used as my non inverting signal is off slightly which causes some variance, another is to get a good filter value that doesn't mess the results up. I think I am going to go back to an external comparator as well to take that load off the Arduino. But in the end, I think this is going to need a faster mcu.
Here are some photos of tonight's work.
In the scope pics,
The yellow signal is the signal from the hall sensor on phase A.
The blue signal is the output from the comparator on my Arduino
The pink signal is the signal of the bemf after going through a voltage divider and the low pass filter
The green signal is the stable voltage that I am comparing the bemf to for the zero cross. I adjusted the green signal to be about half way through the pink for a visual reference.
The first two pics show the SkyRc output compared to my scope. This is appx 80% duty cycle and you can see the chopped pink signal touching the green signal still, the output of the comparator is show with the blue square wave. Timing can not be read here because there are too many crossings.
Crazy setup!
The next pic show approximately 90% duty cycle. See how the chopped pink signal is no longer touching the green line, thus giving a good zero crossing. Notice the blue signal looks like a good square wave and see the output from the arduino is getting timing results.
And finally, 100% duty cycle. But I had gotten to this point before...