Arduino DIY electronic miter box? Stepper control with keypad and LCD – Tutorial

Let’s control the movement of a stepper motor by entering a value in millimeters using a keypad and display the position on a Nokia LCD.
Kinda like an Electronic miter box I guess… The schematic, parts used,, etc… will be available soon on our tutorial page at: https://brainy-bits.com/tutorials

Comments

Brainy-Bits says:

Sorry for the long video guys… Hard to keep these videos short sometimes… Thx!

Garth Howe says:

Another good and clear tutorial. I had to back up and let my brain process the “steps” math. Thanks!

Todd Graves says:

Another great video Ivan! I definitely enjoyed it.

Arvind Shenoy says:

Thanks for the video.Couldnyou please share the model number of the stepper motor driver please.I am trying to use a VNH2SP30 driver .will that work???

Vishal Chhabhaiya says:

can you please do the programing for me

Video 17 says:

cooooool!!
would be nice to have a option for the traveltime.
*go to positionXY in a durationYZ*

keep up the good work!!
subed, liked, commented 🙂

Aleksander Schulz says:

Thanks, great tutorial,
This is what I need, for my bandsaw up/down settings,but with DC motor and optical encoder.
I can’t wait to see tutorial page.

Vishal Chhabhaiya says:

instead of LCD can we use oled

Wide Vision Metal Fab says:

Nice! I’ve been thinking about how to make a “stock pusher” for my bandsaw that would allow me to enter a number, then the stock would move into the saw that far, and then I could make a cut. This is basically what I need! (And the video didn’t seem to be any longer than needed.)

Nathan Davey says:

awesome shirt

90FF1 says:

Sir,
Thank you very much for your informational and well presented tutorials.  I used your code from this tutorial with a few
modifications. I deleted the LCD display lines and use Serial Monitor to display pressed key numbers and current position and added a fourth number. I also modified the calculation for inches and 10ths.  Pressing 100 on the keypad advances the pointer 0.10 inch from zero. Pressing 150 moves to 0.150 inch. (Within a margin of acceptable error)  
Entering 1000 advances the pointer 1.0 inch from zero. All works well except for a couple bugs.  When I input 1000 for a 1 inch move, the motor moves forward a bit, slows to near zero RPM for a moment, then accelerates smoothly stopping at the 1 inch point. Should I want to advance another inch, I key in 2000.  The motor first reverses moving the pointer back to near zero, pauses then advances to the 2 inch position. The slowing down only happens with four digit inputs.  The return to zero from any position is smooth without pause.
Any clues? Anyone?
Thank you

Carola Heins says:

