Loading

MakerBot Print is our newest print-prepration software, which supports native CAD files and STL assemblies,
allows you to interact with all your printers via the Cloud, and many other exciting new features.

Download Now

Can Crusher Help

Please Login to Comment

I am working to make a dual push button program to actuate a can crusher for my kid so that he won't crush his little fingers. I have already created a functioning code but would like to make it so that if either button (or statement) is held down too long the output will turn off, the code below takes both buttons to turn on the output and if either button is released the output turns off. I just don't want him to get smart enough to tape/block one button on so that he only has to use one button to actuate the crusher potential crushing his hand instead of the can. Any help with this would be appreciated

int left = 2;
int right = 3;
int crush = 8;
int pbLeft = 0;
int pbRight = 0;

void setup() {
// put your setup code here, to run once:
pinMode (left, INPUT);
pinMode (right, INPUT);
pinMode (crush , OUTPUT);
Serial.begin (9600);

}

void loop() {
// put your main code here, to run repeatedly:

pbLeft = digitalRead(left);
pbRight = digitalRead(right);

if (pbLeft == HIGH && pbRight == HIGH){
digitalWrite(crush,HIGH);
}

if (pbLeft == LOW || pbRight == LOW){
digitalWrite(crush, LOW);
}

}

Hola Caveb578

Por tiempo yo no se hacerlo, pero te propongo otra solución (no se si te valdrá). Consiste en añadir un permiso para que el ciclo se resetee y tu hijo tenga que soltar siempre los dos botones y volverlos a pulsar ( así eliminarías la posibilidad de que deje algo puesto en alguno de los dos botones). El programa sería el de abajo. Ya me dirás si te funciona.
Un saludo y suerte

int left = 2;
int right = 3;
int crush = 8;
int pbLeft = 0;
int pbRight = 0;
int permit=0;

void setup() {
// put your setup code here, to run once:
pinMode (left, INPUT);
pinMode (right, INPUT);
pinMode (crush , OUTPUT);
Serial.begin (9600);

}

void loop() {
// put your main code here, to run repeatedly:

pbLeft = digitalRead(left);
pbRight = digitalRead(right);

if (pbLeft == HIGH && pbRight == HIGH && permit == 1){
digitalWrite(crush,HIGH);
}

if (pbLeft == LOW || pbRight == LOW){
digitalWrite(crush, LOW);
permit = 0;
}
if (pbLeft == LOW && pbRight == LOW){
permit = 1;
}
}

Hi agsv,

I didn't think of using that I will give it a try, ordering parts next week to start building this project. I

The code stevesch posted looks like what you need for your idea, but I am curious what the details of your machine are... like is it just 2 push buttons, or is one of the buttons a "can sensor"? Also curious what you're using for mechanics... cool idea you have there.

Hi truglodite the idea is definitely two push buttons that when pushed with turn on a relay and actuate a pneumatic solenoid to operate a ram that crushes the can. Two buttons to keep the operator from accidently crushing an appendage. Later I plan on expanding this project with a hopper and a sensor to start with the buttons and crush until the hopper is empty. I am getting parts from amazon I will use a 12vdc power supply and a relay for the solenoid.

https://www.amazon.com/gp/product/B08QZ5RPJX/ref=ox_sc_saved_image_6?smid=A2GWB408K7VADK&th=1

https://www.amazon.com/gp/product/B07SJFV7S3/ref=ox_sc_saved_image_7?smid=A37DFQ476WZ5XM&psc=1

Imagining this thing in use... an intake hopper would be almost a prerequisite to the design. Then like homeowner wood chippers, you can just make the hopper long enough to keep hands out of the pinch area for adequate safety. Also it would be convenient if you could bring a small collection of cans to the garage, then simply drop em in a hopper and walk away... have crushing start a minute after sensing a can, so maybe nobody has to hear it. I can imagine such a hopper itself being a somewhat complex project by the time it is reliable and jam free.

I hadn't thought about a delay after filling the hopper to start automatically I like that idea. I haven't owned a welder in years (15+) but definitely one of my near future purchases. The hopper will be my first project to get back into welding

I've been on the fence on buying a Millermatic 211 for a couple of years now... with only a handful of mundane projects for it, pulling the trigger has not been easy. I also have been eying the Vulcan Migmax 215, but reliability and parts availability have me leaning toward blue. It sounds like you have the perfect excuse to grab yourself a welder though... lots of fun headed your way in the future! ;)

