LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DC motor directional control

Hi all,

I'm trying to use DRV8833 motor driver to drive a small DC motor forwards and backwards.

 

My goal is to move a potentiometer knob and compare it to a numerical control that I set (called "Desired Reading" in the .vi). Depending on whether the delta is positive or negative, I'd like the motor to move forwards or in reverse. 

I'm using DAQ USB 6001. 

 

I'm having the following problems: 

- Maybe my physical wiring is incorrect, but the motor does NOT switch directions when the delta switches signs from positive to negative.

- Sometimes, the motor continues to receive power even when I stop running the VI and I don't understand why? 

 

I've attached my .vi below. Thanks!

 

 

0 Kudos
Message 1 of 47
(5,013 Views)

Your negative delta is being fed into the duty cycle of simulate waveform.

 

What do you expect to happen with a negative duty cycle?  What does that even mean?

0 Kudos
Message 2 of 47
(5,010 Views)

Probably a good time to mention I'm a bit of a noobie, but I am trying to learn. 

 

-DC% didn't make sense to me either, but I got the idea from another thread so I figured I'd try it out. They said something about how this works if you have an analog I/O card, which I do on the DAQ USB 6001

0 Kudos
Message 3 of 47
(5,008 Views)

Try writing out +5 to a DAQmx Analog Write.  See what happens.

Try writing out -5.  See what happens.

Try +2.  -2.  zero.

 

Just get rid of the the square wave simulation.

0 Kudos
Message 4 of 47
(5,000 Views)

Hey, I just tried it out. 

I used the Simulate function to simulate a DC signal at:

 

+5 -- CW rotation

+2 -- CW rotation

0, -5 and -2 -- No rotation.

 

I know my motor can go in both directions though, I see it if I reverse the leads. What gives? 

0 Kudos
Message 5 of 47
(4,993 Views)

The manual says the analog output is +/- 10 V.  And changing the polarity should reverse a DC motor.

 

Check the voltage output from the DAQ device with a multimeter.

 

Show a wiring diagram.  Show your latest VI.

0 Kudos
Message 6 of 47
(4,965 Views)

Okay, I just tried with a multimeter. Here is my simple VI, I control the DC offset to set the output voltage to my motor.

image.png

 

 

Using a multimeter, I can confirm that for positive offsets, I'm picking up on my multimeter the value of the offset.

For 0 voltage, I pick up a -2.43 V.

For negative values for the offset, I pick up a constant -0.743 V. 

 

Neither 0 or negative offset values cause any rotation of the motor. 

 

----

 

 My wiring is shown below:Driver Wiring.png

 

 

 

0 Kudos
Message 7 of 47
(4,955 Views)

Hi mm,

 

why do you need an expressVI to output a  dcvalue?

 

How much current do you draw from that +5V pin? Do you still read 5V after attaching the circuit? Did you read the manual about this 5V pin?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 47
(4,952 Views)

yeah, I've seen quite a few people using DAQmx. I'm more comfortable with Express VI so I default to that, especially when I'm on a time crunch. 

 

As for your questions, I'm using a DRV8833 driver so I presume the adequate current is being supplied to the motor? I've read the manual for the pin, but I'm not sure what I'm looking for here.

0 Kudos
Message 9 of 47
(4,944 Views)

Hi mm,

 

as you have drawn in your sketch you use that +5V pin to supply the driver as well as the motor. The manual states a max 150mA current from this pin: again I ask about the current consumption of your setup...

 

Which voltage do you measure on that pin when your driver and motor is attached?

What about using an external power supply for your setup?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 47
(4,939 Views)