No worries!
It took much longer than anticipated, but I finally got to test this, and I can confirm that it works indeed!
I used a MPC6041 and configured it as unity gain amp as follows:
- VSS to GND (GPIO20)
- VDD to 3.3V (GPIO17)
- VIN+ to PWM0 (GPIO32)
- VOUT to VIN- (on MPC6041)
- VOUT to PWM Signal
No resistors were required.
Thank you for the help with this @Josh1745!
1 Like
And here a little helper script that simplifies setting the PWM value in percentage:
set-pwm.sh
PERCENTAGE=${1:-100}
PERIOD=${2:-5000000}
CYCLE=$(($PERCENTAGE * $PERIOD / 100))
cd /sys/class/pwm/pwmchip0
if [ ! -d "pwm0" ]
then
echo 0 > export
fi
cd pwm0
echo $PERIOD > period
echo $CYCLE > duty_cycle
echo 1 > enable
It can be used as follows:
./set-pwm.sh 0
./set-pwm.sh 50
./set-pwm.sh 100
1 Like
Glad to hear it, and nice script to test!
1 Like