I finally got the electronics for my Turntable Drawing Machine working. It wasn’t easy…
I decided to use a DC gearmotor controlled by an Arduino and potentiometer for the speed. I did a quick test of this with a Leonardo and a DRV8835 Dual Motor Driver Shield for Arduino. It worked fine for controlling the speed of the motor, but I didn’t really want to use the shield, so I used a DRV8835 Dual Motor Driver Carrier I had on hand. (Since I’m only using one DC motor, I probably could have used a DRV8838 Single Brushed DC Motor Driver Carrier.)
Pololu has an easy-to-use Arduino library for the DRV8835 Dual Motor Driver Shield which worked fine for the shield, but doesn’t (I mean didn’t) work with the DRV8835 Dual Motor Driver Carrier. I ended up hacking the library a bit to make it work. All was well until I added a servo. Since the Arduino library for the shield is hard-coded to use pins 7, 8, 9 and 10 there’s an issue because the default Arduino servo library disables PWM control on pins 9 and 10. I then changed the library to not use pins 9 and 10, but that still didn’t quite work… Seems that the servo library and the motor control library both need to use timers, so there’s some weirdness there…
I ended up digging through the forums and eventually found some useful posts and a link to ServoTimer2.zip. (It’s worth noting that there are a number of ServoTimer2 libraries, but I tried this one and it worked.)
Once I had the ServoTimer2 library in place, getting it to work with the my hacked ‘DRV8835DualDriver’ library was simple. (I’m saying “simple” but it took a few hours of screwing around with things that should have worked but didn’t) If I had used one of the Arduino Megas I had lying around, I probably could have avoided some of the issues the Servo library causes.
Alright, well… electronics seem good! Next step is to build things, and get the turntable portion constructed to test if the DC gearbox will work out. I think it will, as it’s got plenty of torque, and there shouldn’t be much resistance.