10. Mechanical Design & Machine Design.¶
For the week of mechanical design and design of a machine, we have developed a proposal for a prototype machine for use in mining, making the application of the knowledge acquired in design, electronics and programming to date. process.
Group Assignment¶
For the group assignment work as FabLab managers from different cities, it has been planned to work in the Digital Fabrication Laboratory of the Arequipa Campus, which also belongs to the Continental University.
Ideation proposal¶
Individual Contribution¶
As part of the contribution for the elaboration of the work, I was assigned the part of: design concept for proposal as work, electronics and automatism part according to the description of the group contribution.
¶
Electronics Components¶
In the electronic design part, the following elements are used as described as ideal for the application. - Regulable Fountain - Nema 17 - RaspBerry Pi Pico - Display Oled - Driver Pololu A4988 - CNC Shield - FR 4 PCB PLATE
Diagram Circuit conection¶
PCB DIAGRAM¶
Code Example¶
Use the three backticks to separate code.
#include <Servo.h>
Servo myservo; //creamos un objeto servo
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//#include <Button.h> //https://github.com/madleech/Button
#define K1 0
#define K2 1
#define K3 2
#define K4 11
#define K5 12
#define K6 13
#define limitSwitch_X 21
#define limitSwitch_Y 22
#define limitSwitch_Z 26
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
#define Led_Power 25
#define enPin 20
#define stepXPin 15 //X.STEP
#define dirXPin 17 // X.DIR
#define stepYPin 14 //Y.STEP
#define dirYPin 18 // Y.DIR
#define stepZPin 16 //Z.STEP
#define dirZPin 19 // Z.DIR
#define stepAPin 27 //Z.STEP
#define dirAPin 28 // Z.DIR
const int stepsPerRev=200;
int pulseWidthMicros = 100; // microseconds
int millisBtwnSteps = 1000;
int estado = 1;
int motor = 0;
int aux1 = 0;
int angulo;
void setup()
{
Serial.begin(9600);
pinMode(K1, INPUT_PULLUP);
pinMode(K2, INPUT_PULLUP);
pinMode(K3, INPUT_PULLUP);
pinMode(K4, INPUT_PULLUP);
pinMode(K5, INPUT_PULLUP);
pinMode(K6, INPUT_PULLUP);
pinMode(limitSwitch_X, INPUT_PULLUP);
pinMode(limitSwitch_Y, INPUT_PULLUP);
pinMode(limitSwitch_Z, INPUT_PULLUP);
myservo.attach(3);
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))
{ // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for(;;);
}
delay(2000);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
// Display static text
display.println("FABLAB UC ");
display.println("");
display.println(" BRAZO ");
display.println(" ROBOTICO ");
display.display();
pinMode(Led_Power, OUTPUT);
digitalWrite(Led_Power, HIGH);
pinMode(enPin, OUTPUT);
digitalWrite(enPin, LOW);
pinMode(stepXPin, OUTPUT);
pinMode(dirXPin, OUTPUT);
pinMode(stepYPin, OUTPUT);
pinMode(dirYPin, OUTPUT);
pinMode(stepZPin, OUTPUT);
pinMode(dirZPin, OUTPUT);
pinMode(stepAPin, OUTPUT);
pinMode(dirAPin, OUTPUT);
Serial.println(F("CNC Shield Initialized"));
}
void loop()
{
while (estado == 1) // MODO MANUAL
{
if (digitalRead(K2) == LOW)
{
++motor;
if (motor > 5)
motor = 1;
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
// Display static text
display.print(" MOTOR ");
display.println(motor);
display.println("");
display.println("PRESS ");
display.println("BUTTONS ");
display.display();
delay(200);
//aux1=1;
}
//*************** MOTOR BASE ************
if (digitalRead(K1) == LOW && motor == 1)
{
digitalWrite(dirXPin, HIGH); // direccion de giro 1
digitalWrite(stepXPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepXPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
else if (digitalRead(K3) == LOW && motor == 1)
{
digitalWrite(dirXPin, LOW); // direccion de giro 1
digitalWrite(stepXPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepXPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
//*************** MOTOR BRAZO **********
else if (digitalRead(K1) == LOW && motor == 2)
{
digitalWrite(dirYPin, HIGH); // direccion de giro 1
digitalWrite(stepYPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepYPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
else if (digitalRead(K3) == LOW && motor == 2)
{
digitalWrite(dirYPin, LOW); // direccion de giro 1
digitalWrite(stepYPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepYPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
//*************** MOTOR ALTURA *********
else if (digitalRead(K1) == LOW && motor == 3)
{
digitalWrite(dirZPin, HIGH); // direccion de giro 1
digitalWrite(stepZPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepZPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
else if (digitalRead(K3) == LOW && motor == 3)
{
digitalWrite(dirZPin, LOW); // direccion de giro 1
digitalWrite(stepZPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepZPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
//************** MOTOR PLATO GIRATORIO *******
else if (digitalRead(K1) == LOW && motor == 4)
{
digitalWrite(dirAPin, HIGH); // direccion de giro 1
digitalWrite(stepAPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepAPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
else if (digitalRead(K3) == LOW && motor == 4)
{
digitalWrite(dirAPin, LOW); // direccion de giro 1
digitalWrite(stepAPin, HIGH);
delayMicroseconds(pulseWidthMicros);
digitalWrite(stepAPin, LOW);
delayMicroseconds(millisBtwnSteps);
}
//************** PINZA SERVOMOTOR *********
else if (digitalRead(K1) == LOW && motor == 5)
{
angulo = angulo + 10;
if (angulo > 180)
angulo = 180;
myservo.write(angulo);
}
else if (digitalRead(K3) == LOW && motor == 5)
{
angulo = angulo - 10;
if (angulo < 0)
angulo = 0;
myservo.write(angulo);
}
}
while (estado == 2) // MODO AUTOMÁTICO
{
}
}