Notifications
Clear all

Arduino with Stepper and LiquidCrystal Issue

Page 9 / 21

Will
 Will
(@will)
Noble Member
Joined: 11 months ago
Posts: 1764
 

@madmisha

I agree that it's better not to have them in the loop, but here the cost of having them in the loop is only the time for an "if" which time is negligible compared to the work they need to do when triggered. I don't see @voltage playing the buttons like a pipe organ anyway, so they'll probably be triggered only rarely.

Then the LCD updates could be done from a sub.

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
Voltage
(@voltage)
Estimable Member
Joined: 10 months ago
Posts: 169
Topic starter  
Posted by: @madmisha

I have to go tour a construction site. I will be back later to catch up. Feel free to mess around with the code all you want.

Ok, Thanks for all your hard work, skill, and effort in this. Have a great day. 😀 

 

Thanks,
Voltage


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 11 months ago
Posts: 1764
 

@voltage @madmisha

Regarding setting the pot to enter diameter (in inches), please check my reasoning ...

if d be the diameter of the workpiece in inches

1 rev = pi x d inches = 1 x 4.25 x 3 x 400 = 5100 steps = 8 x pd x d in eights of an inch

so 1 eight of an inch is 5100 steps/(8 x pi x d)

or 202.9/d steps

So if we set the speed to 202.9/diameter steps per second we should get a velocity of 1/8" per second on the outside of the workpiece.

Comments, corrections ?

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
Voltage
(@voltage)
Estimable Member
Joined: 10 months ago
Posts: 169
Topic starter  

@will

I think it looks right but I am going to have to think on it some more with a calculator and some coffee. 😋 And if I change the multi-stepping for smoothness etc I guess that would make for an easy adjustment. I am going to see what max rpm's is now and see about adjusting the code to get that dialed in or make sure its right.

Thanks,
Voltage


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 11 months ago
Posts: 1764
 

@voltage

You haven't had enough coffee until you can thread a sewing machine while it's still running 🙂

I was kidnapped by mimes.
They did unspeakable things to me.


Voltage liked
ReplyQuote
Voltage
(@voltage)
Estimable Member
Joined: 10 months ago
Posts: 169
Topic starter  
Posted by: @will

@voltage

You haven't had enough coffee until you can thread a sewing machine while it's still running 🙂

Don't tell me you tried and can actually do that!

 

Thanks,
Voltage


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 11 months ago
Posts: 1764
 
Posted by: @voltage
Posted by: @will

@voltage

You haven't had enough coffee until you can thread a sewing machine while it's still running 🙂

Don't tell me you tried and can actually do that!

Hell no ! At my age, I'm not looking for new challenges 🙂 Getting up and finding my glasses is all the adventure I need in a day !

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 11 months ago
Posts: 1764
 

@voltage

Now that we're working in 1/8 inches per seconds based on diameter, what range of diameters would be appropriate for the potentiometer ?

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
Voltage
(@voltage)
Estimable Member
Joined: 10 months ago
Posts: 169
Topic starter  
Posted by: @will
Posted by: @voltage
Posted by: @will

@voltage

You haven't had enough coffee until you can thread a sewing machine while it's still running 🙂

Don't tell me you tried and can actually do that!

Hell no ! At my age, I'm not looking for new challenges 🙂 Getting up and finding my glasses is all the adventure I need in a day !

Well I guess we are both in the same boat. Sometimes I put a pair of reading glasses over the pair I'm wearing. Or look for them when I already have them on. Luckily both eyes are the same strength so I can buy cheap ones.

 

Thanks,
Voltage


ReplyQuote
Voltage
(@voltage)
Estimable Member
Joined: 10 months ago
Posts: 169
Topic starter  
Posted by: @will

@voltage

Now that we're working in 1/8 inches per seconds based on diameter, what range of diameters would be appropriate for the potentiometer ?

Well that can vary but I usually do smaller stuff. Like 1/2" to 6 or 8" diameter. But there will be times it could go larger but not by much. I'm not welding automotive wheels or anything. I just fix things and fabricate things etc...

 

Thanks,
Voltage


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 11 months ago
Posts: 1764
 

@voltage

 

OK, thanks. I'm going to allow for a range from 0 - 12 inches. That will allow you to vary the speed over a greater range to allow for harder materials requiring a slower speed.

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
Voltage
(@voltage)
Estimable Member
Joined: 10 months ago
Posts: 169
Topic starter  
Posted by: @will

@voltage

 

OK, thanks. I'm going to allow for a range from 0 - 12 inches. That will allow you to vary the speed over a greater range to allow for harder materials requiring a slower speed.

Perfect. Sounds good to me. Thanks!

 

Thanks,
Voltage


ReplyQuote
Will
 Will
(@will)
Noble Member
Joined: 11 months ago
Posts: 1764
 

@voltage @madmisha

The first change is to allow the user to enter a diameter in inches (actually, the pot reads in 100'ths of an inch so as to provide a nice smooth range for tuning the size) and calculates from that the steps/per second to use for the speed and the RPM for the delay. 

Please check my math first.

I calculate steps per second as documented above. Since the diameter is in hundredths of an inch, I scaled up the 202.9 to 20290.

I calculate RPM as steps per second times 60 seconds to get steps/minute and the divide by steps per rotation to get rotations per minute.

Replace the line:

  int sp_pot = map((analogRead(spd)),0,1023,50,1000);

with:

int sp_pot = map((analogRead(spd)),0,1023,50,1200); // Get diameter (x 100)
float sps = 20290/sp_pot; // Calc steps/sec
float RPM = 60*sps/5100; // Calc RPM

and test to make sure it still runs (I'm paranoid).

I was kidnapped by mimes.
They did unspeakable things to me.


ReplyQuote
MadMisha
(@madmisha)
Reputable Member
Joined: 2 years ago
Posts: 319
 

Ok, to be honest, do you really need RPM? I would say display the mapped number from the pot. Then do the math to what diameter that would be right for. The mapped pot number would be the ultimate control. Does it really need to match anything other than a reference to a speed that works? And if it goes up or down even 1 it will be accurate.

 

That way you could dial it in close to the size but you still have an accurate reference.


ReplyQuote
Voltage
(@voltage)
Estimable Member
Joined: 10 months ago
Posts: 169
Topic starter  
Posted by: @will

@voltage @madmisha

The first change is to allow the user to enter a diameter in inches (actually, the pot reads in 100'ths of an inch so as to provide a nice smooth range for tuning the size) and calculates from that the steps/per second to use for the speed and the RPM for the delay. 

Please check my math first.

I calculate steps per second as documented above. Since the diameter is in hundredths of an inch, I scaled up the 202.9 to 20290.

I calculate RPM as steps per second times 60 seconds to get steps/minute and the divide by steps per rotation to get rotations per minute.

Replace the line:

  int sp_pot = map((analogRead(spd)),0,1023,50,1000);

with:

int sp_pot = map((analogRead(spd)),0,1023,50,1200); // Get diameter (x 100)
float sps = 20290/sp_pot; // Calc steps/sec
float RPM = 60*sps/5100; // Calc RPM

and test to make sure it still runs (I'm paranoid).

Which version should I edit. The last version on the list has some serious bugs with the display and the ones before it have buffer overflow issues. I just looked at the last 5 from today and they all have issues. And I was testing for output speed and it was about 19 RPM's at the gear head shaft for wide open on the pot.

 

Thanks,
Voltage


ReplyQuote
Page 9 / 21