Notifications
Clear all

Arduino with Stepper and LiquidCrystal Issue

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

@voltage

Sorry, I wasn't clear. In that section I only want you to comment out the lines with a call to rampSpeed, not every line.

Ok, I will try that and be right back.

 

edit: Still the same but I rechecked my handy work and realized I missed one instance of rampspeed. But when I rem it out I get an error and am unsure what to do. Here is the line I rem out and get an error: expected unqualified-id before '{' token

//void rampSpeed( float fromSpeed, float toSpeed )

Should I remark out all of the void code as it has to do with rampSpeed?

Thanks,
Voltage


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

@voltage

That last one i the definition of the function, it has to stay in.

When you turn on the power, do you press any buttons or just adjust the pot ?

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

That last one i the definition of the function, it has to stay in.

When you turn on the power, do you press any buttons or just adjust the pot ?

I tried both ways. Tell me what you want me to do and I will go do it and report back. If I push the Left button for example I hear the stepper tic,tic, tic etc. The Stop button stops it. The Right button does the same. The pot and LCD display work great.

 

Thanks,
Voltage


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

@voltage

I just wondered because it now powers up into "stop" mode, so you need to set the speed with the pot and then push the left or right button to make it move.

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

I just wondered because it now powers up into "stop" mode, so you need to set the speed with the pot and then push the left or right button to make it move.

I tried everything. It seems like it gets a start signal as the stepper is going tic tic, tic tic, tic tic, and I can feel it and hear it if I put the stepper up to my ear. I can feel it in hand too.

 

Thanks,
Voltage


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

@voltage

OK, can you please post the code you're testing. I'm afraid my version is out of date now and I need to see the code you're using.

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


   
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: @will

@voltage

OK, can you please post the code you're testing. I'm afraid my version is out of date now and I need to see the code you're using.

This is it and has the 3 instances of rampSpeed remmed out. And the line you had me add (last line in this code):

// Reset speed if required
//
dia = map((analogRead(spd)),0,1023,50,1200); // Get diameter (x 100)
if (abs(dia-old_dia)>delta_dia) { // If diameter changed enough
calcSpeed(); // Calculate new speed
stepper.setSpeed(targetSpeed);

Thanks,
Voltage


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

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


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

Thanks,
Voltage


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

@voltage

 

Damn !

OK, obviously I need to go back and modify the previous working version in more manageable steps. I'm out this afternoon.

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

 

Damn !

OK, obviously I need to go back and modify the previous working version in more manageable steps. I'm out this afternoon.

Will, Ok, take a break. I'll check back but for today I am likely out as it's the wife's only day of the week that she is off. So I better hang out with her a little. 😉 Don't worry, tomorrow is another day. I will check in today to see if I can answer anything but I am going to have to move the project before supper. Tomorrow I have to walk the dog in the AM but will be available most of the day after that until late afternoon. Thanks for all the hard work.Talk to you later.

 

Thanks,
Voltage


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

@voltage @will

Sorry I'm late to the party. Woke up to having to put out the proverbial fire. 

 

It sounds like you are setting the ramp up speed too low to start out with. That will damage the motor. Set the start speed at the minimum of what it need to start properly. If the rotation needs to be lower than that setting, it can be set down after that it is already moving(think about why fans start out on high as the first position of the switch). The motor needs a bit more oomph to get going sometimes.

 

I do worry that the stop button is not on an interrupt anymore. That is a call that you want immediate and not missable. The other buttons don't matter. I know you can't use millis there but ramping down the speed won't really do any thing. You'd just be adding more time the motor is used.

 

I have to go back to work. I just stopped by to tell you about something you actually caught on your own. It was the map going to 1200 but the max speed was still at 1000. It looks like it was cut but I will point out that it was included in the constant speed example. Reading the AccelStepper site, I would say that it should only affect when you call run() but that wasn't in the example so I really don't know. It does not say there is a default value either. I'm not sure if it should really be there or not.


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

@madmisha @voltage

I have since eliminated the ramping, it can always be added in afterwards if needed.

Now that the STOP button doesn't use the ramp function, it eliminates the extra second it took to stop rotation. I have put the STOP button test at the top of the loop so that it's the first thing that's tested. The worst case delay if it is running should be one (full) loop if the diameter changes and the speed needs to be reset and only one step if diameter is unchanged. That delay shouldn't result in too much extra carnage before stopping.

I removed the limit because we're not accelerating, so we don't really need any upper bound any longer.

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


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

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


   
ReplyQuote
Page 16 / 21