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  

Thanks,
Voltage


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

No thumps and I can change direction.

That is great!

Posted by: @voltage

The display goes from 0-1000 and although it is not correct, that should be easy to adjust.

It should go 0-1000. it can be mapped to lower if needed but you would loose the granularity. We would need to come up with the formula to get the RPM.

Posted by: @voltage

I did notice a little flicker on the number 6 at one point but don't know if that is just the shield quality or if the refresh rate is too high.

On the LCD? That would probably be the screen.


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

It should go 0-1000. it can be mapped to lower if needed but you would loose the granularity. We would need to come up with the formula to get the RPM.

The speed for the stepper is the number of steps per second. @Voltage has suggested the range 0-15 RPM.

 

To get steps per second, we need to take the requested RPM and multiply it by the gear ratio to get the number of turns that the stepper needs to make to turn the gear's axle once and then multiply that by the number of steps per revolution of the stepper

i.e. steps/second = RPM*gearRatio*stepperStepsPerRev

= RPM * 4.25 * 400

which is 25500 for 15RPM.

Sounds awful, doesn't it !

 

To complete the math, given a specific sp_pot, we can calculate

RPM = sp_pot/4.25/400

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


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

Ok, compiled and tested and it works. There is a few thing about the display I thought I would mention. When I reset the UNO the display reads:

Speed:        RPM

Right

When I run it it shows:

Speed: 1000  RPM

Right 000

And if I push the Left or Start button while it is running it adds some odd stuff:

Speed: 1000   5&  v

Right 000

 

and sometimes the 000 turns into 1000

I think the problem is that the Right and Left info is printed in different places in the code and on the screen. Remove all code where Left or Right is put on the LCD except for stpmotor.

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

It should go 0-1000. it can be mapped to lower if needed but you would loose the granularity. We would need to come up with the formula to get the RPM.

The speed for the stepper is the number of steps per second. @Voltage has suggested the range 0-15 RPM.

 

To get steps per second, we need to take the requested RPM and multiply it by the gear ratio to get the number of turns that the stepper needs to make to turn the gear's axle once and then multiply that by the number of steps per revolution of the stepper

i.e. steps/second = RPM*gearRatio*stepperStepsPerRev

= RPM * 4.25 * 400

which is 25500 for 15RPM.

Sounds awful, doesn't it !

 

To complete the math, given a specific sp_pot, we can calculate

RPM = sp_pot/4.25/400

Don't forget we need to multiply that by 3 to cover for the chain and sprockets with a 10t and 30t for an added 3:1 reduction. 😋 

 

Thanks,
Voltage


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

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

@voltage

 

Good catch, I forgot about the chain !

Zounds 25500*3 = 76500, that's mind-boggling !

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, compiled and tested and it works. There is a few thing about the display I thought I would mention. When I reset the UNO the display reads:

Speed:        RPM

Right

When I run it it shows:

Speed: 1000  RPM

Right 000

And if I push the Left or Start button while it is running it adds some odd stuff:

Speed: 1000   5&  v

Right 000

 

and sometimes the 000 turns into 1000

I think the problem is that the Right and Left info is printed in different places in the code and on the screen. Remove all code where Left or Right is put on the LCD except for stpmotor.

Here are some pics. It only happens to make the extra characters when I press the start (Left) button while it is running. Easy fix: Don't press the start button while it is running. But it can happen. 😯 Pics of display added:

image 1
image 3
image 2
image 5
image 4
image 7
image 6
image 8

 

 

Thanks,
Voltage


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

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

@madmisha

I think that it's better to let the sp_pot in steps/second. Calculating an RPM from that is simple. I think if you mapped from 0-12 you'd only get integer values, so preventing a smooth range of speeds.

Selecting from the range of steps/second gives the maximum precision and continuity in speed.

I'm not sure why you're displaying anything but the RPM  as speed. I doubt if @Voltage would be interested in that since I believe he's only concerned about RPM.

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


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

@voltage

Yes, that's because pressing the button causes the direction to be printed without a specified location. That should clear up in the next iteration of the code (or so).

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


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

@madmisha

Maybe it's worth moving all of the LCD display commands into a subroutine. That way it'll be easy to update from anywhere and the data will always be placed in the same area.

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

I'm not sure why you're displaying anything but the RPM  as speed. I doubt if @Voltage would be interested in that since I believe he's only concerned about RPM.

Only because that's what the original had. If we verify that the RPMs are working out correctly, that can always change to a diameter reading.


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

I didn't test the last version but I did the two on the one post above. When the RPM comes down from 15, after you go past 10, the 9 shows up as a 90 and the counts down from 90, 89, 87, etc

 

I will go test the latest version. Be right back...

Edit: I'm back. This last version has all kinds of weird stuff on the display even if I just reset the UNO and change directions with the stop button. Want pics?

 

Also, I like just the RPM as the final output, not speed or diameter. That is the best easiest way and I am used to it.

Thanks,
Voltage


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

I'm not sure why you're displaying anything but the RPM  as speed. I doubt if @Voltage would be interested in that since I believe he's only concerned about RPM.

Only because that's what the original had. If we verify that the RPMs are working out correctly, that can always change to a diameter reading.

OK, I see.

How/where will the diameter be read in ?

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


   
ReplyQuote
Page 7 / 21