# 7. Groove Mechanism

A project log for 3D Pottery Machine for kids' STEM education

Cornstarch mini pottery machine, built with an old printer and cd-player, and useful for kids' STEM education

Guillermo Perez Guillen 06/02/2022 at 05:290 Comments

I have added this system in order to create circular or elliptical grooves in the figures created with the cornstarch paste. Once the grooves are finished, I have added cornstarch paste of another color to cover these slots. Below I show you the schematic diagram.

How does it work?

• By means of the matrix keyboard we control the punch mechanism, that is to say that by pressing the F key the mechanism goes down, and by pressing the E key the mechanism goes up.
• The matrix keyboard also controls the movement of the stepper motor. Eg, pressing the D key moves the mechanism to the first groove position, and If we press the C key, the mechanism returns to the origin.

The punch mechanism was made with parts from an audio player and aluminum angles.

Below I show you the code:

pottery_machine_ver2.ino

```// AUTHOR: GUILLERMO PEREZ GUILLEN

#include <Servo.h>
#include <Stepper.h>

#define STEPS 48 //We put the number of steps you need to go around. 48 in our case

// Name of the motor, the number of steps and the control pins
Stepper stepper(STEPS, 8, 9, 10, 11);

Servo myservo;
int pos = 103;

const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the symbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'0','1','2','3'},
{'4','5','6','7'},
{'8','9','A','B'},
{'C','D','E','F'}
};
byte rowPins[ROWS] = {30, 31, 32, 33}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {34, 35, 36, 37}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad

void setup(){
Serial.begin(9600);
myservo.attach(7);
stepper.setSpeed(60); // velocity of the etepper motor at 60 RPM
}

void loop(){

// go down the servo
if (customKey == 'F'){
Serial.println(customKey);
for (pos = 103; pos <= 140; pos += 1)
{
myservo.write(pos);
delay(15);
}
}

// go up the servo
if (customKey == 'E'){
Serial.println(customKey);
for (pos = 140; pos >= 103; pos -= 1)
{
myservo.write(pos);
delay(15);
}
}

// move the mechanism to the first groove
if (customKey == 'D'){
Serial.println(customKey);
stepper.step(135);
delay(15);
}

// return the mechanism to the  origin
if (customKey == 'C'){
Serial.println(customKey);
stepper.step(-135);
delay(15);
}

// move the mechanism to the second groove
if (customKey == 'B'){
Serial.println(customKey);
stepper.step(120);
delay(15);
}

// return the mechanism to the origin
if (customKey == 'A'){
Serial.println(customKey);
stepper.step(-120);
delay(15);
}

// move the mechanism to the third groove
if (customKey == '9'){
Serial.println(customKey);
stepper.step(105);
delay(15);
}

// return the mechanism to the origin
if (customKey == '8'){
Serial.println(customKey);
stepper.step(-105);
delay(15);
}

// move the mechanism to the fourth groove
if (customKey == '7'){
Serial.println(customKey);
stepper.step(90);
delay(15);
}

// return the mechanism to the origin
if (customKey == '6'){
Serial.println(customKey);
stepper.step(-90);
delay(15);
}
}
```