Computer Controlled Cutting
📤

Output devices

WEEK - 9

Objectives

Group assignment→ link here

Individual

Designing a new board

Last week I made a developer board using Attiny and for this week I am using the SAMD21 processor

The Programmer

programmers · GitLab
Fab Cloud
https://gitlab.fabcloud.org/pub/programmers

We were fortunate enough to have the assistance of Saheen, one of our academy seniors, who had a samd11 programmer with him to help us with our project.

we used his programmer to program ours

Designing a board with SAMD21

functions to be added to this board

My idea is to create a dev board that can be used to do the following functions

Nema 17 stepper motor
OLED display

These are the components that were given to me, the objective was to control these.

with these points in mind, I started designing the PCB in Fusion 360

The design of my SAMD21 dev board

For the datasheet of SAMD21E- click here

  • The processor ATSAMD21 17

PCB layout

Milling the board

the path that is going to be engraved

the board that i got after milling
the soldering setup
components list5

Vola, the board is now completely soldered.

Programming the SAMD21 board I made

for programming the board I made we need an SWD programmer, which we made first.

copy and paste this link to the preferences

copy this <- https://raw.githubusercontent.com/qbolsee/ArduinoCore-fab-sam/master/json/package_Fab_SAM_index.json

  • now search for Fab sam
  • and we will get the following
  • and now install it

installing the Fab SAM core for Arduino

  • select the programmer
  • now burn bootloader
*the bootloader is installed successfully

Blinking the LED for checking the board functions

void setup() {
  pinMode(11, OUTPUT);
}
void loop() {
  digitalWrite(11, HIGH); 
  delay(1000);          
  digitalWrite(11, LOW);   
  delay(1000);             
}

the board is working,

stepper motor

// Define pin connections & motor's steps per revolution
#define dirPin 2
#define stepPin 3

//micro stepping pins
#define MS1 6
#define MS2 5
#define MS3 4


const int stepsPerRevolution = 800;

void setup() {
  // Declare pins as Outputs
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);

  //declaring microstepping pins as output
  pinMode(MS1, OUTPUT);
  pinMode(MS2, OUTPUT);
  pinMode(MS3, OUTPUT);


  //enabling 1/16 microstepping
  digitalWrite(MS1, HIGH);
  digitalWrite(MS2, HIGH);
  // digitalWrite(MS3, HIGH);
}
void loop() {
  // Set motor direction clockwise
  digitalWrite(dirPin, HIGH);

  // Spin motor slowly
  for (int x = 0; x < stepsPerRevolution; x++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(2000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(2000);
  }
  delay(1000);  // Wait a second

  // Set motor direction counterclockwise
  digitalWrite(dirPin, LOW);

  // Spin motor quickly
  for (int x = 0; x < stepsPerRevolution; x++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(1000);
  }
  delay(1000);  // Wait a second
}