thanks, Ive ordered an I2c 4x20, I just was sure about which pin numbers on the arduino to hook it up to
i used a Serial I2C 1602 16×2 Character LCD Module it sits on the back of the display. it frees up pins for the keypad.
[URL=".geeetech.com/wiki/index.php/Serial_I2C_1602_16×2_Character_LCD_Module" i went to a 4x20 display and a arduino nano for space.
thanks, Ive ordered an I2c 4x20, I just was sure about which pin numbers on the arduino to hook it up to
Hello Sloucks,
I finally managed to get the electronics into function after a lot of trial and errors in the sketch. Now I'am running into the following problems:
The stepperdriver chip (DRV 8825) becomes very hot in a short time even with the heatsink in place and I expected, when dividing a 360° circle into a number of divisions, that the stepper finishes at the same spot as where it started, but that is certainly not the case. I did the test with 2 different steppers: a 12 V 2,5 A - 1,8° / step and a 12 V 1,7 A - 0.9° / step. I altered the corresponding lines in the sketch accordingly of course. I also had to alter the stepdelay, otherwise there was no movement at all. No load was attached to the steppers.
I hope that someone can give me a hint where to find a solution to this problem.
Marquant.
You should be able to reduce the current by turning the pot on the driver. If they overheat they with go into thermal cutout and lose steps so f you fit the excessive current draw it may fix the your other problem.
Thanks,
I will give it a try. At the polulu site there is aninstruction on how to set the current on the driver.
I like the keypad integration in the OP's design. We built one a year or so ago using a cheap TB6560 driver and push buttons for input, based on a sketch found online somewhere (maybe on this board). It worked well and we discussed modifying the sketch to use a keypad, but I never got around to it. I think I'll try to incorporate the OP's sketch and maybe a different driver (Polulu or EasyDriver from Sparkfun).
Hi Slouks, Just want to ask about this part of the code
const int StepsPerRotation = 400; //Set Steps per rotation of stepper
const int TableRatio = 72; //ratio of rotary table
const int Multiplier = (StepsPerRotation * TableRatio)/360;
When i change the Table ratio to 140 (or any number above 90) the stepper barely moves.. I change it back to 70 or 80 and it works correctly. It has me a bit stumped it there any thing else i need to do to get a table ratio of 140? Also dropping or increasing the steps per rotation, does something similar. any ideas?
how many steps are need to turn you rotary table 399.9
<img src="https://ivxo1q-dm2305.files.1drv.com/y4mENMmTr_Cabc7pR0FUdB6gtbADq2JbuG4_rGy0eBQvLJx19pTi6TqMUIJN0xgOyDIc0gWoxYhS38HpbSTFGdfaK-o42IOU6jczrhDpfpCOTNGL1X6hvZCbgj0y35gqmq1YGTrWwShYGV-C7lXA2esy0Pi_WfnBSyroDLSGXwce4uSr1U7op7srdi78rispHCa_K4aFlTlJPVkkNWMfgh_Tg?width=60&height=60&cropmode=none" width="60" height="60" />
Being Disabled is OK CNC is For fuN
The table has a ratio of 140, and the steeper driver requires 400 steps per rotation so 56000 steps
what motor is it
<img src="https://ivxo1q-dm2305.files.1drv.com/y4mENMmTr_Cabc7pR0FUdB6gtbADq2JbuG4_rGy0eBQvLJx19pTi6TqMUIJN0xgOyDIc0gWoxYhS38HpbSTFGdfaK-o42IOU6jczrhDpfpCOTNGL1X6hvZCbgj0y35gqmq1YGTrWwShYGV-C7lXA2esy0Pi_WfnBSyroDLSGXwce4uSr1U7op7srdi78rispHCa_K4aFlTlJPVkkNWMfgh_Tg?width=60&height=60&cropmode=none" width="60" height="60" />
Being Disabled is OK CNC is For fuN
it a nema 17 200 steps per rotation.
GOOD EVENING.
CAN I USE ARDUINO UNO?
GRATEFUL
adruino int can only hold a number up to 32000
so 140 * 400 = 56000 // this will not work also when divided by 360 will yield a Floating point number
I haven't tested but you could try
Float Multiplier = Float(StepsPerRotation * TableRatio)/360
the result = 155.5555
so you could do ((14 * 40)/360) * 100 will get the same result without going over 32000
Last edited by squirrel_41; 03-26-2016 at 11:53 AM.
Arduino compiler can do long 32 bit integers.
https://www.arduino.cc/en/Reference/Long
True but now he should know why it's not working
Thank you I will give it a try
It will be useful a jog function in order to set a start position. Dividing head has a worm gear so it is difficult to set start position by hand.
Newbie to Arduino here.
How do you change speed ? ( change pulse rate without reprogramming )
If you can slow down the motor when jogging, that would allow reaching a home position much easier...assuming you can stop ?
In industrial machines, jogging stops when the button is released.
No offense guys, I realize this is not a commercially made controller and not all functions are available.
Rich
Hi all
I made my project with arduio motor shield R3 instead of pololu, but the stepper dont run...Any idea about sketch or libray..?
Tks
I corrected the above sketch to fix syntax issues with all the LCD Print Commands, that caused it to fail on Arduino 1.6.13. :
/*
A program for controlling a single stepper motor driving a rotary table.
Uses a 4x4 matrix keypad for entry of degrees and direction to move the table.
Serial I2C display, Pololu stepper driver.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>
const byte ROWS = 4;
const byte COLS = 4;
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'.','0','#','D'}
};
byte rowPINS[ROWS] = {11,10,9,8};
byte colPINS[COLS] = {7,6,5,4};
Keypad kpd = Keypad(makeKeymap(keys),rowPINS,colPINS, ROWS, COLS);
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x20 for a 16 chars and 2 line display
//setup vars
const int stp = 12; //connect pin 12 to step
const int dir = 13; // connect pin 13 to dir
const int StepsPerRotation = 400; //Set Steps per rotation of stepper
const int TableRatio = 72; //ratio of rotary table
const int Multiplier = (StepsPerRotation * TableRatio)/360;
const int stepdelay = 1;
float Degrees = 0; //Degrees from Serial input
float ToMove = 0; //Steps to move
int Direction;
int repeat = 0;
void setup()
{
lcd.init(); // initialize the lcd
pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
// Print welcome message to the LCD.
lcd.backlight();
lcd.print("Rotarye Control");
lcd.setCursor(0,2);
lcd.print(" CrankyTechGuy CNC");
lcd.setCursor(0,3);
lcd.print(" Copyright 2014");
delay(2000);
lcd.init();
}
void rotation(float tm, int d)
{
if(d == 0)
{
digitalWrite(dir, LOW);
}
else
{
digitalWrite(dir, HIGH);
}
for(int i = 0; i < tm; i++)
{
digitalWrite(stp, HIGH);
delay(stepdelay);
digitalWrite(stp, LOW);
delay(stepdelay);
}
}
float GetNumber()
{
float num = 0.00;
float decimal = 0.00;
float decnum = 0.00;
int counter = 0;
char key = kpd.getKey();
lcd.print("Rotarye Control");
lcd.setCursor(0,2);lcd.print("Enterees then");lcd.setCursor(0,3);lcd.print("press");
lcd.setCursor(8,1);
bool decOffset = false;
while(key != '#')
{
switch (key)
{
case NO_KEY:
break;
case '.':
if(!decOffset)
{
decOffset = true;
}
lcd.print(key);
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if(!decOffset)
{
num = num * 10 + (key - '0');
lcd.print(key);
}
else if((decOffset) && (counter <= 1))
{
num = num * 10 + (key - '0');
lcd.print(key);
counter++;
}
break;
}
decnum = num / pow(10, counter);
key = kpd.getKey();
}
return decnum;
}
int GetDirection()
{
int dir = 0;
lcd.setCursor(0,2);lcd.print(" ");
lcd.setCursor(0,3);
lcd.print(" FWD[A] REV[B]");
while(dir == 0)
{
char key = kpd.getKey();
if(key == 'A')
{
dir = 1;
}
else if(key == 'B')
{
dir = -1;
}
}
lcd.clear();
return dir;
}
void loop()
{
if(repeat == 0)
{
Degrees = GetNumber();
Direction = GetDirection();
}
Degrees = Degrees * Direction;
if(Degrees < 0)
{
ToMove = (Degrees*Multiplier)*-1;
lcd.setCursor(0,0);
lcd.print("REV lcd.print(abs(Degrees),2);lcd.print((char)223)");
lcd.setCursor(6,1);
lcd.print("Moving rotation(ToMove,0)");
lcd.setCursor(6,1);
lcd.print(" ");
}
else
{
ToMove = Degrees*Multiplier;
lcd.setCursor(0,0);
lcd.print("FWD lcd.print(Degrees,2);lcd.print((char)223)");
lcd.setCursor(6,1);
lcd.print("Moving rotation(ToMove,1)");
lcd.setCursor(6,1);
lcd.print(" ");
}
lcd.setCursor(0,2);
lcd.print("Repeatancel[B]");
char key = kpd.getKey();
while(key != 'B')
{
key = kpd.getKey();
if(key == 'A')
{
if(Degrees < 0)
{
ToMove = (Degrees*Multiplier)*-1;
lcd.setCursor(6,1);
lcd.print("Moving rotation(ToMove,0)");
lcd.setCursor(6,1);
lcd.print(" ");
}
else
{
ToMove = Degrees*Multiplier;
lcd.setCursor(6,1);
lcd.print("Moving rotation(ToMove,1)");
lcd.setCursor(6,1);
lcd.print(" ");
}
}
}
lcd.clear();
}