Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] strange problem with stepper motor?

Status
Not open for further replies.

hemnath

Advanced Member level 3
Joined
Jun 24, 2012
Messages
702
Helped
61
Reputation
120
Reaction score
57
Trophy points
1,308
Location
Chennai
Activity points
6,588
Im using pic 16F877A uC and crystal frequency is about 16Mhz. Compiler : CCS c compiler. I'm driving the stepper motor with mosfet.
Motor specs is about 1.8 deg. To find the 360 deg complete rotation, I have attached a needle and pointing as the starting point. Problem is that, when i program and power the stepper motor, stepper motor goes one step backward and starts rotating forward. Why is it happens? Because of that, 360 deg complete rotation is not achieved. It misses out some deg for one rotation. and, more degree misses out for many rotation. Couldn't find the solution.

connections:
uc pin C5 to stepper motor A
uc pin C3 to stepper motor A'
uc pin C4 to stepper motor B
uc pin C2 to stepper motor B'

I want the stepper motor to stop where it has been started(i.e, ending point to be same where it has been started)
HTML:
#include "16F877a.h"
#fuses HS						// High speed crystal
#use delay(clock=16000000)

#define RS PIN_B2
#define EN PIN_B0

void lcd_init();
void lcd_cmd(unsigned char);
void lcd_data(unsigned char);

unsigned int16 i;

void main()
{
output_low(PIN_B1);
lcd_init();
delay_ms(100);

for(i=1;i<=50;i++)
{
output_c(0b00100000);
delay_ms(100);
output_c(0b00010000);
delay_ms(100);
output_c(0b00001000);
delay_ms(100);
output_c(0b00000100);
delay_ms(100);
}
}

void lcd_init()
{
lcd_cmd(0x38);      // Configure the LCD in 8-bit mode, 2 line and 5x7 font
lcd_cmd(0x0c);      // display on and cursor off
lcd_cmd(0x01);      // clear display screen
lcd_cmd(0x06);      // increment cursor
lcd_cmd(0x80);      // set cursor to 1st line
}

void lcd_cmd(unsigned char c)
{
output_b(c);
output_low(RS);
output_high(EN);
delay_ms(15);
output_low(EN);
}

void lcd_data(unsigned char z)
{
output_b(z);
output_high(RS);
output_high(EN);
delay_ms(15);
output_low(EN);
}

Please help.
 

If you're not storing the current position of the stepper motor, then yes, after a reset, the first step may well be backwards. How does the motor know which
direction you wish to rotate? The obvious answer is, it doesn't. You signal that intent by powering the coils in a sequence that allows the rotor to move in a
particular direction. You can see this by examining how the stepper motor physically works (check wikipedia for example).
The first step signals no intent to anyone, including the motor; a single first step is not a sequence until another step arrives.
 

Hello hemnath,

There are different pulse schemes to run unipoar stepper motors:

1. Wave drive
2. Full step drive
3. Half stepping

Each method uses different set of table for driving stepper motor.

i would like to see your schematic before giving any further comment.

Regards
 

hi asimlink, I'm using 1.8 deg stepper motor.

Confused about this driving. Please help.

In wave driving, will the steps move 1.8 deg/step and 200 steps for one rotation.
In full step driving, will the steps move 1.8 deg/step and 45 deg out of phase?
In half step driving, Is the steps will move 0.7 deg/step?

This is what i have understood?
Is that right? Please help
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top