Please HELP ! Arduino + DRV8825 + Nema 8 + Rotary Encoder Setup

Hey everyone ,

I am completely new to this forum as well as to everything that has to do with coding , motors , etc ...

What i've been trying to figure out (not having knowledge nor experience about everything that has to do with mechanics) , is how to make my setup work . My goal is to create a type of follow focus mechanism for a big photography lens i have .

Here is an example of what i am trying to create , found this guy who had the same idea and already did it (i have the same lens) : [DIY] Motor Focuser for Telephoto Lens-MotorTest - YouTube

The pieces i bought are :

Arduino Uno
DRV8825
Breadboard
Wires
Rotary encoder
Nema 8 stepper motor
Rechargeable 12V battery

I attached a couple pictures so you can see my setup till now . I actually followed the instructions on one of the pictures attached .

Something weird happening (i don't know if it's normal) , whenever i connect the negative of my battery to the GRD and the positive to the VMOT of the drv8825 , while the arduino uno is connected to my pc , i get a weird noise coming from my macbook pro .

Anyways , i would really appreciate everyone's help . This could really be complicated for someone not having any past experiences with the subject , and i feel that my brain is about to explode trying to figure out something i'm totally not familiar with .

So if anyone is able to help with the setup (as a start) , i would be more than grateful . Then the only thing left to do is coding , but we'll get to that later on .

Cheers

640px-DRV8825-Montage_Rouge-Bleu-Vert-Noir.jpg

Images from Original Post Reply #NN so we don't have to download them. See this Image Guide

f2615b1a6e86d6d52a38ecb2e094b011425f0f65.jpg

...R

guykhoury9:
Something weird happening (i don't know if it's normal) , whenever i connect the negative of my battery to the GRD and the positive to the VMOT of the drv8825 , while the arduino uno is connected to my pc , i get a weird noise coming from my macbook pro .

I am not going to pretend to know anything about any sort of MAC.

My guess is that you have a serious wiring error and run the risk of causing expensive damage

Fritzing diagrams are not suitable for reliably conveying information. For one thing, one cannot read the labels on the boards. Make a simple pencil (or pen, if you are daring) drawing of all of the connections and post a photo of the drawing.

Also, for the future, photographs of the hardware are not generally useful either.

...R

Thanks for replying .

I just made a drawing explaining my wiring . Whenever i connect the 12V's negative to GND and the 12V's positive to VMOT , i get smoke coming from the DRV8825 after about 10 seconds .

I attached the image below .

Thanks again

In Reply #1 I gave you a link so you could learn how to display your images properly without me needing to do it for you.

Image from Reply #3

...R

Why have you connected FAULT to 5v? FAULT is an output from the driver to tell the Arduino there is a problem. There is no need to connect it to anything.

The Pololu DRV8825 web page has a very clear wiring diagram.

Why do you appear to have two 5v pins on your Uno?

...R

Like i said , having no experience with all this i am following wiring images found on google .

I know it's not the right way do do things , but with the knowledge i currently have (trying to understand something completely new) , google images was my only option .

Not wanting to give up , that's why i came here on this forum seeking for help .

I just checked the Pololu image on their web page , it actually differs from other images (a little bit) found on google , so yea i just unplugged the 5V from Arduino going to Fault .

And about the double 5V pins , not sure why .

In order :

empty pin
5V
Res
3.3V
5V
GND
GND
VIN

That's what's written on the Arduino UNO (Left side) .

Forgive my "noob" question , but what is the logic power supply 2.5-5.25V on the Pololu wiring image ?

I don't have anything called VDD aswell on the arduino , i guess that's the 5V pin ?

I appreciate your help .

I guess the logic power supply is another power source for the Arduino ?

Would 2x AAA=3V batteries work ?

and where should i connect the 5V pin coming from the Arduino ?

Thanks

guykhoury9:
That's what's written on the Arduino UNO (Left side) .

Forgive my "noob" question , but what is the logic power supply 2.5-5.25V on the Pololu wiring image ?

I don't have anything called VDD aswell on the arduino , i guess that's the 5V pin ?

You must have an Uno clone as my genuine Uno R3 does not have the second 5v pin. I assume if it is marked 5v that it is so work with it if you need it - but not for FAULT :slight_smile:

All Pololu means is that any voltage in the range 2.5 to 5,25 volts will be OK.

Yes VDD means the 5v pin

Would 2x AAA=3V batteries work ?

and where should i connect the 5V pin coming from the Arduino ?

I don't understand what you had in mind when you asked these questions.

...R

Didn't know clones of the Arduino existed .

Anyways , my question was , what should i connect the Arduino's VDD/5V pin (which i had previously on Fault) to ?

Correct me if i'm wrong , the way i understood the image on Pololu is :

I get a power source ranging from 2.5 to 5.25v , which 2x AAA batteries would work in this case .

I connect the positive of those batteries to the 5V pin on the Arduino , as well as the Reset and Sleep pins on the DRV8825 .

And the negative of the 2x AAA batteries should be connected to the GND pin of the Arduino as well as the GND of the DRV8825 .

Correct ?

And as for the 2nd power supply , i could use a 9V battery to power the motor (NEMA8) , connected at VMOT (+) and GND (-) .

Correct also ?

Thanks

guykhoury9:
Anyways , my question was , what should i connect the Arduino's VDD/5V pin (which i had previously on Fault) to ?

I don't think you need to connect it to anything.

Correct me if i'm wrong , the way i understood the image on Pololu is :

I get a power source ranging from 2.5 to 5.25v , which 2x AAA batteries would work in this case .

Why would you need batteries - just connect to the Arduino's 5v pin

And as for the 2nd power supply , i could use a 9V battery to power the motor (NEMA8) , connected at VMOT (+) and GND (-) .

If you mean a PP3 style 9v battery then the answer is NO - they do not produce enough current for a motor.

And, anyway, 9v is very low. The DRV8825 can take up to 45v. I don't think you have posted a link to the datasheet for your stepper motor so I don't know what its requirements are.

These links may help. I forgot to include them earlier
Stepper Motor Basics
Simple Stepper Code

...R

Robin2:
I don't think you need to connect it to anything.
Why would you need batteries - just connect to the Arduino's 5v pin

How are you saying that i don't need to connect it to anything , then saying to connect it to the 5V ?!

What should be connected to the Arduino's 5V pin ? I don't understand

Never mind , i got it working !!

Turns out that the DRV8825 was already fried , and i replaced it with a new one , and everything seems to be working now ... except the motor's movement which is completely normal .

Step 1 (Wiring) : Done

Step 2 (Coding) : Is anyone able to help me out or point me to the right direction on how to achieve the particular movement that i'm looking for ?

I want the motor to turn the SLOWEST rotation on either CW or CCW depending on how i turn the rotary encoder , and i want precision , meaning i turn the rotary encoder by ONE click , turning the motor only ONE turn , and by turn meaning the MINIMUM that the motor can turn .

Thanks

Update : Driver number 2 (DRV8825) fried again ...

Not sure what's causing this , but could it be the lack of a capacitor ?

guykhoury9:
How are you saying that i don't need to connect it to anything , then saying to connect it to the 5V ?!

I was responding to the way you asked the questions. It seemed like you thought it would be wrong to leave the 5v pin unconnected.

Later you asked about where you would get 5v from for the Reset and Sleep pins. And you could connect those pins to either of the 5v pins on your Arduino - so it would be quite possible to leave one 5v pin unconnected.

A quick way to fry a stepper driver is to disconnect the motor from the driver when the driver is powered up. Even a loose connection that momentarily disconnects can cause the damage.

Perhaps you can remind us what movements you want the motor to make?

...R

Basically the modifications that i did to make it work were :

  1. Replaced the driver DRV8825 with a new one
  2. Got 2 AAA batteries = 3V and connected their POSITIVE to the 5V pin of Arduino as well as the RESET and SLEEP of the Arduino , and their NEGATIVE to the GND of the Arduino as well as the GRD of the Driver DRV8825 .

It worked just like the way it is supposed to work since i copied a code of some Video tutorial on youtube and uploaded it to Arduino .

Unplugged the 12V battery connected to the Driver DRV8825 .

A couple minutes later wanted to test it again .

Plugged the 12V's Positive to the Driver's DRV8825 VMOT , and the Negative to the GRD (just like it was wired in the first attempt when it worked) , and noticed some smoke coming again from the Driver ... So i think i fried it again .

