Notifications
Clear all

Crusher Code Issues

74 Posts
3 Users
30 Likes
4,766 Views
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2538
 

@zander 

As far as I know, stepper drivers are set to use a constant voltage while operating. Available force (torque) can be increased by using a higher voltage to drive the motors, but I don't believe that the voltage is altered within the driver. It just takes the pulses from the uController and pulses the windings with the available voltage.

The physics is clear. work = force x distance. So the work done returning the jaw only depends on the weight of the jaw and the friction of the mechanism.However, the work done crushing the can is the same amount of work done pushing the jaw PLUS the work done crushing the can.

So the return trip requires far less work.

Think about driving your car 100 miles with a trailer 100 miles to a place where you load the trailer with a ton of pea gravel for your driveway. The return trip with the a LOT more energy and you'll use a LOT more fuel even though the distance was the same in both directions.

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


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7084
 

@will All true. Maybe I have lost the point of this thread.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


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

@zander 

There wasn't all that much to my suggestion.

it was just intended to suggest that the operational cycle time of the crusher could be improved by returning the jaw faster than the crush cycle required. It was just a trivial refinement rather than a jaw-droppingly significant revelation 🙂

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


   
ReplyQuote
Clark77494
(@clark77494)
Member
Joined: 2 years ago
Posts: 69
Topic starter  

