I’m planning on making my first saber with 2 servo motors adding movement to blade guards (neopixel and ability to play .wav files using smoothswing also required). Has anyone tried linking servos to a Proffie board, or is it much easier to go for a Teensysaber board that can control servo inputs via a shield and GPIO pins? Thanks!
Servos are fairly easy to control IF you have a timer available.
Basically, you set up a PWM signal for 50 updates per second, and then PWM value tells the servo which way to turn. The tricky part is that a single timer can do several PWM outputs at the same time, but they must have the same overall frequency, or it won’t work.
On a Proffieboard V2, there are four timers. For reasons that are only known to ST-micro, they are called TIM1, TIM2, TIM15 and TIM16.
TIM2 is generally tied up with driving neopixels, ,and is generally set to 800kHz
TIM1, TIM15 and TIM16 are used to drive LED1-6 as follows:
TIM1 drives LED3, LED4 and LED6
TIM15 drives LED1 and LED5
TIM16 drives LED2
Since you want to drive two servos, we could repurpose TIM15 for this purpose, and we could use the LED1 and LED5 pads to run the servos. For each channel we would need a pullup resistor (100ohms maybe?) connected between 3.3v and the LED pad. Then we just need to configure TIM15 to run at 50Hz and set the PWM width to control the servo. We can still use the other LED pads for LED power control.
Now, things works a little bit different on a Proffieboard V3. It has tan extra timer, so I was able to allocate one timer specifically for stuff like this. It his hooked up to three pads on the side of the board called Free1, Free2 and Free3. These pads won’t need resistors to run a servo, and it won’t interfere with how anything else on the board works.
Controlling some servos from a teensy is also pretty simple, but then of course you have to worry about hooking up an amplifier and a motion chip to get smoothswing working.
Thanks for the detailed explanation! This really clarifies things. Just a quick follow-up question: How long will the Proffieboard V3 be out? Looks like the V3 would be easier to control via PWM without the need for more space to cater for a few pullup resistors. I’m ok to wait about 1-2 months for it.
Unfortunately, I don’t know how long the V3 will take.
I just started the beta testing phase, and assuming that goes well, we’ll be ready for production in a month or so. Producing boards takes at least another month. However, with the current component shortage, it’s more or less impossible to know when V3 boards can actually be made. AFAIK, some of the required components do not exist in stock anywhere at the moment.
Pull-up resistors can be pretty small though as they don’t need to carry much current.
If it was me, I would probably have a small pin connector for connecting to the servo, and the pull-up resistor would just go on the back of that.