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

Putting in that delay of 100,000 seems to fix it (the thumping) but renders the display useless. I will comment it out as another test.

It really sounds as if the "thumping" is caused by the motor jerking into full or no motion. The reason that the frequency changes is that with your interval at 10,000 it'll take about 10 seconds for it to have to pause while it updates the LCD. When your interval is 100,000, then it'll take about 100 seconds between start/stop cycles and it seems that you've not let it run long enough for the 100 seconds to elapse before the screen updates.

Seems like the LCD update is taking long enough to interrupt the inertia of the stepper.

Are you using the same stepper/driver combo as the person from you bought this ?

The stepper from the original design was without a geared head and was a Nema 23 520 oz/in version. It actually did the same thing but I have good hearing and the stepper laying on the kitchen counter makes it easy to amplify the noise. You can feel it in your hand too. It pauses for 4-5 seconds before the RPM displays and also pauses whenever you change the potentiometer position for about the same or maybe less time. I will add some more facts if I can think of any but the LCD Shield is a:

I ordered this: https://tinyurl.com/3bjnm45f

And was sent this:

https://tinyurl.com/c3enw65c

 

Looks like the original has the exact brand blacked out.

 

Thanks,
Voltage


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

@voltage

Slowing the rotation will lessen the thumping because less energy will be required to start and stop the motion. Going from 3600 to 700 is a whopping change !

However, there seems to be little point is sending floating point numbers in the map() function as it deals only in integers anyway.

You should re-test it with interval of 1000 just to see how much difference the speed reduction made.

Well in the beginning the default was set at 1000 and no matter the micro stepping stepping value with the correct other inputs to get my needed out rpms, the noise was there. I can easily fix the floating point to int but it likely won't help anything. I already put the project off of the kitchen counter but will be all set up tomorrow for more testing. 😀 

 

Added: And with the setting at 1000 the thump happened 4 times when it was running at 1 RPM at the output, or 4 actual stepper motor revolutions Thump, thump, thump, thump. But the second verse of thumps slighted shifted forward every revolution. So it was 1 thump per rev on the stepper but didn't always start at 12 o'clock for example, it advanced a little forward on each rev.

Added 2: But now that I think of it the stepper gear head is actually 4.25:1 so it may play into that illusion.

Thanks,
Voltage


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

@voltage

More (random) questions.

1) does it thump when you first start it moving ?

2) does it thump at the instant when you switch from forward to reverse ?

3) does it also thump the same way in reverse ?

4) if you put a delay(100); in the loop, does it thump each time it goes through the loop ?

5) if you remove the load from the stepper, does it still thump ?

I'm thinking that the gearing is providing so much inertia that it delays the startup of the stepper and so the motor bucks (i.e. thumps) until the inertia and static friction of the gearbox are overcome by the stepper.

1) if it thumps when you first start it, that supports the theory

2) if it thumps when you first reverse it, that supports the theory

3) if it thumps when you run in reverse, that supports the theory

4) if it thumps every time it needs to move, that supports the theory

5) if unloading it eliminates (or at least reduces) the thump, that supports the theory because it suggests that the thump is associated with the motor having to start rotating.

Do you see what I'm getting at ?

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

I will print this out and test tomorrow and report back. But for a quick off the top of my head report:

1. No.

2. Not sure haven't tried.

3. Yes.

4. Have to try tomorrow.

5. No load is applied.

The same thing happened with the original stepper without a gear head or load.

More info coming tomorrow...

Thanks,
Voltage


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

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

@madmisha

Your code doesn't match the original because the original made 4 steps each time through the loop and then tested the elapsed time and updated the LCD if required.

You are only taking only a single step and then testing the elapsed time and updating the LCD if required. It will run slower than the original code.

Also, I don't think that (pulse delay/12) is a good measure of RPM.

I like the way you use the map function to convert the pot reading to delay time.

I suspect that the sketch's author was loading code directly (not using the boot loader) and that's why he used the tx/rx pins.

AccelStepper is a much better choice of libraries since it allows the use of acceleration to reduce the "jerk" in the initial start by using a lower speed to start and ramping up to the max speed over time. However, Voltage is using bought software which he didn't write. I don't think he wants to mess with the code at all.

It's difficult trying to establish what went wrong when we don't even know what the firmware is supposed to be doing.

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


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

Your code doesn't match the original because the original made 4 steps each time through the loop and then tested the elapsed time and updated the LCD if required.

If you are referring to the steps per revolution part that is divided by 100, then that is actually handled on the driver. The pulse should still complete the same movement if set right. It is still passing through the loop at about the same rate for the same amount of movement.

Posted by: @will

I like the way you use the map function to convert the pot reading to delay time.

That was in Bill's original code. And now that I linked that, I see he included Accel Stepper at the end of the video and article. I'm not sure why I didn't remember it being there.

 

Honestly, I think using Accel Stepper is the better way to go either way.


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

