Notifications
Clear all

Arduino with Stepper and LiquidCrystal Issue

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

Rats! I am getting that stray '\302' error again and tried copying the code twice. From what I read yesterday when I had that error it is something to do with a cut/paste issue (like invisible characters). I will try some more...

 

edit: Got it. Just closed and opened a new sketch.

Thanks,
Voltage


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

Ok, the test is not working. I start it and no motion at all. Then I turn the pot all the way opposite and the stepper runs probably at the fast setting. Turn it the other way and click click click and the output shaft just twitches. Anywhere on the pot does nothing but twitch except for the one position all the way to the left. I cannot change direction with the stop button and the output shows -0.5 RPM.

edit: After playing with the project some more it is acting weird. I can stop it and turn the pot to the right and try it but it won't start. If I stop it and turn it to the left and try again it will only start when the pot is down to 5 or 6 on the diameter. But then it won't run at 0.5 so it's buggy.

Thanks,
Voltage


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

Ok, I will give it a test here in a minute. Actually MadMisha's name need to be at the top of the comments as he wrote this, then you modified it, and I tested it. 😎 

Agreed, change the top comment section from

//*******************************************
//     sketch_aug06e-Mod-5
//*******************************************

to

 

//*******************************************
//     sketch_aug06e-Mod-6
//
//      base sketch by MadMisha
//      mods by Will
//      tested/verified by Voltage
//*******************************************

 

 

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


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

Ok, the test is not working. I start it and no motion at all. Then I turn the pot all the way opposite and the stepper runs probably at the fast setting. Turn it the other way and click click click and the output shaft just twitches. Anywhere on the pot does nothing but twitch except for the one position all the way to the left. I cannot change direction with the stop button and the output shows -0.5 RPM.

edit: After playing with the project some more it is acting weird. I can stop it and turn the pot to the right and try it but it won't start. If I stop it and turn it to the left and try again it will only start when the pot is down to 5 or 6 on the diameter. But then it won't run at 0.5 so it's buggy.

When it starts , go is off so it shouldn't move. I think you'll need to push either the backward or forward button to start it.

It looks like pressing stop (when go is false) only changes direction, but never actually starts. Please try starting stand then pressing the forward 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  

Thanks,
Voltage


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

Ok, the test is not working. I start it and no motion at all. Then I turn the pot all the way opposite and the stepper runs probably at the fast setting. Turn it the other way and click click click and the output shaft just twitches. Anywhere on the pot does nothing but twitch except for the one position all the way to the left. I cannot change direction with the stop button and the output shows -0.5 RPM.

edit: After playing with the project some more it is acting weird. I can stop it and turn the pot to the right and try it but it won't start. If I stop it and turn it to the left and try again it will only start when the pot is down to 5 or 6 on the diameter. But then it won't run at 0.5 so it's buggy.

I think I found the problem, I didn't correct finalSPE for the diameter being in hundredths of an inch (doh!)

please change the line

float finalSPE = finalSPR/8/3.14159265; // Steps per eighth per 1" diameter

to

float finalSPE = 100*finalSPR/8/3.14159265; // Steps per eighth per 1" diameter

 

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
Posted by: @voltage

Ok, the test is not working. I start it and no motion at all. Then I turn the pot all the way opposite and the stepper runs probably at the fast setting. Turn it the other way and click click click and the output shaft just twitches. Anywhere on the pot does nothing but twitch except for the one position all the way to the left. I cannot change direction with the stop button and the output shows -0.5 RPM.

edit: After playing with the project some more it is acting weird. I can stop it and turn the pot to the right and try it but it won't start. If I stop it and turn it to the left and try again it will only start when the pot is down to 5 or 6 on the diameter. But then it won't run at 0.5 so it's buggy.

I think I found the problem, I didn't correct finalSPE for the diameter being in hundredths of an inch (doh!)

please change the line

float finalSPE = finalSPR/8/3.14159265; // Steps per eighth per 1" diameter

to

float finalSPE = 100*finalSPR/8/3.14159265; // Steps per eighth per 1" diameter

 

Ok, will do...Thanks.

 

edit: Ok tested it. Looks good except 2 things. One the display reads from 0,50 sometimes but others 0.52 or 0,53 when moving back and forth. On the other end 11.97 or 11.98. Minor detail not really an issue,. But I cannot change from Left to Right anymore using the Stop button with 2 presses like before.

 

Edit: Also, if I stop it and then start it the rpms are not at the same setting as before I stop it. I was going to do the test with the 4.76 but it starts at a faster speed when I stop and restart it. Tried a few times.

 

edit 2: The display looks great with no flicker though. 🙂

 

Thanks,
Voltage


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

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


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

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

Ok, will do...Thanks.

 

edit: Ok tested it. Looks good except 2 things. One the display reads from 0,50 sometimes but others 0.52 or 0,53 when moving back and forth. On the other end 11.97 or 11.98. Minor detail not really an issue,. But I cannot change from Left to Right anymore using the Stop button with 2 presses like before.

 

Edit: Also, if I stop it and then start it the rpms are not at the same setting as before I stop it. I was going to do the test with the 4.76 but it starts at a faster speed when I stop and restart it. Tried a few times.

 

