Rock tumbler with timer by Spretrep 3d model
3dmdb logo
Thingiverse
Rock tumbler with timer by Spretrep

Rock tumbler with timer by Spretrep

by Thingiverse
Last crawled date: 3 years ago
Rock tumbler with timer
I was thinking of printing JT3D's Affordable rock tumbler but wanted a little more control so I decided to build one based on an Arduino.
The main thing is the stepper motor and using it's rpm and steps/revolution to get an approximation for how long it will run.
Assembly
You should be able to put it together by just looking at the pictures. One thing I decided to do is put bearings in the right side wheels and let them move freely. The drive side is fixed and the bearings sit in the frame.
There's a replacement stl included for the right side of the frame if you decide to go that way.
Barrel insert
The insert for the barrel is 153mm wide. I bought some anti-slip mat that I hot glued to the inside and then just put some glue on the edges and forced it in. I use a bunch of nails and rivets as my polishing media.
Arduino wiring

I used an arduino uno and a perma-proto board to mount the electronics on.
My power adapter is 9V 2A so there's a voltage regulator between the power cord and motor to get it down to 4.83V.
I couldn't find the correct representations for the components so you'll have to check each part for how to connect them.
Code
#include
#include
#include

const int potPin = A0;

Button startButton(3);

const int steps = 200;
const int rpm = 80;
Stepper stepper(steps, 4, 5, 6, 7);

U8GLIB_SSD1306_64X48 oled(U8G_I2C_OPT_NONE);

enum status { stopped, started};
status tumblerStatus;
long stepsLeft;

void setup() {
stepper.setSpeed(rpm);
startButton.begin();

tumblerStatus = stopped;
stepsLeft = 0;
}

void loop()
{
oled.firstPage();

if (tumblerStatus == stopped) {
do {
drawStartPage();
} while (oled.nextPage());
}

if (startButton.released() || (tumblerStatus == started && stepsLeft > 0)) {
if (tumblerStatus == stopped) {
stepsLeft = getTotalSteps();
}

if (stepsLeft > 0 && tumblerStatus == started) {
// just move a quarter to not block listening for button presses
int stepDistance = steps / 4;
stepper.step(stepDistance);
stepsLeft = stepsLeft - stepDistance;
}

tumblerStatus = started;
}

// Stop if start button is pressed again
if (startButton.released() && tumblerStatus == started) {
stop();
}
}

void stop() {
stepsLeft = 0;
tumblerStatus = stopped;
}

// Convert to total steps for the hours set
unsigned long getTotalSteps() {
unsigned long potValue = getHoursToRun();
unsigned long stepsToRun = potValue * 60 * steps * rpm;

return stepsToRun;
}

long getHoursToRun() {
unsigned long potValue = analogRead(potPin);
unsigned long value = map(potValue, 0, 1023, 1, 24);

return value;
}

void drawStartPage() {
oled.setFont(u8g_font_04b_03);
drawLine("Rock Tumbler", 8);
drawLine("v1.0", 16);

oled.setFont(u8g_font_helvB08);
drawLine("Run for", 28);

char time[5];
sprintf(time, "%dh", getHoursToRun());

oled.setFont(u8g_font_helvB12);
drawLine(time, 44);
}

void drawLine(char text[], int line) {
int x = (oled.getWidth() - oled.getStrWidth(text)) / 2;
oled.drawStr(x, line, text);
}
Hardware
I've put what I used in parenthesis
Arduino + wires (Arduino Uno rev. 3)
64x48 oled (OLED Shield for WeMos D1 mini)
Stepper Motor driver (Adafruit TB6612)
Perma-proto board (Adafruit Perma-Proto Half-sized, 82mm x 55mm)
Voltage regulator (Luxorparts, 4.5-28 V to 0.8-20 V. Based on MP1584)
Power Adapter (9V, 2A)
Button
Potentiometer
Power switch
8mm Threaded rods
8mm Nuts, lock nuts, lock washers
Bearings, 22mm x 7mm M8
O-rings for the wheels
Video
https://youtu.be/vNP2_rVvvXg

Tags