PWM servo drive from zombieverter: possible?/code snippet? /instuctions?

Post Reply
ted.walsh
Posts: 35
Joined: Fri Jun 19, 2020 10:24 pm
Location: Ulverston UK Lakedistrict
Has thanked: 12 times
Been thanked: 20 times
Contact:

PWM servo drive from zombieverter: possible?/code snippet? /instuctions?

Post by ted.walsh »

All,
I’d like to drive 1 if not 2 model servos off the VCU. Can this be done directly without any extra hardware using the existing board? I can see 1pwm output for driving an oil pump but can it be coded for servo 50ms operation?

If you’ve done this then huzzar! can you throw me some bones on how it works?

if anyone has a better way of driving small indicators like air core steppers etc off the zombieverter directly then again i’m all ears so please point or let me know the way?
TIA!
royhen99
Posts: 254
Joined: Sun Feb 20, 2022 4:23 am
Location: N. Wiltshire. UK
Has thanked: 21 times
Been thanked: 124 times

Re: PWM servo drive from zombieverter: possible?/code snippet? /instuctions?

Post by royhen99 »

PWM1_OUT, PWM2_OUT, PWM3_OUT may work. They are 12V outputs so may need a resistor divider to get to the correct voltage.
I haven't tested with a servo but have measured the frequency and tested with a LED.

Select PWM output for PWM1Func - PWM3Func in General Purpose I/O
Under PWM Control set the pre-scale, period and OC values.
Several values will work but these give good resolution. I am assuming you meant 50Hz / 20ms which is the normal servo timing.

Tim3_Pres 71
Tim3_Period 20000
Tim3_1_OC, Tim3_2_OC, Tim3_3_OC 1500 this is centre value for 1.5ms pulse. This could be mapped to a CAN id to allow control.
Post Reply