If one wanted to use a VNH5019 board (Pololu item #1451) with a Baby Orangutan B-328 instead of the onboard TB6612FNG in a way that kept within the spirit of, if not the letter of, OrangutanMotors.h/OrangutanMotors.cpp (I’m just driving one motor), how would one do that?
If I depart from the “tie-PWM-high and PWM-the-direction-pins” model that the library code uses for the TB6612FNG, Is there a PWM output I can access to drive the external VNH5019 PWM input?
If I’m not using OrangutanServos or OrangutanBuzzer, can I use Timer1 and its OC1A (Pin PB1) and/or OC1B (Pin PB2) to do PWM-ing to an external motor driver?
Apologies in advance if this is obvious or redundant. I failed to find it in a search and didn’t see an obvious code example for the VNH5019. If there is some example code for Baby O B-328 + VNH5019 please point me to it.
There really isn’t a good way to use the OrangutanMotors code to drive the VNH5019. One problem is that the AVR PWM outputs used with the TB6612 are not brought out and hence are not easily accessible on the board. Another is that the switching time of the VNH5019’s direction inputs is too high to allow them to be directly PWMed like we do on the TB6612. I think the better solution is to use Timer 1 to generate the PWM for the VNH5019 driver (as you’ve noted already, you will not be able to use OrangutanServos or OrangutanBuzzer code if you do this).
Our dual VNH5019 motor driver shield for Arduino connects each VNH5019 PWM input to one of the Timer 1 PWM outputs, so you can use our Arduino library for that product as a reference for how to do the same thing with the Baby Orangutan’s AVR. If you have any questions or want me to walk you through the code, please don’t hesitate to ask.
Thank You, Ben!
That looks exactly like what I was imagining.
For the benefit of those who follow, the “Pololu Dual VNH5019 Motor Driver Shield for Arduino” is item #2502 and in its specific “Resources” tab, just below the product description on the webpage, in the “Recommended links” section, is a link called “Arduino library for the Pololu Dual VNH5019 motor driver shield” which takes you to the appropriate github page where you can get:
and a demo application/sketch.
Again, many thanks. I don’t see a way to mark this topic as “answered” but for now it certainly seems that way to me.