PWM - (Baby O and VNH5019) - Absolute newbie

Hello everyone. I am trying to use a Baby Orangutan and potentiometers to send signals to a VNH5019, in order to control the speed and direction of one motor. I think I understand the logic behind how to program signals to INA and INB. However, I can’t seem to grasp how to control speed with the PWM input to the VNH5019. I am absolutely new to this world and would appreciate any guidance anyone can offer. Is there a book that could help get me started programming in C? Pololu has some great resources and code, but I feel like I really need help from the very beginning. Thank you so much for any help.

Thank you,


P.S. Eventually I hope to actually control the speed by using two simple push buttons (interrupt switches) to change the EPROM. If the logic is simpler for controlling the speed this way instead, that would be great. I will do that instead. I still want to control direction with a potentiometer.

Hello, Walter.

I spoke to you on the phone earlier today, and as I suggested to you then, using an Arduino might be an easier way for you to get started with the VNH5019. We have a dual VNH5019 motor shield that plugs directly into an Arduino, and we provide an Arduino library that makes it simple to interface with the shield. Even if you want to use a single VNH5019 carrier, you might still be able to use the library (if you replicate the connections the shield makes) or at least use it as a starting point for your own code. The user’s guide for the shield has more information on using it with an Arduino.

As an alternative, you could use Timer 1 on the Baby Orangutan to generate the PWM for driving the VNH5019. The library for the dual VNH5019 shield uses Timer 1, so you can probably still use that as a reference for how to do the same thing with the AVR on the Baby Orangutan. For a more general overview of AVR timers, you might find this guide helpful, although I have not looked at it closely.

- Kevin

Thank you so much for your reply. I am trying to use the Arduino method that you told me about with the VNH5019. I think I figured out the pin mapping. These are my pin assignments:

Digital 2 = INA
Digital 4 = INB
Digital 9 = PWM
+5 Volts = VDD
Ground connected to ground.

For power to the Arduino Uno, I plugged into the USB port. For the VNH5019, I used batteries plugged directly into the board
However, it still isn’t working using the demo library. My guess is that the library for the duel VNH5019 really won’t work with the VNH5019. Is that correct? Of course, I understand that the code applies for the duel VNH5019 which controls two motors.

Thanks again,


I think those are all the connections you should need, and the library should still work with just one driver (although it will still try to drive the pins where it thinks the other driver is connected, so you probably should not try to use those pins for anything else). Are you using the example program that comes with the library?

What kind of and how many batteries are you using to provide the motor power? Could you post a clear picture of your setup showing all your connections?

- Kevin