Trying to interface Electron with DRV8833 to power 3V DC motor

Hi guys, while I’ve played around with Arduino’s and Raspberry Pi’s, I’m new with interfacing the Particle Electron with breakout boards. I’ve tried looking around this forum and tried several code examples to similar boards, but i’m not having any luck.

I’m trying to turn on my DC motor when my accelerometer/gyro (MPU6050) is at a certain angle. I have the accelerometer/gyro code working and have the angles calculated. However I can’t seem to get my DC motor to turn on. I read from one post that I can power the motor from the 3V3 pin, so here’s how I have my DRV8833 setup:

(Electron board pins) -> (DRV board pins)
3v3 -> VM
GND -> GND
A4 -> AIN1
A5 -> AIN2

(DRV board pins) -> (DC Motor)
AOUT1 -> DC motor terminal
AOUT2 -> DC motor terminal

Am I missing some connections?

Here’s a snippet of my test code:

#define AIN_1 A4
#define AIN_2 A5

void setup() {
pinMode(AIN_1, OUTPUT); //Ain1
pinMode(AIN_2, OUTPUT); //Ain2
}

void loop() {
digitalWrite(AIN_2, LOW);
digitalWrite(AIN_1, HIGH);
delay(1000);

digitalWrite(AIN_1, LOW);
digitalWrite(AIN_2, HIGH);
delay(1000);
}

Thanks for your time and if you have and feedback, I greatly appreciate it.

Are you enabling the driver by pulling the SLP pin HIGH?

1 Like

I can’t believe I glanced over that documentation and missed the part where you have to set SLP pin to HIGH. Thank you @ScruffR. Once I did that it worked like a charm.

Is it better to leave SLP set to HIGH all the time or switching it to HIGH before turning on the motor and switching it back to LOW after turning off the motor?

1 Like

It’s usually better to let go of the motor coils when you don’t intend to run it.
That’s particularly the case when you driver steppers with drivers like the A4988 where you just provide a step pulse to move one step, since as long the driver is enabled the coils will be energized to hold the torque which causes the coils to heat up.

1 Like

I see. That makes sense. I’ll keep that in mind especially when I’m using steppers in my project.
Thanks for the tip. I will set it to LOW after I’m done.