Notifications
Clear all

Arduino with Stepper and LiquidCrystal Issue

308 Posts
5 Users
12 Likes
22.5 K Views
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  
Posted by: @will
Posted by: @voltage

Madmisha:

The buttons can be whatever as I am going to build a new control enclosure.

The LCD shield would have to be wired for the button pushes if used as that would not be available through the cover of the enclosure but I think you know that. 🙂

I will be reading the forum after 9:30 AM CST but will be doing backups and eating breakfast until 11:30 and be ready to rumble at 12:00 Noon CST.

Thanks Madmisha!

🙂

If we agree that LEFT and RIGHT will only work when the machine is stopped, then we won't need a start button. Stop will just stop the machine and the operator will use the LEFT or RIGHT button to start it running in the desired direction.

@madmisha, I'm wondering, if we have such crisp meanings for each button, will we really need to de-bounce the switches ? I mean, if we sense the STOP button pushed we're just going to stop, we don't have to worry about it bouncing on and off. Similarly if the machine is stopped and somebody pushes a direction button - we're just going to start moving that direction whether the switch bounces or not.

We could "slow to a stop" after the button is pushed by gradually decreasing the stepper speed. In a similar way we could "ramp up" to start by gradually increasing the stepper speed from 0 to the calculated rate. Both of these could take place over a second or two each and should take a good amount of stress off the stepper.

The slow down could be incorporated into the STOP button code and the ramp up could be built into the LEFT & RIGHT button code.

Does this sum everything up correctly ? Use Voltage's custom enclosure (to be designed), use shield buttons if possible wired to enclosure buttons, STOP just stops, LEFT and RIGHT only work when machine stopped and will start up in desired direction, Stop may involve gradual reduction in speed to zero, LEFT, RIGHT may involve gradual spin-up to pot indicated speed.

Just so we all start with the same vision and assumptions 🙂

I would agree to the Left Right and Stop. With my other unit I added 3 ports to connect foot pedals to remotely control it too. I would only use the Stop and one direction connected at a time.

 

Thanks,
Voltage


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

@voltage @madmisha

One other question Voltage while I think of it, would you prefer using a potentiometer to dial in diameter or would you prefer using buttons to do so ?

The potentiometer is fine.

 

Thanks,
Voltage


   
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 @voltage

Voltage, as I was trying to get to sleep last night I started wondering about the shield. To use the buttons you'd have to mount it in the control panel with the LCD and buttons exposed. This brought up 2 questions ...

1) I've never used a TIG welder but arc welders used to spit out hot balls of melted metal, smoke and little balls of slag when brushed clean. My gloves used to get filthy with the residual muck and metal filings from when I need to grind the surface. Would the exposed shield stay clean and dirt free in the workshop environment being touched by your work gloves all the time ?

2) I always used to use heavy leather gloves while welding and there's no way I could work those small buttons one at a time with gloves on. If you wear gloves, could you put them on and see if you can easily press each of the buttons (only one at a time).

 

Thanks

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

@voltage @voltage

Voltage, as I was trying to get to sleep last night I started wondering about the shield. To use the buttons you'd have to mount it in the control panel with the LCD and buttons exposed. This brought up 2 questions ...

1) I've never used a TIG welder but arc welders used to spit out hot balls of melted metal, smoke and little balls of slag when brushed clean. My gloves used to get filthy with the residual muck and metal filings from when I need to grind the surface. Would the exposed shield stay clean and dirt free in the workshop environment being touched by your work gloves all the time ?

2) I always used to use heavy leather gloves while welding and there's no way I could work those small buttons one at a time with gloves on. If you wear gloves, could you put them on and see if you can easily press each of the buttons (only one at a time).

 

Thanks

Will, TIG welding is very neat and leaves no spatter or mess. MIG and Stick do. I can weld all 3 versions along with Brazing but I prefer TIG. That said, I mentioned in a previous post yesterday to Madmisha that using the buttons directly on the shield would not work unless wires could be soldered and then connected to switches. So definitely NO WAY on using the shields buttons for this. I will be ready to test the new code in about 30 minutes after my wife finishes the dishes and gets out of the way. 😋 

 

p.s. I like your new avatar. Even a caveman could do it! 🙂

 

Thanks,
Voltage


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

@voltage

 

Sorry about the premature version of the code, I was working from a page of notes and forgot that there were more changes on the next page ... oops 🙂

Since the speed ramps up for LEFT and RIGHT buttons over a period of 1 second, when you're testing you'll have to let the speed build up before starting to measure the rotation time.

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

 

Sorry about the premature version of the code, I was working from a page of notes and forgot that there were more changes on the next page ... oops 🙂

Since the speed ramps up for LEFT and RIGHT buttons over a period of 1 second, when you're testing you'll have to let the speed build up before starting to measure the rotation time.

Will, with the last version of the code, I tried to run it and I get zero movement of the stepper. I checked and all the wires are the same as you made no changes from the last working code. I swapped the left and right wire as that was the only thing I could find but that is irrelevant. I think I may hear a small click, click but that is it.

 

edit: I do hear a quiet noise and the stepper looks like it may be moving a thousandth's of an inch when it goes tic toc, tic toc, tic toc...etc.

 

Thanks,
Voltage


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

@voltage

I think that's because I recalculate the speed but never set it. In the loop where it tests for a difference in dia and old_dia, add the line stepper.setSpeed(targetSpeed); right after calcSpeed();

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 think that's because I recalculate the speed but never set it. In the loop where it tests for a difference in dia and old_dia, add the line stepper.setSpeed(targetSpeed); right after calcSpeed();

There are 3 instances of calcSpeed(); so I tried the third one down and it doesn't fix it. Did I choose the wrong place to add this line?

// 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);
stepper.runSpeed();
lcd.setCursor(5,0); // Modify LCD to match
lcd.print(" ");

 

Thanks,
Voltage


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

@voltage

I think that's in the right place, so it may be the rampSpeed sub isn't working (it's new code as well). Try putting // in front of all calls to rampSpeed to see if it works. they all occur in the section starting

//

//  Check buttons

//

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 think that's in the right place, so it may be the rampSpeed sub isn't working (it's new code as well). Try putting // in front of all calls to rampSpeed to see if it works. they all occur in the section starting

//

//  Check buttons

//

I did this and tried again and now nothing, not even the tic toc noise.

 

//
// Check buttons
//
// if (switchPushed(STOP_PIN) && go) {
// rampSpeed(stepper.speed(),0); // Ramp speed down to zero
// go = false; // No longer running
// stepper.stop(); // Stop stepper.
// } else if (switchPushed(LEFT_PIN) && !go && dirn!=-1) {
// dirn = -1; // Set direction
// go = true; // We're running again
// calcSpeed(); // Recalculate speed
// rampSpeed(0,targetSpeed); // Ramp up to speed
// old_dia = 0; // Force speed recalc
// } else if (switchPushed(RIGHT_PIN) && !go && dirn !=1) {
// dirn = 1; // Set direction
// go = true; // We're running again
// calcSpeed(); // Recalculate speed
// rampSpeed(0,targetSpeed); // Ramp up to speed
// old_dia = 0; // Force speed recalc
// }

//
// Reset speed if required
//

 

Thanks,
Voltage


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

@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.

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


   
ReplyQuote
Page 15 / 21