Hello About Robot Hat v4 VS PCA9685 that supports 12-bit 333hz outputs

Hello :slightly_smiling_face:

is the Robot Hat v4 support servo output at 333hz 12-bit ? how many servo i can drive at this speed?

is this better than PCA9685 that supports 12-bit 333hz outputs ?

Please let me know !

Thanks

Have a wonderful day

1 Like

Sorry, we haven’t used a 333hz servo, but the Robot Hat can be set to output a 12bit 333hz PWM signal.

1 Like

Thanks for your help
How can i do that? What is the code for 333hz 12bit.
Can i supply the servo motor with more than 5v like 9v ? Or it supports only 5v output?
Thanks

  1. robot_hat’s PWM is similar in operation to the PCA9685. robot_hat provides 12 PWM output pins, as well as 5v pins, if you need 9v power you need an additional power supply circuit to power the servo.
  2. Here are some references: class PWM — SunFounder Robot HAT documentation
    021803
1 Like

Sorry, didn’t pay attention to your precision requirement, if you use freq() it will automatically calculate the period and crossover frequency so that the precision is random, using period() and prescaler() you can set it manually,. The period is the precision power of 2, i.e. 4096. The prescaler is equal to the CPU frequency 72Mhz / period / frequency. That is 72000000 / 4096 / 333 = 53
from robot_hat import PWM
p0 = PWM(0)
p0.prescaler(64)
p0.period(4096)
print(f “Frequence: {p0.freq()} Hz”)
print(f “Prescaler: {p0.prescaler()}”)
print(f “Period: {p0.period()}”)

Set pulse width to 2048 which is also 50% of

p0.pulse_width(2048)
print(f “Frequence: {p1.freq()} Hz”)
print(f “Prescaler: {p1.prescaler()}”)
print(f “Period: {p1.period()}”)

set pulse width to 50%

p0.pulse_width_percent(50)

Set pulse width to 2048 which is also 50%

p0.pulse_width(2048)

1 Like

Hello :slightly_smiling_face:
Thanks for your emails
so the p0.prescaler(64) or is it p0.prescaler(53) ?
what do you think🤔

Oh, we’re sorry. The correct crossover value is 53.

1 Like