2:30am on a tuesday night.
Week 10
Output design
For output week, I decided to get some progress on my final project, a claycutter machine.
The machine below is a earlier version I made last semester. It is very prelimiary and I hope to design a better version using the skills I learned in HTM.
For starter, I decided to tackle the control system I envisioned in my inital drawing where a knob control one of the axis of the clay cutting interface (like the way user rotates in solidworks to change viewing angle).
The drawing above roughly represent the idea.
I started by following an existing tutorial online that shows how to control a stepper motor with an a4988 module, which I have one a knock-off version from the earlier prototype.
I followed the schematic and design the control PCB. For the micro controller, I am once again forced by lingdong to use his amazing collection of original break out board design for easier debuging.
Although the inital milling was smooth and successful, I accidentally deleted a roll of through holes used to attached the breakout board. Time to mill another one.
Second attempt was much smoother. The only mess up was that I forgot to flip the female headers to the other side of the pcb, but I manage to solder it on by levitating it a bit off of the copper surface.
The assembled control board and microcontroller. Originally I had trouble getting the assembly to work until I went to a office hour by jake where he informed me that I have some floating pins, specifically the sleep and reset pin must be connected. After connecting the two pins, it worked as expected, here is the arduino code:
#include <Stepper.h>
#define STEPS 200
// Define stepper motor connections and motor interface type. Motor interface type must be set to 1 when using a driver
Stepper stepper(STEPS, 19, 22); // Pin 2 connected to DIRECTION & Pin 3 connected to STEP Pin of Driver
#define motorInterfaceType 1
int Pval = 0;
int potVal = 0;
int ENC_CL = 3;
int ENC_DT = 4;
int ENC_SW = 7;
int PRV_CL = LOW;
int PRV_SW = HIGH;
int ONOFF = 0;
void setup() {
pinMode(ENC_CL, INPUT_PULLUP);
pinMode(ENC_DT, INPUT_PULLUP);
pinMode(ENC_SW, INPUT_PULLUP);
Serial.begin(9600);
// Set the maximum speed in steps per second:
stepper.setSpeed(1000);
}
void loop() {
int m = digitalRead(ENC_SW);
if (PRV_SW == LOW && m == HIGH){
Serial.print("c");
}
if (PRV_SW == HIGH && m == LOW){
Serial.print("d");
}
PRV_SW = m;
int n = digitalRead(ENC_CL);
if (PRV_CL == LOW && n == HIGH){
if (digitalRead(ENC_DT) == LOW){
Serial.print("a");
stepper.step(-100);
}else{
Serial.print("b");
stepper.step(100);
}
}
PRV_CL = n;
}
Attaching to the old machine
Added the module to the old prototype to test interaction ands ergonmics.
Quick test.