Today I decided to begin work on the body of the tennis ball machine by setting up the motors. I am using an arduino uno to control the machine itself, and BTS7960 Motor drivers to drive motors from two scavenged mini drills. The drills come with motors as well as rechargeable lithium batteries, and so are perfect because I know I have a rechargeable battery with a power-management chip designed to work with the motors I am using. However, depending on how long these batteries last, I may switch over to others later on.
On the wiring side, I connected the VCC, R_EN, and L_EN pins to the 5V from the arduino. This powers the motor driver and permanently enables both directions on the motor. Ultimately, I will most likely disable one of the two directions, however while I am testing there is no reason to do so. I connected the LPWM and RPWM to PWM capable pins on the arduino and then the positive and negative leads from the motor and the battery to the larger wire receptacles on the motor driver (Battery to B, motor to W). Everything seemed pretty self explanatory, and no research I have found so far uses the two _IS pins. More information can be found in this instructable and on this blog.
I began with some simple test code to ensure my motor was running. After setting the two arduino pins to output, I wrote the highest PWM value (255) to LPWM, waited ten seconds, wrote 0 to LPWM, and waited 5 seconds and then did the same for RPWM. The motor starts and stops almost instantly, so the delay times were no necessary. The starts and stops were quite abrupt so in the future I may use a for loop to ramp the motor up and down more gradually. However, everything worked, and I was able to control the motor successfully. From here on out, I just need to finish the code for the controller and build the mechanical portion of the launcher.