@will That would make since to make it go much faster on the return. My next modification is to put limit switches on both sides, so that it would simply return once it hit the one switch and stop on the other. The reason I have made it so slow is when I first got the Ball Screw (That's the device with the cork screw.) The motor had reversed directions on me and the Ball Screw assembly started flopping on the desk like an angry machine, until the shaft coupling broke loose. Want to stay cautious until the bugs get worked out. Once it is working properly I am going to mount it on the wall above the recycle bin.   

It's great to tip your server unless you work in the Server Room!


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

@clark77494 

You'll probably need the "far end" limit switch to position the jaw when you first start the machine as you won't be certain that it's already in the proper position. You'll have to be careful positioning the "that's crashed enough" limit switch to avoid overloading the stepper if you try an unusually strong or oversized can. 

If you're going to mount it above the recycle bin, then another worthwhile addition would be a servo or something to flip the crushed hull over the side of the crusher directly into the bin 🙂

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


   
Clark77494 and Ron reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7084
 

@will I knew it you are a distant cousin of Rube Goldberg.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
My personal scorecard is now 1 PC hardware fix (circa 1982), 1 open source fix (at age 82), and 2 zero day bugs in a major OS.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2538
 
Posted by: @zander

@will I knew it you are a distant cousin of Rube Goldberg.

Nah, I'm far too lazy to build anything that intricate 🙂

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


   
ReplyQuote
Clark77494
(@clark77494)
Member
Joined: 2 years ago
Posts: 69
Topic starter  

@zander The NEMA 34 Stepper Motor has a maximum voltage rating of 80 volts along with the stepper controller. Problem is an 80 Volt power supply is 6-8 week back order and it very pricy compared to a 50 Volt variable power supply ($36.00 on Amazon) which is currently installed. I ran it at 24 volts to see if it made a difference on speed and it wasn't much. I ordered an RPM gauge which should be here is a couple of days to better figure out how many RPM the NEMA 34 is producing. I just received the Raspberry Pi Pico today along with the Level Converter (3.3 Volt Logic vs 5 Volt Stepper controller logic) and am in the process of learning a new code called Thonny, which is Python based code. Once I get up to speed. I will wire up the Pico to the Stepper controller and see if it goes any faster.

Pico with level Converter

 

It's great to tip your server unless you work in the Server Room!


   
ReplyQuote
Clark77494
(@clark77494)
Member
Joined: 2 years ago
Posts: 69
Topic starter  

@will I made a can crusher before using a screen door actuator. It will be a simple matter of putting a square hole in the wood so when the can gets crushed to a certain size it will simply fall in the bin. 🙂

It's great to tip your server unless you work in the Server Room!


   
Will reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2538
 
Posted by: @clark77494

@will I made a can crusher before using a screen door actuator. It will be a simple matter of putting a square hole in the wood so when the can gets crushed to a certain size it will simply fall in the bin. 🙂

Even better, not extra parts required 🙂

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


   
ReplyQuote
Clark77494
(@clark77494)
Member
Joined: 2 years ago
Posts: 69
Topic starter  

 

@will I ditched the Raspberry Pi Pico idea and went back to the Arduino Uno idea. I just received a tachometer today. Surprisingly the motor is spinning at  1,140 RPM, the maximum RPM for the NEMA 34 motor is 1,500 RPM at 80 volts and I am running at 50 volts. I just ran into one more problem and that is after half a cycle the motor is not reversing direction. When I put in the can crusher code the motor reverses just fine. Here is the code.

RPM Gauge
/*
 Single Spin Profile 
 */

#include <Stepper.h>
//#include <AccelStepper.h>

//NEMA-34 Motor with CL86T Closed Loop Conroller

const int STEPS_PER_ROTATION = 3200; //3200 Steps per full Rotation

//DM542T Stepper Controller pinouts
const int INPUT1 =2; //PUL+ To Digital pin 2
const int INPUT2 =3; //PUL- To Digital pin 3
//const int INPUT3 =5; //DIR+ To Digital pin 4
//const int INPUT4 =6; //DIR- To Digital pin 5


//Initialize the stepper library to stepper motor controller
Stepper myStepper(STEPS_PER_ROTATION, INPUT1, INPUT2); //  ,INPUT3, INPUT4);

void setup() {
  // Set Motor to initial bootup speed
   myStepper.setSpeed(1500); //1500 RPM
   myStepper.step(1600); // default 1600
   delay (2000);

   // Set Motor to initial bootup speed
   myStepper.setSpeed(40); //1500 RPM
   myStepper.step(-1600); // default -1600
  delay(2000); 
}

void loop() {
  // Set Motor to initial bootup speed
  //myStepper.setSpeed(3200); //1500 RPM
  //myStepper.step(3200); // default 3200

}
 

 

It's great to tip your server unless you work in the Server Room!


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

@clark77494 

Then why not just modify the can crusher code to suit this application ?

You say "after half a cycle the motor is not reversing direction" but I don't understand what you mean by that.

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


   
ReplyQuote
Clark77494
(@clark77494)
Member
Joined: 2 years ago
Posts: 69
Topic starter  

@will I looked at the can crusher code and there is no difference in the code. That is what is puzzling. The first code is from the motor that is not reversing direction and the second code is from the crusher. On the first design I  used a corkscrew gear design, on the second I am using more of a rotary gear design. 

// Set Motor to initial bootup speed
   myStepper.setSpeed(40); //1500 RPM
   myStepper.step(-1600); // default -1600
  delay(2000); 
 // Set return on motor
myStepper.setSpeed(100); // Default speed 100 RPM
// Set the rotation
myStepper.step(-20000);

It's great to tip your server unless you work in the Server Room!


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

@clark77494 

I'm confused. You told me that you had a problem with the can crusher (Mark1). I sent you a sketch that did the same thing but did NOT use the Stepper class, just raw commands to the driver. You replied that it worked, so the "can crusher" code that I'm referring to is the class-less sketch I sent. I believe that you had to change the pins for the pulse and direction but I don't know which ones you used.

I'm assuming that you meant that the sketch I sent worked properly. Is that correct ? Is that the code you're using now or have you reverted to the previous code using the Stepper class ?

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


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

@clark77494 

Here's a class-less sketch that will help you determine what inter-pulse delay you'll need to get your 1500 RPM. You'll need to change the pulse and direction pins to match your current stepper driver setup.

You will need to add a normally open pushbutton switch with one end to pin 6 of the Arduino and the other end of the switch to ground on the Arduino.

This sketch starts with a time of 500 uSecs for each pulse and continuously spins the motor. Each push of the button will result in decrementing the time by 10 uSec and will print out the new time being used for the pulses. Let the motor run for a few seconds to stabilize at the new speed and then test it with the tach.

Just power down the Arduino to stop when you've found the required pulse time.

There is a built in limit of 50 uSec as the lowe

st possible pulse time.

 

 

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


   
ReplyQuote
Page 2 / 5