edit 2: The display looks great with no flicker though. 🙂

 

The "unavailable" values are due to the pot's graininess plus I added a test to see if the new pot reading is at least 5 units away from the last pot reading, (This is to preventing the updates required by small jitters from the pot). I can remove their it's a problem. But with a pot you'll probably never get an accurate reading over a full range of 1200 with any <360 degree potentiometer you can afford 🙂

As for the stop button, all it does is stop it's going and reverse direction if it's not. But reversing direction doesn't start it running again. If you'd like it do the reverse, then change

void stpmotor (){

  if(go){
    stepper.stop();
    go = false;
  } else {
    dirFor = !dirFor;
  }  
}

 

to 

void stpmotor (){

  if(go){
    stepper.stop();
    go = false;
  } else {
    dirFor = !dirFor;
    go = true;
  }  
}

 Adding the command go = true;

 I'm not sure about the speed change after stopping. I'll have another look at that.

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

Sorry, I stayed up really late last night reading contracts and riders. Then making list of all the things to do and look for. Plus, I am on the west coast.

 

@voltage

Did you comment out the first section and uncomment the second? I was really hoping that would work.

Also, I hope you weren't using 2 buttons at once. The change by 10 and change by 1 (right button) is just a toggle. you should have been able to hit select(go and stop toggle) and up and down to change value. If you wanted it to change faster, tap the right button and then up and down will change it by a 10.

 

This might be an indication of how lon stepper.runSpeed() takes to run.

 

If it doesn't work, that's fine.

 

I actually don't care if my name is on it or not. It's all code and it meant to be open source.

That is fine, no need to be sorry. We all have things to do and life to live. 🙂 I did uncomment and comment the lines as you asked. I also verified I have a version 1 LCD display shield. I will rerun your sketch but I didn't press 2 buttons at the same time. I just followed the original instructions. Am I supposed to pushing all of the buttons on the LCD shield or some on it and others on the breadboard? Maybe I messed up? Anyhow I appreciate your time as always but now my wife will be home in a few minutes as she works until 2:30 on Saturdays CST, and I have to do like Will the other day and go running around to grocery stores and then workout and then eat supper. I will have time tomorrow after I walk the dog and eat breakfast so if I find anything to report I will be back at it tomorrow after 12:00 CST. Have a great day!

Thanks,
Voltage


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

Am I supposed to pushing all of the buttons on the LCD shield or some on it and others on the breadboard?

Only use the buttons on the shield and no pot. I posted an updated version of the code above.

 

If it works it will give you a definitive and stable reading that would be easier to work with for the math you are doing right now.


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

Ok, will do...Thanks.

 

edit: Ok tested it. Looks good except 2 things. One the display reads from 0,50 sometimes but others 0.52 or 0,53 when moving back and forth. On the other end 11.97 or 11.98. Minor detail not really an issue,. But I cannot change from Left to Right anymore using the Stop button with 2 presses like before.

 

Edit: Also, if I stop it and then start it the rpms are not at the same setting as before I stop it. I was going to do the test with the 4.76 but it starts at a faster speed when I stop and restart it. Tried a few times.

 

edit 2: The display looks great with no flicker though. 🙂

 

The "unavailable" values are due to the pot's graininess plus I added a test to see if the new pot reading is at least 5 units away from the last pot reading, (This is to preventing the updates required by all jitters from the pot). I can remove their it's a problem. But with a pot you'll probably never get an accurate reading over a full range of 1200 with any <360 degree potentiometer you can afford 🙂

As for the stop button, all it does is stop it's going and reverse direction if it's not. But reversing direction doesn't starlit running again. If you'd like it do the reverse, then change

void stpmotor (){

  if(go){
    stepper.stop();
    go = false;
  } else {
    dirFor = !dirFor;
  }  
}

 

to 

void stpmotor (){

  if(go){
    stepper.stop();
    go = false;
  } else {
    dirFor = !dirFor;
    go = true;
  }  
}

 Adding the command go = true;

 I'm not sure about the speed change after stopping. I'll have another look at that.

Will, Ok on the new info. Like I told Madmisha I am going to have to clean up and get ready to do the grocery shopping with the wife shortly as she only works until 2:30 CST on Saturday. I will try these adjustments and report back but I already started moving off the kitchen counter. I loaded the last Mod 4 sketch and the stop button works fine for reversing. Run the stepper, hit the stop 2 times and the stepper runs the other direction. That is not happening with this last version. I will try the code change but later I will open the code on 2 monitors and start looking to see if I can spot anything. Thanks for all the effort and hard work. I will post back anything I find and tomorrow after 12:00 CST I will be ready to set up and test or we can wait till Monday. Have a great day and thanks again.

 

Thanks,
Voltage


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

Am I supposed to pushing all of the buttons on the LCD shield or some on it and others on the breadboard?

Only use the buttons on the shield and no pot. I posted an updated version of the code above.

 

If it works it will give you a definitive and stable reading that would be easier to work with for the math you are doing right now.

Ok, that is what I was doing, just the buttons on the shield. I will post back later as I have to run. Thanks again!

 

Thanks,
Voltage


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

@voltage

 

OK, have a good weekend 🙂

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


   
ReplyQuote
Page 13 / 21