new guy NEED help with ST-M5045 Driver

Hi guys
doing a long time project with glass i just need to move 1 axis on a mini mill.
i connected a ball screw with nema23 2 phase 4.2 amp connect to arduino.

i can't find a sketch to move this back and forward with potentiometer. and turn buttons
( i probably just don't know where to look :slight_smile: )

any suggestions

thanks
gil

Hi and welcome,

some questions to get some more details:

  1. Did you read the manual of the driver? (manual) ?
  2. How did you connect the driver with the arduino (pls specify what Arduino type you use)? A picture would be helpful to check the connections with the manual.
  3. Did you run your configuration in a simple sketch to see if the whole configuration works at all?
  4. Pls specify in more detail what exactly you want to do with the potentiometer and what the buttons (how many) should be for
  5. You are talking about a mini mill with ball screws: a Nema23 with 4.2amp seems way overpowered, depending on what you understand what a mini mill is ...

I think I have some more fundamental questions than those posed by @rpt007.

Do you have any experience of using an Arduino to control a stepper motor?

Do you have an existing system to control your mini-mill for other purposes?
OR
Is this your very first attempt at CNC?

...R
Stepper Motor Basics
Simple Stepper Code

Hi guy
well this is my first cnc experience i follow instructions from the guy from nyc cnc
the video :
Use Arduino to Control a Large Stepper Motor! Part 1

i did all at the wiring from the video and found the skatch online.

the stepper is moving but no reaction or any change from the potentiometer

is it make a different if the experiment is nema34 and i use nema23

i do need power for the long run this will cut glass with high speed spindle and also metal one day..:slight_smile:

Nema34_Potentiometer.ino (659 Bytes)

Try this - just for testing

void loop() {
  sensorValue = analogRead(sensorPin) + 200;
  digitalWrite(9, LOW);
  delayMicroseconds(10);          
  digitalWrite(9, HIGH); 
  delay(sensorValue);
 }

and let us know what happens

I have swapped HIGH and LOW because you seem to be connecting the minus connections to the I/O pins. I would normally connect minus to GND and the + connection to the I/O pin. But either should work.

...R

I think, ENABLE is to be used to activate the driver.

Looking at the datasheet, ENA+ should be connected to Vcc and ENA- either to GND (this would activate the driver permanently or switch it ON by sending a HIGH from Arduino - this switches the output transistor and it connects GND to the cathode of the optocoupler).

Hi guys
got busy with work..
so i run the skatch "nema34_potentiometer.ino" and i got moment with controlled speed.
but i got only 1 direction ??? no change pressing the left right buttons.

try to add robin2 code i got lost with adding the void loop code in to the skatch sorry which part do i delete ...

and i didnt try the ENA yet because i have the stepper moving.

let see if i can fix the direction first.

one more question is the bread boards can be not so reliable meaning it feels like there is no electricity connections when i press on the buttons ???

thank you very much for your time
gil

zulasurfing:
try to add robin2 code i got lost with adding the void loop code in to the skatch sorry which part do i delete ...

You have to post the code where you tried to incorporate my suggestion so I can see it if you want an answer.

...R

Hi guys
thanks for your help,
reading you comments send me to read some more on the work follow and i found the problem.
just need to go over sketchs direction more then one time....
just missing +5 wire to the dir+

thanks
gili