Skip to content

- Making Control system

This page is my work process for week 10 machine building. We plan to make Vacuum Forming.

1. The Parts I used

Below is the required parts which I picked up.

- Board

- Output

- Input

- Power Supply

2. Power Line (Plan)

Below is Plan for Power Line, Vacuum Forming. alt text

3. Datasheet

- Raspberry Pi Pico (Pinout)

alt text

- Stepper 17HD48002H-22B

  • 1 Step angle =1.8° (200 pulse(step) for 360°) alt text

- Motor Driver TB6600

  • Input Current: 0-5.0A
  • Output Current: 0.5-4.0A
  • Power (MAX): 160W
  • Micro Step 1,2/A, 2/B, 4, 8, 16,32

  • Microcontroller Connection is below in datasheet.
    alt text

  • Microcontroller Connection is below in DFROBOT.
    alt text

-Solid State Relay: SSR-40DA

alt text

- Photocoupler TLP293

alt text

4. Board Making

I made board design for the assignment of week10 as below. For chip, I choose Raspberry Pi Pico as it has many GPIOasse.

- Schematic by Kicad.

alt text

- PCB by Kicad

alt text

- Milling

Milling details same as Week08.

- Soldering & tester check

alt text

5. Making Control Box & Panel, by laser cutting

5-1) Control BOX

  • Consider the position of parts and size of control box size. alt text
  • I made Control BOX, using laser cutting machine.
    • Make Model
      • by Fusion360 and exported in SVG format about top face.
      • and Makecase
    • Laser cutting
      • Machine: FABOOL Laser CO2
      • Materials: veneer t=4mm
      • Software: SmartDIYsCreator
      • Parameter: Speed 1500, Power 40, Times 3

alt text
- Attach the necessary parts to the base of the Control Box.
alt text
- Install the outer frame of the control box   alt text

Then, It's time to wire for the prototype.

5-2) Wiring

Wiring is done using many tools and terminal assortment. alt text alt text During wiring work.
alt text

  • Limit Switch alt text
  • Power line (AC inlet) and Terminal block. alt text
  • Wall outlet:
    peel the cover of code about the length of guide on the outlet. alt text

alt text alt text alt text

5-3) Panel

I made Push-button switch panel, using laser cutting machine.

  • Make Model
    • by Fusion360
    • exported in SVG format about top face.
  • Laser cutting
    • Machine: FABOOL Laser CO2
    • Materials: acrylic board
    • Software: SmartDIYsCreator
    • Parameter: Speed 900, Power 60, Times 2 alt text Then I install Push-button switch to panel. alt text

6. Assembly

It's time to assemble. Masuoka-san and I work for assemble together.

alt text
Install Motor
alt text
Install Limit Switch
alt text
Install Control box alt text
Install Panel
alt text
Bundle the wires   alt text
Prototype1 assembly is Done.
alt text
After test ON 11-April, We choose electric heating stove to heat. alt text
Install electric heating stove (Work on Progress)

7. Programming code

The completion code is as follows

// Pin definitions for stepper motors A and B
const int motorA_PUL = 16;
const int motorA_DIR = 17;
const int motorA_ENA = 18;

const int motorB_PUL = 19;
const int motorB_DIR = 20;
const int motorB_ENA = 21;

// Pin definitions for sStart button and limit switch 
const int limitSwitchAPin_up = 0;
const int limitSwitchBPin_up = 1;
const int limitSwitchAPin_down = 2;
const int limitSwitchBPin_down = 3;
const int upButtonPin = 4;
const int downButtonPin = 5;
const int heatButtonPin = 6;
const int startButtonPin = 7;

// Pin Definition for Relay
const int heater_relay = 27;
const int vacuum_relay = 28;

// Stepping motor step count and delay time
const int stepsPerRevolution = 200;
const int stepDelay = 200000 / stepsPerRevolution; // MicroSec

void setup() {
  // Setting of Pin 
  pinMode(motorA_DIR, OUTPUT);
  pinMode(motorA_PUL, OUTPUT);
  pinMode(motorA_ENA, OUTPUT);

  pinMode(motorB_DIR, OUTPUT);
  pinMode(motorB_PUL, OUTPUT);
  pinMode(motorB_ENA, OUTPUT);

  pinMode(upButtonPin, INPUT_PULLUP);
  pinMode(downButtonPin, INPUT_PULLUP);
  pinMode(startButtonPin, INPUT_PULLUP);
  pinMode(heatButtonPin, INPUT_PULLUP);
  pinMode(limitSwitchAPin_up, INPUT_PULLUP);
  pinMode(limitSwitchBPin_up, INPUT_PULLUP);
  pinMode(limitSwitchAPin_down, INPUT_PULLUP);
  pinMode(limitSwitchBPin_down, INPUT_PULLUP);

  // Setting of Relay pin
  pinMode(heater_relay, OUTPUT);
  pinMode(vacuum_relay, OUTPUT);
}