G’day Ivan
I have a model railway where trains are stored on a five track traverser. Is it possible to program the stepper to move between five (5) pre-determined positions by using five (5)normally off press button switches (without having to “nest” some of the commands?
Thank you,

Tom Clune

321 AUDIO says:

nice

Matt D'Rat says:

Excellent tutorial, thanks!Matthew

Vishal Chhabhaiya says:

what about home position like in cnc’s? is it possible?

Lộc Sakhabeco says:

very nice, thank so much!

Brainy-Bits says:

The Tutorial page for this tutorial is now available on our website here: https://brainy-bits.com/tutorials/diy-stepper-miter-box/
Check it out to get the Schematic, code, parts used etc…

Vishal Chhabhaiya says:

I wanted to build the same

Bruno Augusto Guimaraes Felix says:

I really liked your project, I’m doing a similar project in college, you could send me the code would help me a lot.

my email is brunoagfelix@gmail.com

Thank you 🙂

Ethan Pepper says:

Going to do this, great !!!

robertlynnkim1 says:

Great video! I have been wanting to build an HO turntable and this is getting close to what I’ve been looking for. Is it possible to do this same thing with a push button or a series of buttons to control the angles on the stepper motor? It would align the center track with the outer tracks around the turntable.
Thanks,
Robert

Odair says:

Very nice!
What’s the max distance we can enter on the keypad ? Would be possible to enter larger numbers like 5 meters ?

David Flores says:

Hi friend, your project is very good, I am learning to program but I am doing a project if you give me help, it is similar to your video but with 2 motors and you program a measurement for each one and a sensor to start the programmed repetitive motion lcd 2×16

Akrout Osama says:

Hi Ivan , i hope you doing well
so what’s on the menu for the next Tuto ?
hope it will not took you so long (y)

Mattley says:

Very cool!

KOSTAS LIANOS says:

Hi.
At first i want to tell you congratulations for your excellent work and thanks to share it with all of us.
I am new in arduino and i need your help on your project Arduino Control Stepper with Keypad and LCD.
I need to set a max length of four or five numbers to enter distance more than 999 cm but i don’t know how to modify your code.
i try to set four numbers but i take bugs.
I hope that you can help
Thanks in advance for your assistance and I hope to have your reply

Best Regards
kostas

David Flores says:

//my code://

#include #include
#include

LiquidCrystal lcd(0, 1, 6, 3, 4, 5); // pines de arduino al lcd

char KEYS[] = {
‘1’,’2′,’3′,’a’,
‘4’,’5′,’6′,’b’,
‘7’,’8′,’9′,’c’,
‘*’,’0′,’#’,’d’,
};

// da de alta el objeto teclado y asigna los valores del pin analogico y las resistencias
// para mas informacion lee la libreria

OnewireKeypad KP(lcd, KEYS, 4, 4, A0,4700,1000);

// declaracion de variables

int x = 0;
int z = 0;
int i = 9;
int j = 0;
int k = 9;
int n = 0;
int a = 0;
int b = 0;
int paso = 100;
char tecla[10]=” “;
int Distancia1 = 0;
int Distancia2 = 0;
int retraso_teclado = 20;

void setup(){

pinMode (2,INPUT);
pinMode (8,OUTPUT);
pinMode (9,OUTPUT);
//attachInterrupt (0,SENSOR,RISING);

lcd.begin(16,2);
lcd.setCursor(0,0);

lcd.print(” “);
lcd.setCursor(0,1);
lcd.print(” “);

lcd.setCursor(0, 0);
lcd.print(“MOTOR 1:”);

lcd.setCursor(15, 0);
lcd.print(“mm”);

lcd.setCursor(0, 1);
lcd.print(“MOTOR 2:”);

lcd.setCursor(15, 1);
lcd.print(“mm”);

}

//void SENSOR()
//{
//digitalWrite(8,HIGH);
// lcd.setCursor(10, 3);
//lcd.print(“david”);
//delay(1000);
//if((x+z)>0){

//digitalWrite(8,HIGH);
//digitalWrite(9,HIGH);
//delay(5000);
//x–;
//z–;
//}

//digitalWrite(8,LOW);
//digitalWrite(9,LOW);
//delay(1000);
//}

void loop()
{ //attachInterrupt (0,SENSOR,RISING);

if (KP.Getkey()) // SI SE PULSA UNA TECLA
{

//*****************************************************/
tecla[n] = KP.Getkey();
//*****************************************************

if((tecla[n] == ‘a’)){ //habilita el teclado para introducir la distancia para el primer motor
a=1;
delay(100);
}
//*************************************************************
if(a==1){

if ((tecla[n] != ‘a’) && (tecla[n] != ‘b’)){
lcd.setCursor(i, 0); // va posicionando en el lcd para escribir en su sitio correspondiente el proximo caracter
lcd.print(tecla[n]);// lo escribe en la lcd
Distancia1 = atoi(tecla); // convierte en un entero la cadena de caracteres tecla[]

if(Distancia1 >0){
if (tecla[n] == ‘*’){
lcd.setCursor(i, 0); // va posicionando en el lcd para escribir en su sitio correspondiente el proximo caracter
lcd.print(” “);
lcd.setCursor(18, 0); // va posicionando en el lcd para escribir en su sitio correspondiente el proximo caracter
lcd.print(“ok”); // escribe en la lcd
a=0;
b=0;
n=0;
i=8;
}
}
delay(250);
i++;
n++;
}

}

//********************************************************************************************/
if((tecla[n] == ‘b’)){
b=1;
delay(100);
}
//***********************************************************************************************************************
if(b==1){

if ((tecla[n] != ‘a’) && (tecla[n] != ‘b’)) // si es un numero
{
lcd.setCursor(k, 1); // va posicionando en el lcd para escribir en su sitio correspondiente el proximo caracter
lcd.print(tecla[n]); // lo escribe en la lcd
Distancia2 = atoi(tecla); // convierte en un entero la cadena de caracteres tecla

if(Distancia2 >0){
if (tecla[n] == ‘*’){
lcd.setCursor(k, 1); // va posicionando en el lcd para escribir en su sitio correspondiente el proximo caracter
lcd.print(” “);
lcd.setCursor(18, 1); // va posicionando en el lcd para escribir en su sitio correspondiente el proximo caracter
lcd.print(“ok”); // lo escribe en la lcd
a=0;
b=0;
n=0;
lcd.setCursor(15, 1);
lcd.print(“mm”);
k=8;
}
}
delay(250); // espera para que no rebote el teclado y marque dos digitos iguales seguidos
k++; // para escribir en la siguiente posicion en el lcd
n++; // aumenta el indice en el array tecla para situar en la cadena de caracteres el proximo digito
}
}

}

}

Ronald Rocheleau says:

Another great video

Odair says:

Hi.
Could you please make a tutorial of an upgraded version of this project ? I’d like to see added to it some of the functions featured on your tutorial – https://youtu.be/dQuTgngoFPQ . Manual control, limit switches and an additional limit switch next to the start limit that will force the speed to slow down, so it reaches smoothly to the home position.
Thanks.

 Write a comment

*

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!