So i don't think the motor got disconnected by itself , i might believe that it's the lack of a capacitor that did this .

What could the problem be ?

Should i order some 100uf 50V capacitors ?

I'm ordering a couple Drivers DRV8825 as well .

Here is my 12V Battery Specs btw (might be the problem) :

Input Voltage:DC 12V
Output Voltage:10 to 19 Volts
Output Current:about 2-3A
Input voltage :AC220V-240V ,50HZ
Charging voltage:about 14-15VAC
MAX charging current:MAX about 3A For Lead acid battery


Anyways here are my NEMA 8 motor specs :

Certification:ROHS,CE,ISO
Type:Hybrid
Phase:2Model
Number:Stepper Motor 20HS28064
Step Angle(degrees):1.8
Holding Torque:1.4N.cm
Current / Phase:0.6A
Step Angle Accuracy:±5%
Resistance Accuracy:±10%
Ambient Temperature:-20~+50 degree
Dielectric Strength:500VAC/1 minute
Body length:28mm
Insulation Resistance:100MΩ Min.500VDC
Frame size:NEMA 8, 20mm

Now for the Motor Movement , like i stated in the earlier post , i would like the Motor to turn the LEAST it can per click on the Rotary Encoder .

When rotating the Rotary encoder , you can feel clicks with each turn . So i would like the motor to turn depending on the direction (either CW or CCW) of which i turn the Rotary encoder .

A very clear example is in this video :

Thanks Again for your help

What are the AAA batteries for - that makes no sense to me. If you have them in series with the Arduino's 5v you will be connecting 8v to the driver - I thought its upper limit was 5,25v?

Make a simple pencil drawing showing how YOU have everything connected and post a photo of the drawing. Please DO NOT use Fritzing.

If the Pololu connection diagram recommends a capacitor then use a capacitor.

Separately, have you written a short program that can detect the movement of the encoder correctly and show the results on the Serial Monitor? If not do that before trying to amalgamate the encoder with the motor.

...R

The AAA batteries are what is called the "Logic power supply" on the wiring instructions image found in the Pololu website .

I attached a picture below .

It's really useless to draw an image in this case since i did EXACTLY what this image says , just minus the capacitor .

0J4232.600.png

Robin2:
Separately, have you written a short program that can detect the movement of the encoder correctly and show the results on the Serial Monitor? If not do that before trying to amalgamate the encoder with the motor.

I don't really understand what you mean here .

guykhoury9:
The AAA batteries are what is called the "Logic power supply" on the wiring instructions image found in the Pololu website .

That just means the normal Arduino power supply. I presume your Arduino is taking power from the USB cable connected to your PC. The thing in the Pololu diagram called "microcontroller" is intended to be your Arduino. You DO NOT need batteries - I told you that in Reply #10.

And I asked you to post a diagram of YOUR connections - not a picture of Pololu's connections

Separately, have you written a short program that can detect the movement of the encoder correctly and show the results on the Serial Monitor? If not do that before trying to amalgamate the encoder with the motor.

I don't really understand what you mean here .

What is complicated about it? Let me repeat, have you written a program that can detect the pulses from the encoder?

...R

Robin2:
That just means the normal Arduino power supply. I presume your Arduino is taking power from the USB cable connected to your PC. The thing in the Pololu diagram called "microcontroller" is intended to be your Arduino. You DO NOT need batteries - I told you that in Reply #10.

I understand that the micro controller IS the Arduino , but what if i don't want to connect it to my pc and what if i want to take the whole setup up with me , in nature ... i want it to be portable because basically what i'm doing is a Motor that focuses my photography lenses ... Which means that i won't be at home with a laptop to plug the arduino into .

But let's say that the power supply on the pololu image is just the 5V coming from the laptop USB port , how is it possible to wire the Positives and Negatives coming from that Power Supply which you are referring to as the laptop's USB port , to the GND and SLEEP and RESET ??? (Just like the image says on the Pololu web page)

Robin2:
What is complicated about it? Let me repeat, have you written a program that can detect the pulses from the encoder?

No , i haven't written anything . I don't even know how to proceed to that or what pulses from an encoder even mean .