mzdo
May 24, 2021, 7:37pm
1
i have leadshine stepper motor driver dm542e "2-phase stepper motor drive to control stepper motor . but i have problem in Dip selection switch. choosing different compination of the Dip leads to hot motor and noise with difficult motion. so i think there is a special configuration. i use power supply 10 A
my stepper motor specs is mentioned in the first post , its model
Stepper Motor (NEMA 23) 57HZ54-09 8 wires
i tried the series and parallel connections. it is connected parallel now
the motor make a sound tic tic and the shaft doesn't move , sometimes it moves and sometimes tic tic. i want to know how to choose the Dip switch
I use the same set up.
Try these positions. Switch 4 is half current or full current, I suspect this is one to check.
ON: 1 2 5 8
OFF: 3 4 6 7
Additionally, please post your code
mzdo
May 24, 2021, 10:20pm
3
this configuration doesn't work with me.
I wonder why does the motor get hot although it is not rotating? and i feel that something is moving inside the motor
ALL stepper motors get hot when they are holding position. Too hot to hold your hand on it is the only time it is TOO hot.
Paul
Did you Ohm out the coils to make sure that you know how to wire to the driver?
Post a photo of our wiring. please.
mzdo
May 25, 2021, 7:05am
7
it's hot i can't hold my hand more than 5 seconds. i measured coils ohm it is 2 ohms connected in series
Have a look into your motor data:
Temperature rise: 80°C, rated current, 2 phase on
With an ambient temperature of 20°C you will get 100°C motor temperature. How long will your fingers withstand that? The motor can withstand much higher temperatures than your fingers.
If you don't need the full torque of the motor, it's a good idea to set a smaller motor current to achieve a lower temperature rise.
mzdo
May 25, 2021, 8:36am
9
when i set lower current it makes tic tic without spining, the motor temperature is around 50C
Hi,
Can you please post a pen(cil) and paper circuit diagram showing your stepper connections (wire colours please) and power supply.
Can you post a link to data/specs of your stepper please?
Thanks.. Tom...
mzdo
May 25, 2021, 9:04am
11
at stationary position i put my and on the motor i feel tight motion of gears but the shaft is stopped
motor specs
Stepper Motor (NEMA 23) 57HZ54-09
– Step Angle: 1.8°
– Current /phase: 3 A
– Resistance /phase: 0.8Ω
– Inductance /phase: 1.2 mH
– Holding Torque: 9 Kg.cm
– leads: 8 wires
– Motor Wight: 0.70 Kg
– Length: 54 mm
mzdo
May 25, 2021, 9:07am
13
yes i connected it series ,but the colors are different in my case
mzdo
May 25, 2021, 9:35am
15
and this is my code which is not arduino compiler
/*******************************************************
This program was created by the
CodeWizardAVR V3.12 Advanced
Automatic Program Generator
© Copyright 1998-2014 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com
Project :
Version :
Date : 22/05/2021
Author :
Company :
Comments:
Chip type : ATmega328P
Program type : Application
AVR Core Clock frequency: 16.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 512
*******************************************************/
#include <mega328p.h>
#include <stdio.h>
#include <stdbool.h>
#include <stddef.h>
#include <delay.h>
// Declare your global variables here
// Voltage Reference: AREF pin
#define ADC_VREF_TYPE ((0<<REFS1) | (0<<REFS0) | (0<<ADLAR))
//////////////////////////////////////
//int reverseSwitch = 2;// Push button for reverse
//int driverPUL = 7; // PUL- pin
//int driverDIR = 6; // DIR- pin
#define reverseSwitch PIND.2
#define driverPUL PORTD.7
#define driverDIR PORTD.6
#define Enable PORTD.5
float adc=0;
int currentValue ;
int stepPos;
int newPos;
int potPosition();
void stepperInc(bool dir);
// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | ADC_VREF_TYPE;
// Delay needed for the stabilization of the ADC input voltage
delay_us(10);
// Start the AD conversion
ADCSRA|=(1<<ADSC);
// Wait for the AD conversion to complete
while ((ADCSRA & (1<<ADIF))==0);
ADCSRA|=(1<<ADIF);
return ADCW;
}
void main(void)
{
// Declare your local variables here
// Crystal Oscillator division factor: 1
#pragma optsize-
CLKPR=(1<<CLKPCE);
CLKPR=(0<<CLKPCE) | (0<<CLKPS3) | (0<<CLKPS2) | (0<<CLKPS1) | (0<<CLKPS0);
#ifdef _OPTIMIZE_SIZE_
#pragma optsize+
#endif
// Input/Output Ports initialization
// Port B initialization
// Function: Bit7=In Bit6=In Bit5=out Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
DDRB=(0<<DDB7) | (0<<DDB6) | (1<<DDB5) | (0<<DDB4) | (0<<DDB3) | (0<<DDB2) | (0<<DDB1) | (0<<DDB0);
// State: Bit7=T Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
PORTB=(0<<PORTB7) | (0<<PORTB6) | (0<<PORTB5) | (0<<PORTB4) | (0<<PORTB3) | (0<<PORTB2) | (0<<PORTB1) | (0<<PORTB0);
// Port C initialization
// Function: Bit6=In Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
DDRC=(0<<DDC6) | (0<<DDC5) | (0<<DDC4) | (0<<DDC3) | (0<<DDC2) | (0<<DDC1) | (0<<DDC0);
// State: Bit6=T Bit5=T Bit4=T Bit3=T Bit2=T Bit1=T Bit0=T
PORTC=(0<<PORTC6) | (0<<PORTC5) | (0<<PORTC4) | (0<<PORTC3) | (0<<PORTC2) | (0<<PORTC1) | (0<<PORTC0);
// Port D initialization
// Function: Bit7=Out Bit6=Out Bit5=In Bit4=In Bit3=In Bit2=In Bit1=In Bit0=In
DDRD=(1<<DDD7) | (1<<DDD6) | (1<<DDD5) | (0<<DDD4) | (0<<DDD3) | (0<<DDD2) | (0<<DDD1) | (0<<DDD0);
// State: Bit7=0 Bit6=0 Bit5=T Bit4=T Bit3=T Bit2=P Bit1=T Bit0=T
PORTD=(0<<PORTD7) | (0<<PORTD6) | (0<<PORTD5) | (0<<PORTD4) | (0<<PORTD3) | (1<<PORTD2) | (0<<PORTD1) | (0<<PORTD0);
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=0xFF
// OC0A output: Disconnected
// OC0B output: Disconnected
TCCR0A=(0<<COM0A1) | (0<<COM0A0) | (0<<COM0B1) | (0<<COM0B0) | (0<<WGM01) | (0<<WGM00);
TCCR0B=(0<<WGM02) | (0<<CS02) | (0<<CS01) | (0<<CS00);
TCNT0=0x00;
OCR0A=0x00;
OCR0B=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer1 Stopped
// Mode: Normal top=0xFFFF
// OC1A output: Disconnected
// OC1B output: Disconnected
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=(0<<COM1A1) | (0<<COM1A0) | (0<<COM1B1) | (0<<COM1B0) | (0<<WGM11) | (0<<WGM10);
TCCR1B=(0<<ICNC1) | (0<<ICES1) | (0<<WGM13) | (0<<WGM12) | (0<<CS12) | (0<<CS11) | (0<<CS10);
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer2 Stopped
// Mode: Normal top=0xFF
// OC2A output: Disconnected
// OC2B output: Disconnected
ASSR=(0<<EXCLK) | (0<<AS2);
TCCR2A=(0<<COM2A1) | (0<<COM2A0) | (0<<COM2B1) | (0<<COM2B0) | (0<<WGM21) | (0<<WGM20);
TCCR2B=(0<<WGM22) | (0<<CS22) | (0<<CS21) | (0<<CS20);
TCNT2=0x00;
OCR2A=0x00;
OCR2B=0x00;
// Timer/Counter 0 Interrupt(s) initialization
TIMSK0=(0<<OCIE0B) | (0<<OCIE0A) | (0<<TOIE0);
// Timer/Counter 1 Interrupt(s) initialization
TIMSK1=(0<<ICIE1) | (0<<OCIE1B) | (0<<OCIE1A) | (0<<TOIE1);
// Timer/Counter 2 Interrupt(s) initialization
TIMSK2=(0<<OCIE2B) | (0<<OCIE2A) | (0<<TOIE2);
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// Interrupt on any change on pins PCINT0-7: Off
// Interrupt on any change on pins PCINT8-14: Off
// Interrupt on any change on pins PCINT16-23: Off
EICRA=(0<<ISC11) | (0<<ISC10) | (0<<ISC01) | (0<<ISC00);
EIMSK=(0<<INT1) | (0<<INT0);
PCICR=(0<<PCIE2) | (0<<PCIE1) | (0<<PCIE0);
// USART initialization
// USART disabled
UCSR0B=(0<<RXCIE0) | (0<<TXCIE0) | (0<<UDRIE0) | (0<<RXEN0) | (0<<TXEN0) | (0<<UCSZ02) | (0<<RXB80) | (0<<TXB80);
// Analog Comparator initialization
// Analog Comparator: Off
// The Analog Comparator's positive input is
// connected to the AIN0 pin
// The Analog Comparator's negative input is
// connected to the AIN1 pin
ACSR=(1<<ACD) | (0<<ACBG) | (0<<ACO) | (0<<ACI) | (0<<ACIE) | (0<<ACIC) | (0<<ACIS1) | (0<<ACIS0);
// Digital input buffer on AIN0: On
// Digital input buffer on AIN1: On
DIDR1=(0<<AIN0D) | (0<<AIN1D);
// ADC initialization
// ADC Clock frequency: 1000.000 kHz
// ADC Voltage Reference: AREF pin
// ADC Auto Trigger Source: ADC Stopped
// Digital input buffers on ADC0: On, ADC1: On, ADC2: On, ADC3: On
// ADC4: On, ADC5: On
DIDR0=(0<<ADC5D) | (0<<ADC4D) | (0<<ADC3D) | (0<<ADC2D) | (0<<ADC1D) | (0<<ADC0D);
ADMUX=ADC_VREF_TYPE;
ADCSRA=(1<<ADEN) | (0<<ADSC) | (0<<ADATE) | (0<<ADIF) | (0<<ADIE) | (1<<ADPS2) | (0<<ADPS1) | (0<<ADPS0);
ADCSRB=(0<<ADTS2) | (0<<ADTS1) | (0<<ADTS0);
//first set current stepper position to match potentiometer
//(although stepper position is unknown)
stepPos = potPosition();
while (1)
{
newPos = potPosition();
if( newPos == stepPos ) //continue; //same, nothing to do
{
driverPUL = 0;
}
else if( newPos > stepPos ){
stepperInc( 1 );
stepPos++;
} else {
stepperInc( 0 );
stepPos--;
}
}
}
int potPosition()
{
currentValue = read_adc(0);
if (adc>2)
{
PORTB.5=1;
}
else
{
PORTB.5=0;
}
return adc=currentValue*300L/1023; //currentvalue*5/1023
}
void stepperInc(bool dir){ //could also add speed argument to fill in ms delay value
driverDIR = dir; //change if stepper direction does not match pot- !dir
driverPUL = 1;
delay_us(1000);
driverPUL = 0;
delay_us(1000);
}
mzdo
May 25, 2021, 9:41am
17
yes the help of someone,why asking?
mzdo
May 25, 2021, 9:45am
19
this is a basic code,and the motor working according to this code but with heating problem and tic tic
Hi,
Does it compile?
It doesn't for me and is not in the standard Arduino IDE C++ format.
There is no void loop() or void setup().
Can you please tell us your electronics, programming, arduino, hardware experience?
Thanks.. Tom...