void loop() {

 // (1)When the up button is pressed
 if (digitalRead(upButtonPin) == LOW) {

     // Enable stepper motors
         digitalWrite(motorA_ENA, HIGH);
         digitalWrite(motorB_ENA, HIGH);

     //Rotate both stepper motors
      if (digitalRead(limitSwitchAPin_up) == HIGH) {
        rotateMotor_cw(motorA_DIR, motorA_PUL);
      }

      if (digitalRead(limitSwitchBPin_up) == HIGH) {
        rotateMotor_cw(motorB_DIR, motorB_PUL);
      }
    }

 // (2)When the down button is pressed
 if (digitalRead(downButtonPin) == LOW) {

     // Enable stepper motors
         digitalWrite(motorA_ENA, HIGH);
         digitalWrite(motorB_ENA, HIGH);

     //Rotate both stepper motors
      if (digitalRead(limitSwitchAPin_down) == HIGH) {
        rotateMotor_ccw(motorA_DIR, motorA_PUL);
      }

      if (digitalRead(limitSwitchBPin_down) == HIGH) {
        rotateMotor_ccw(motorB_DIR, motorB_PUL);
      }
    }

 // (3)When the heating button is pressed
 if (digitalRead(heatButtonPin) == LOW) {
     // Enable stepper motors
         digitalWrite(motorA_ENA, HIGH);
         digitalWrite(motorB_ENA, HIGH);

     // Rotate both stepping motors until both limit switches A and B are pressed
      while (digitalRead(limitSwitchAPin_up) == HIGH || digitalRead(limitSwitchBPin_up) == HIGH) {
       if (digitalRead(limitSwitchAPin_up) == HIGH) {
         rotateMotor_cw(motorA_DIR, motorA_PUL);
        }

       if (digitalRead(limitSwitchBPin_up) == HIGH) {
         rotateMotor_cw(motorB_DIR, motorB_PUL);
        }
     }
     // Heater relay ON when both limit switches A and B are pressed
        digitalWrite(heater_relay, HIGH);

     //Heating OFF when start button is pressed
      if (digitalRead(startButtonPin) == LOW) {        
       digitalWrite(heater_relay, LOW);
     }
 }

 // (4)When the start button is pressed
 if (digitalRead(startButtonPin) == LOW) {
     // Enable stepper motors
      digitalWrite(motorA_ENA, HIGH);
      digitalWrite(motorB_ENA, HIGH);

     // Rotate both stepping motors until both limit switches A and B are pressed
      while (digitalRead(limitSwitchAPin_down) == HIGH || digitalRead(limitSwitchBPin_down) == HIGH) {
       if (digitalRead(limitSwitchAPin_down) == HIGH) {
         rotateMotor_ccw(motorA_DIR, motorA_PUL);
        }

       if (digitalRead(limitSwitchBPin_down) == HIGH) {
         rotateMotor_ccw(motorB_DIR, motorB_PUL);
        }
     }

     // Vacuum relay ON for 10 seconds when both limit switches A and B are pressed
         digitalWrite(vacuum_relay, HIGH);
         delay(10000);                        
         digitalWrite(vacuum_relay, LOW);    
         delay(1000);
    }

}


// function definition 

void rotateMotor_cw(int motor_DIR_cw, int motor_PUL_cw) {
  digitalWrite(motor_DIR_cw, HIGH); // Rotate in clockwise direction
  digitalWrite(motor_PUL_cw, HIGH);
  delayMicroseconds(stepDelay);
  digitalWrite(motor_PUL_cw, LOW);
  delayMicroseconds(stepDelay);
}

void rotateMotor_ccw(int motor_DIR_ccw, int motor_PUL_ccw) {
  digitalWrite(motor_DIR_ccw, LOW); // Rotate in counterclockwise direction
  digitalWrite(motor_PUL_ccw, HIGH);
  delayMicroseconds(stepDelay);
  digitalWrite(motor_PUL_ccw, LOW);
  delayMicroseconds(stepDelay);
}

Reference code

In my case, I had a very hard time with the program code. The following sites and others helped me.

8. My Thought

  • I am in charge of Making Control system for Machine building. It was very wonderful experience for me.
  • There was so much to do for machine building that there was no time at all. (connections, programming, and wiring work, etc)
  • Space for installing Control Box components is small. For future work, I leaned the outbox size should made it wider.
  • Wires are disconnected and debugging is frequent, so I changed to caulking terminals that are difficult to disconnect.
  • I've also learned that wiring with long length can result become inconvenience.