Dipping machine

Product: PLEX Controller

This machine was a test machine that can dip objects into a solution for coating or cleaning. It works well but the dipping space is not that large, hard to use when the object is large or the beaker is large and the dipping drifts as its gets dipped because of how it works. It was a test to see the problems with making a dip coater.
Find the parts here: https://www.thingiverse.com/thing:2721727

Operation

After powering the mill with 12V DC power, settings can be seen/changed using the LCD and can be altered using the 3 buttons (up, down and enter). Speed and height are the 2 settings that can be set to control the dip. While running, By pressing the enter button, the dip will reset.

parts list

1 x PLEX controller
1 x 28byj-48 stepper motor
1 x Gt2 Timing Belt
3 x limit switch interrupt
2 x 20mm M3 screw
2 x 20mm M3 screw
4 x M3 nuts
1 x acrylic base
4 x rubber feet

Controller

The controller used is the PLEX board from https://tinkersprojects.com/project/plex-controller/. The controller Uses a 16×2 LCD and buttons inputs to set settings display speed/distance while in operation. The limit switch is the reset the dipper to a set hight for dipping, this is that starting point of each dip. The controller sends a pulse to the stepper motor to make the dipping arm go up and down.

Code for Project

GNU General Public License v3.0

#include <LiquidCrystal.h>
#include <AccelStepper.h>

LiquidCrystal lcd(2, 4, 5, 6, 7, 8);

#define upPIN 0
#define startstopPIN 1
#define downPIN 10
#define limitPIN 3

//#define InPinA 16
//#define InPinB 19
//#define InSePinA 9
//#define InSePinB 14
//#define InSePinC 15
  
#define OutPinA 19
#define OutPinB 16
#define OutSePinA 9
#define OutSePinB 14
#define OutSePinC 15

#define en 10


#define i 3
#define steps 23//1000
long  Dipping = 30;
long unsigned down = 1;
long unsigned up = 1;
long pause = 1;
bool run = 1;

unsigned int data[8];
AccelStepper stepper[8];
unsigned long currenttime[8];


void setup() 
{
  lcd.begin(16, 2);
  //pinMode(en, OUTPUT);
  //digitalWrite(en, HIGH);
  pinMode(OutSePinA, OUTPUT);
  pinMode(OutSePinB, OUTPUT);
  pinMode(OutSePinC, OUTPUT);
 // pinMode(InSePinA, OUTPUT);
  //pinMode(InSePinB, OUTPUT);
  //pinMode(InSePinC, OUTPUT);
  
  //pinMode(InPinA, INPUT);
  //pinMode(InPinB, INPUT);
  pinMode(OutPinA, OUTPUT);
  pinMode(OutPinB, OUTPUT);
  
  pinMode(upPIN, INPUT);
  pinMode(startstopPIN, INPUT);
  pinMode(downPIN, INPUT);
  pinMode(limitPIN, INPUT);
  
  selectLED(i);
  stepper[i] = AccelStepper(1,OutPinB,OutPinA);
  stepper[i].setMaxSpeed(200*steps/60);
  stepper[i].setAcceleration(100.0);

  restdip();
}

