Notifications
Clear all

Arduino with Stepper and LiquidCrystal Issue

308 Posts
5 Users
12 Likes
24.1 K Views
(@voltage)
Member
Joined: 3 years ago
Posts: 187
Topic starter  
Posted by: @madmisha

@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.

I will try that but I see more new posts so let me get caught up reading... 🙂

 

Thanks,
Voltage


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

@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 🙂

No target means keep spinning I think. No clue, I just started with a set of plans... but I sure am learning a lot. 🙂

 

Thanks,
Voltage


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

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,

Hmm. My interpretation of that was that a step was due if the current one ended. So when you send that command, it will step and if you send it again before that step is done, it will wait until that step is done before sending the next one.


   
ReplyQuote
(@voltage)
Member
Joined: 3 years ago
Posts: 187
Topic starter  
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.

 

@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.

So connect all of the buttons lines with a resistor to 5V? No smoke will come out? 😆 

 

Thanks,
Voltage


   
ReplyQuote
MadMisha
(@madmisha)
Member
Joined: 4 years ago
Posts: 340
 
Posted by: @voltage
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.

 

@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.

So connect all of the buttons lines with a resistor to 5V? No smoke will come out? 😆 

 

No, I set the interrupt on change so it might work if you upload that one. It should be set to how you have yours set.


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

@madmisha

I think it says that because if you're using a very slow speed, run may get called more often than you need to pulse, so it'll ignore that request until the next pulse is due to step at that speed. 

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


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

@voltage

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

Sure. The stepper has a gear ratio of 4.250 : 1 so for one revolution of the output shaft I need 5 rpms of the stepper. I want a range of 0 to 12 or 0 to 15 (I can always adjust it later). But the output has a 10t sprocket and goes to a 30t sprocket so in total it's 7.250 : 1 and that means the stepper needs to spin at 162 rpms for 0-12 or 202.5 for 0-15 at the end.

Thanks,
Voltage


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

@voltage

I need to take a break from this. I think I'm starting to confuse myself. Falling edge should have worked too. I suggest before going any further with the Accel Stepper library, try out the example and see if they work without any changes other than

AccelStepper stepper(1,2,3); // This needs to change in any example(Mode, Pul, Dir)

That will have to be changed. But if you can't get the basic examples to work then you will be running all over the place chasing random problems.


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

Thanks,
Voltage


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

@voltage

I need to take a break from this. I think I'm starting to confuse myself. Falling edge should have worked too. I suggest before going any further with the Accel Stepper library, try out the example and see if they work without any changes other than

AccelStepper stepper(1,2,3); // This needs to change in any example(Mode, Pul, Dir)

That will have to be changed. But if you can't get the basic examples to work then you will be running all over the place chasing random problems.

I thought AccelStepper stepper(1,2,3); is correct for my code as my PUL- and DIR- pins are set as 2 and 3. And 1 is for the 2 wire connection to a driver. Right? I will try some of the examples and see how it goes, more likely tomorrow. Thanks for your time and effort guys.

 

Edit: I see what you mean as the examples all default to a different setting namely:

 // Define a stepper and the pins it will use AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5

 

Thanks,
Voltage


   
ReplyQuote
(@mark-bolton)
Member
Joined: 3 years ago
Posts: 108
 

Guys I am reluctant to buy into this discussion and will not do so beyond sharing some basics.

My first boss / Foreman (swiss)  when I was a raw little techy straight out of Trade School asked me

"so in your training did they instruct you  on the Correct use of Pockets?

No I didn't thinks so...  If you are not sure about what you are doing you put your hands in them......


   
ReplyQuote
(@mark-bolton)
Member
Joined: 3 years ago
Posts: 108
 

Stepper motors were an ingredient in machines that we has singing and dancing even before the 8080 .. just snap the whip!


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

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


   
Voltage reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2527
 

@voltage

By the way, have any tests been done to verify that all three buttons are working ? If they aren't then we're likely wasting a lot of time (especially the go button).

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


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

@will

They are all working fine as I can recompile with my original and they all work. I did think of it though and pulled the jumpers earlier just to touch the ends together to bypass the switch. 😀 

Thanks,
Voltage


   
ReplyQuote
Page 5 / 21