I try to record and playback the Inputsignal of my Parallax360° Feedback Servo, using a Raspberry Pi4, Python and the pigpio library. The idea is that I move the wheel of the servo manually and record the pwm signals. Then I want to replay the signals automatically.
My problem is to convert the Inputsignal that is recorded with 910Hz to the Output signal which is transmitted with only 50Hz. The pigpio library offers a "piscope", which is a realtime digital oscilloscope. With the piscope I was able to see that my recordig and transmition of the signals works pretty precise, in general.
I tried to convert the inputsignal to the output signal with this approach:
I'm writing the time (in microseconds) of each high signal with the frequency of 910Hz to a file. Then I sum up 18 highlevels and transmit it to the inpput of the servo with a frequency of 50Hz (910Hz / 50Hz ~ 18). I do that in a row, until all recorded values are trasmitted to the servo.
Now the problem: The motion of the servo by recording is very different to the replayed motion. I'm pretty sure that my basic idea is wright, but there's a secret behind the conversion of the input- to the output signal.
Does anybody know this secret and can anybody please help me?
Thank you very much and best regards from Germany - Marcel