void loop() 
{
  run = 1;
  digitalWrite(en, HIGH);
  
  lcd.clear();
  lcd.print("Dipping Distances");  
  while( digitalRead(startstopPIN) == LOW)
  {  
    lcd.setCursor(0,1);
    lcd.print(Dipping);
    lcd.print(" mm      ");
    delay(100);
    if(digitalRead(upPIN) == HIGH)Dipping++;
    if(digitalRead(downPIN) == HIGH)Dipping--;
    if(Dipping > 100) Dipping = 100;
    if(Dipping < 1) Dipping = 1;
  }

  delay(100);
  while(digitalRead(startstopPIN) == HIGH);
  delay(100);

  lcd.clear();
  lcd.print("Down Speed");  
  while(digitalRead(startstopPIN) == LOW)
  {  
    lcd.setCursor(0,1);
    lcd.print(pause);
    lcd.print(" mS      ");
    delay(100);
    if(digitalRead(upPIN) == HIGH)pause = pause+100;
    if(digitalRead(downPIN) == HIGH)pause = pause-100;
    if(pause > 60000) pause = 60000;
    if(pause < 1) pause = 1;
  }

  delay(100);
  while(digitalRead(startstopPIN) == HIGH);
  delay(100);

  lcd.clear();
  lcd.print("Up Speed");  
  while(digitalRead(startstopPIN) == LOW)
  {  
    lcd.setCursor(0,1);
    lcd.print(up);
    lcd.print(" mS      ");
    delay(100);
    if(digitalRead(upPIN) == HIGH)up++;
    if(digitalRead(downPIN) == HIGH)up--;
    if(up > 100) up = 100;
    if(up < 1) up = 1;
  }

  delay(100);
  while(digitalRead(startstopPIN) == HIGH);
  delay(100);

  lcd.clear();
  lcd.print("Start Dipping");  
  while(digitalRead(startstopPIN) == LOW)
  {  
    lcd.setCursor(0,1);
    if(run)
    {lcd.print("Yes");}
    else
    {lcd.print("No ");}
    
    delay(100);
    if(digitalRead(upPIN) == HIGH)run = 1;
    if(digitalRead(downPIN) == HIGH)run = 0;
  }

  delay(100);
  while(digitalRead(startstopPIN) == HIGH);
  delay(100);

  if(!run){return;}

  restdip();
  
  digitalWrite(en, LOW);
  
  lcd.clear();
  lcd.print("Runnning");


  stepper[i].setSpeed(down);
  stepper[i].move(Dipping*steps);
  while(stepper[i].distanceToGo())
  {
    stepper[i].run();
  }
  
  delay(pause);
  
  stepper[i].setSpeed(up);
  while(digitalRead(limitPIN) == LOW)
  {
    stepper[i].move(-1*Dipping*steps);
    stepper[i].run();
  }
  
  digitalWrite(en, HIGH);
  
  delay(100);
  while(digitalRead(startstopPIN) == HIGH);
  delay(100);

  lcd.clear();
  lcd.print("Finished");  
  while(digitalRead(startstopPIN) == LOW) {}
  
  delay(100);
  while(digitalRead(startstopPIN) == HIGH);
  delay(100);
}



void selectLED(byte A)
{
  switch (A) {
    case 0:
        digitalWrite(OutSePinA, LOW);
        digitalWrite(OutSePinB, LOW);
        digitalWrite(OutSePinC, LOW);
      break;
    case 1:
        digitalWrite(OutSePinA, HIGH);
        digitalWrite(OutSePinB, LOW);
        digitalWrite(OutSePinC, LOW);
      break;
    case 2:
        digitalWrite(OutSePinA, LOW);
        digitalWrite(OutSePinB, HIGH);
        digitalWrite(OutSePinC, LOW);
      break;
    case 3:
        digitalWrite(OutSePinA, HIGH);
        digitalWrite(OutSePinB, HIGH);
        digitalWrite(OutSePinC, LOW);
      break;
    case 4:
        digitalWrite(OutSePinA, LOW);
        digitalWrite(OutSePinB, LOW);
        digitalWrite(OutSePinC, HIGH);
      break;
    case 5:
        digitalWrite(OutSePinA, HIGH);
        digitalWrite(OutSePinB, LOW);
        digitalWrite(OutSePinC, HIGH);
      break;
    case 6:
        digitalWrite(OutSePinA, LOW);
        digitalWrite(OutSePinB, HIGH);
        digitalWrite(OutSePinC, HIGH);
      break;
    case 7:
        digitalWrite(OutSePinA, HIGH);
        digitalWrite(OutSePinB, HIGH);
        digitalWrite(OutSePinC, HIGH);
      break;
    case 8:
        digitalWrite(OutSePinA, LOW);
        digitalWrite(OutSePinB, LOW);
        digitalWrite(OutSePinC, LOW);
      break;
    break;
  }
}


void restdip()
{
  digitalWrite(en, LOW);
  
  lcd.clear();
  lcd.print("Resetting");
  while(digitalRead(limitPIN) == LOW)
  {
    stepper[i].move(-100);
    stepper[i].run();
  }
  
  stepper[i].move(0);
  stepper[i].stop();
  digitalWrite(en, HIGH);
}

Latest Projects

Popular Projects