I have not settled on a brand as of yet, thinking about a multi process but not sure that I would use it enough. I stalked your profile and noticed that you have several cool designs for the MPCNC and Arduino I built the MPCNC a while back and it has been an awesome way to make just about anything I tried aluminium with good success but now I need to reprint the core mount . I am currently using an old rotozip router I had from when I did construction How do you like the bosch brand?

I personally really like my Bosch colt router, but on the MPCNC forums a lot of folks are swearing by the DW611, or ideally a 220V watercooled spindle. My understanding is the colt used to have very low runout, but allegedly QC has declined and runout on colt collets that can sometimes be too much for finer work. I bought my colt for work about 2yrs before building a cnc, so it was a natural fit when I was putting together parts for my cnc. It has served that purpose well IMHO... cut some small alum parts with fine details, cut pcb's all the time, and even did good in the 'mpcnc drag race' event (I think fastest of the non-watercooled spindles actually). That said, if I was refitting a new spindle on mine today, I'd be looking at watercooled (lots of great info on the mpcnc forums about this).

IMHO one of the major advantages of the Bosch is it's RPM feedback speed control. It's capable of lower RPM than most small routers available, and it holds RPM fairly solid while cutting. As you may have learned with your rotozip (I also have one of those for work ;)), the speed you want your bit to turn is usually a low slower than what most small routers can do. Also, the rotozip like most cheaper routers, does not have RPM feedback, so as soon as the bit starts cutting, RPM drops significantly. That gives less control over the process, ultimately leading to lower quality parts. There have been lots of discussions about adding RPM control to the DW611, which may be of interest to you... but in the end the watercooled 220V spindle will be the one that allows you to make the most out of an mpcnc.

My Roto zip would be considered vintage today I bought it back about 20+ years ago I have been out of construction work for quite some time now the Rpms hold ok as long as I give it a moment to warm up and really wish it would go slower it is definitely not the tool it once was. I will look into the water-cooled models to see if that is something I want to go with. Right now, I am running everything on extension cords working to get power ran to my outbuilding so that I can really get a shop set up.

I've still got my ~20yo rotozip as well... it still gets to come out and play when I hang drywall, and it's perfect for that.

You and I have very similar aspirations. When I purchased and renovated my home, I started right off with plans for an outbuilding/shop. I ran a 100A subpanel to the far corner of the main building, so my dig would be easy later on. Unfortunately for me, I have some landscaping obstacles to deal with... mainly a 4' tall 20' long brick wall with stub foundation that frames a 20'x10' raised planter, also surrounded in bricks... smack dab in the middle of the ideal location. That's not to mention the old growth Japanese maples and wysteria plants I have to work around for my feeder to make it there (sigh). I'm sure you'll be done with yours before I even get to laying cable on mine. ;)

If everything works out I hope to have funds available later on this year to get the power ran of course that is as long as Murphy's law doesn't come out to play

/*
You could use something like the Button2 library and its
"was_pressed_for" function to simplify (it handles some
button "debouncing" also, which can be helpful), but
if you really want to do it without a lib, I'd do
something like this:
*/

unsigned long leftPressStart = 0;
unsigned long rightPressStart = 0;

const unsigned long maxHoldTime = 5000; // in milliseconds

bool pbLeft = false;
bool pbRight = false;

void loop() {
  // put your main code here, to run repeatedly:
  uint32_t timeNow = millis();

  /* Button Sampling */
  bool leftNow = (digitalRead(left) == HIGH); // assuming "HIGH" is pressed
  if (leftNow && !pbLeft)
  {
    leftPressStart = timeNow;
  }
  pbLeft = leftNow;

  // exactly the same for right (also an indication that
  // you should probably reuse a struct or class)
  bool rightNow = (digitalRead(right) == HIGH);
  if (rightNow && !pbRight)
  {
    rightPressStart = timeNow;
  }
  pbRight = rightNow;

  /* Crush Logic */
  bool performCrush = false;
  if (pbLeft && pbRight)
  {
    unsigned long leftHeld = timeNow - leftPressStart;
    unsigned long rightHeld = timeNow - rightPressStart;
    if ((leftHeld < maxHoldTime) && (rightHeld < maxHoldTime))
    {
      performCrush = true;
    }
  }

  /* Output Action */
  if (performCrush)
  {
    digitalWrite(crush, HIGH);
  }
  else
  {
    digitalWrite(crush, LOW);
  }
}

Thanks Stevesch I didn't know about the library I will check that out as well I am fairly new at arduino programming just started learning it a couple months ago

Noticed the maxHoldTime is not declared, but that may not be a big deal for the OP. ;)

I edited/added the maxHoldTime. Thanks.
I figure this "can crusher" is just cover for some nefarious device ;-)

Not yet but a few mods and sure why not