Your code doesn't match the original because the original made 4 steps each time through the loop and then tested the elapsed time and updated the LCD if required.

If you are referring to the steps per revolution part that is divided by 100, then that is actually handled on the driver. The pulse should still complete the same movement if set right. It is still passing through the loop at about the same rate for the same amount of movement.

IIRC the old Stepper library method step() function performed the number of steps which was sent to it. So the command:

myStepper.step(sign*stepsPerRevolution / 100);

would step stepsPerRevolution (400) /100 steps in the appropriate direction. That would feed the driver four sets of pulses, not just one set

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


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

@will

I see what you mean now. I had to look at the library.

Not knowing what it will be used for, it's hard to say if that will even make a difference for them. We will see when they return. I'm not sure if the LCD will update fast enough to not ruin the timing. Just another reason I think that other library is a better option.

 

It's actually a little worse than that because for 2 wire, it needs to make 4(sets) of pulses per step. That is still being done in the driver but at a faster rate.


   
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

@madmisha

Your code doesn't match the original because the original made 4 steps each time through the loop and then tested the elapsed time and updated the LCD if required.

You are only taking only a single step and then testing the elapsed time and updating the LCD if required. It will run slower than the original code.

Also, I don't think that (pulse delay/12) is a good measure of RPM.

I like the way you use the map function to convert the pot reading to delay time.

I suspect that the sketch's author was loading code directly (not using the boot loader) and that's why he used the tx/rx pins.

AccelStepper is a much better choice of libraries since it allows the use of acceleration to reduce the "jerk" in the initial start by using a lower speed to start and ramping up to the max speed over time. However, Voltage is using bought software which he didn't write. I don't think he wants to mess with the code at all.

It's difficult trying to establish what went wrong when we don't even know what the firmware is supposed to be doing.

I don't mind messing with the software or even a whole rewrite as long as I can use the LCD shield to dial in the correct RPM from 0-12 or 1-12 RPMs. If someone wants to chat with a private message I can share more info as I don't want to upset or get in trouble with the author. I don't think I would as I am not sharing the plans of the contraption that goes with it. Its really quite simple but I want it to work properly. Also, I am doing a crash course on this Arduino stuff so while I look slow it is because I am also trying to understand and learn but I love that you are sharing code to help. I just need to understand the pinouts etc and have a clear image of an UNO to refer to. I will send you both a short private message to let you know what this thing does and then you will see it's quite simple but important that it works correctly.

 

Thanks,
Voltage


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

 Its really quite simple but I want it to work properly. Also, I am doing a crash course on this Arduino stuff so while I look slow it is because I am also trying to understand and learn but I love that you are sharing code to help. I just need to understand the pinouts etc and have a clear image of an UNO to refer to. I will send you both a short private message to let you know what this thing does and then you will see it's quite simple but important that it works correctly.

It doesn't matter that you "look slow", you're still learning. As for helping, that's what this forum and all of its members are for.

Just keep on keep' on 🙂

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


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

 Its really quite simple but I want it to work properly. Also, I am doing a crash course on this Arduino stuff so while I look slow it is because I am also trying to understand and learn but I love that you are sharing code to help. I just need to understand the pinouts etc and have a clear image of an UNO to refer to. I will send you both a short private message to let you know what this thing does and then you will see it's quite simple but important that it works correctly.

It doesn't matter that you "look slow", you're still learning. As for helping, that's what this forum and all of its members are for.

Just keep on keep' on 🙂

Thanks. I appreciate it. Both you and madmisha. Also, I am just learning Linux somewhat and have an old laptop with Mint Cinnamon installed. Got Arduino installed and had to fix the missing port error etc. I need to figure out how to get the only Linux pc accessable on my all windows network or for now its actually easier to code on my pc and use a flash drive to transfer sketches. Working on the kitchen counter with the project as I have too many projects and really need to get my electronics bench set up soon.

 

Added: Ok, just fired it up for the first time today and its running cool etc. The little thump happens in both forward and reverse but I also noticed when I change the speed with the pot, exactly after the 4 or 5 second delay when the display refreshes to the new reading is exactly when I feel the thump. Forward or reverse. My first question is where exactly would I add that delay(100) you mentioned?

 

Thanks,
Voltage


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

The little thump happens in both forward and reverse but I also noticed when I change the speed with the pot, exactly after the 4 or 5 second delay when the display refreshes to the new reading is exactly when I feel the thump. Forward or reverse. My first question is where exactly would I add that delay(100) you mentioned?

I am almost totally convinced that the thump is caused by the motor overcoming the inertia and static friction of the gears.

The delay(100) in the loop is to test whether you get a thump each time through the loop, so place it as the first command in the loop. I'm thinking that you should get a continuous thumping regardless of whether the LCD is being updated to not.

If I'm right, you should get a thump about 8-10 times a second, so keep your hand on the power switch and be ready to turn the power off fast.

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
Page 2 / 21