I updated my software to store the resistance value and then bump it up or down with the difference in the voltage. Since I'm reading the analog inputs, I get values between 0 and 1023. So the difference is at most -1023 and +1024. The digital pot has steps from 0 to 255. So I store the resistance as a 16-bit number, and then right shift by 8 to get the value to send to the pot. Each timestep I take the voltage difference and subtract it from the resistance value. This is a simple way to do it for now, but I'll want a more sophisticated and adjustable response later.
Next I'll get the digital outputs switched to PWM and try to do two out-of-phase sine waves. Then I should have something good to show on the scope.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.