Notifications
Clear all

Arduino with Stepper and LiquidCrystal Issue

308 Posts
5 Users
12 Likes
24.2 K Views
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@voltage

Hmmm ... interesting, but annoying.

I'll keep looking at it too.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
(@voltage)
Member
Joined: 3 years ago
Posts: 187
Topic starter  

Madmisha,

  Ok, I will take your other code and set that back to what you said and give it a go first.

 

Switches on driver:ON OFF OFF OFF OFF ON ON ON

First 3 = 2.69A RMS

4th switch = Half Current

5-8 = 400 Microsteps

Thanks,
Voltage


   
ReplyQuote
(@voltage)
Member
Joined: 3 years ago
Posts: 187
Topic starter  

Weird. When I try to verify this code below now I get an error that "dirfor" was not declared in this scope.

Arduino: 1.8.15 (Windows 10), Board: "Arduino Uno"

 

Oh yeah, I fixed that before by changing the spelling to "dirFor".

 

 

 

 

 

 

 

 

Thanks,
Voltage


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 
Posted by: @voltage

4th switch = Half Current

That might have been your thump. The LCD took more than 0.4 seconds to update and it cut power. I do not really know much about this setting though.

 

Posted by: @voltage

5-8 = 400 Microsteps

I think that is 2 microsteps = 400 steps/rev, assuming I am looking at the right datasheet. You might want to up that a little. Isn't that the lowest setting?


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 
Posted by: @voltage

Weird. When I try to verify this code below now I get an error that "dirfor" was not declared in this scope.

I just verified it on mine and had no problem. I just did a search and all say dirFor although it might have lost case in the debug. I also confirmed that I was on Uno. That is odd. I am running 1.8.13 though.


   
ReplyQuote
(@voltage)
Member
Joined: 3 years ago
Posts: 187
Topic starter  
Posted by: @madmisha
Posted by: @voltage

4th switch = Half Current

That might have been your thump. The LCD took more than 0.4 seconds to update and it cut power. I do not really know much about this setting though.

 

Posted by: @voltage

5-8 = 400 Microsteps

I think that is 2 microsteps = 400 steps/rev, assuming I am looking at the right datasheet. You might want to up that a little. Isn't that the lowest setting?

I believe the half/full current mode is just to keep the stepper from getting too hot when it has power applied but is not running. That is the right datasheet. I had the thumping in all of the settings I tried but thought it would be less work to microstep less per step so I set it to 400 assuming that 200 = a full step and 400 would = 1/2 step and so on.

 

 

Thanks,
Voltage


   
ReplyQuote
(@voltage)
Member
Joined: 3 years ago
Posts: 187
Topic starter  
Posted by: @madmisha
Posted by: @voltage

Weird. When I try to verify this code below now I get an error that "dirfor" was not declared in this scope.

I just verified it on mine and had no problem. I just did a search and all say dirFor although it might have lost case in the debug. I also confirmed that I was on Uno. That is odd. I am running 1.8.13 though.

I am running 18.15 so maybe it was a bug. Still getting this error though.

error

Edit: Adding int before it corrected it. 🙂

Thanks,
Voltage


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 

   
ReplyQuote
(@voltage)
Member
Joined: 3 years ago
Posts: 187
Topic starter  

Thanks,
Voltage


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 

@voltage

I set max speed to 1000 because that is what their example used, but:

Posted by: @madmisha

int sp_pot = map((analogRead(spd)),0,1023,2000,50);

Try changing the 2000 to 1000. It might be going over and stopping on an error.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@voltage

Has anybody noticed yet that you're setting the speed and telling the stepper to run but you've never given it a target position ?

It may be standing still, not out of truculence, but simply because it hasn't been told where to go 🙂

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 

@will

Constant speed example didn't do that. You are pulsing for move and setting the direction. Between those 2 things, it should know where to go.

 

@voltage

I just noticed that you have the buttons connected to ground. The interrupts won't trigger. That is the problem. I was combining Bills sketch and that's where I went wrong. He has his connected with a resistor to 5V and no pin mode because the interrupt is doing that.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 
Posted by: @madmisha

@will

Constant speed example didn't do that. You are pulsing for move and setting the direction. Between those 2 things, it should know where to go.

◆ runSpeed()

boolean AccelStepper::runSpeed (   )  

Poll the motor and step it if a step is due, implementing a constant speed as set by the most recent call to setSpeed(). You must call this as frequently as possible, but at least once per step interval,

Returns
true if the motor was stepped.

References _direction, DIRECTION_CW, and step().

Referenced by MultiStepper::run(), run(), and runSpeedToPosition().

 

Note: ... if a step is due ...

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@voltage

Can you please give us an idea of what speed range (in RPM) you will require ?

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 

   
ReplyQuote
Page 4 / 21