<< return to Pixycam.com

Motor Controller

Hello,

I am very new to programming and don’t quite understand much yet. I am trying to use my pixy camera to control a stepper motor controller with the Pixy Pet Robot Code to Arduino uno. I noticed when going through the code and other forums, that it seems to be written for a DRV8835 servo controller, but I am trying to use it for a DRV8825 stepper controller. I was questioning if this would work because when I go into the ZumoMotor.CPP file (I believe it is called) that it is specifying pins 7 & 8 for Direction and 9 & 10 for PWM.

As of right now, it “Chatters” the stepper motors or keeps them in a locked position. Is there something that I would have to do to the code to fix this issue?

The reason I thought I could do this is because of the DIR and PWM pins being declared, the DRV8825 requires a DIR and Step pin.

Thanks for any help,
Jonmarc

I suspect that’ll you’re going to need to integrate Pololu’s DRV8835 code into your project. Driving a stepper motor is completely different than driving a standard brushed DC motor with a PWM controller. What you’re wanting to do is definitely possible, it’ll just be approached differently. PWM code typically sends a PWM signal of a certain frequency to the controller, and the frequency of that PWM signal determines the angle of the servo (unless it’s a continuous-rotation servo, and the frequency determines the speed). A stepper motor is much more precise, but it involves sending “steps” of on/off/on/off signals. Each step turns the motor an exact number of degrees, and you can then know absolutely where your motor is.

The stepper code for Pololu’s DRV8835 is here:

I’d recommend first getting that stepper code working with your Arduino. Once you’ve got that working, you can probably start integrating its “includes”, its two lines of setup() code, and then finally its stepper.setRPM() and stepper.setMicrostep() lines into your robot code.

Hello, did you find a solution to your code?