This is an old revision of the document!


Schrittmotor

Schrittmotoren werden entweder unipolar und bipolar angesteuert. Der bipolare Motor besitzt zwei Spulen, und da jede Spule nun mal zwei Enden hat, also 4 Anschlüsse. Der unipolare Motor ist ebenfalls so aufgebaut, jedoch wird hier noch jede Spule in der Mitte durch eine Anschlussleitung angezapft. Schrittmotoren verfügen über keine integrierte Elektronik, weshalb sämtliche Kommutierungen extern erfolgen. Die geläufigste Art der Kommutation ist der Open-Loop-Betrieb: Die Spulen werden nach einem festen Muster aktiviert, geben aber kein Feedback. Im Falle eines zu hohen Drehmomentes können Schritte verloren gehen, was zu Ungenauigkeiten in der Positionierung führt. Unipolare Schrittmotoren können als bipolare Motoren eingesetzt werden, aber nicht anders herum.

Elektrische Verbindungen

Tabelle: Schrittmotor-Wicklungen (windings)

Pin Unipolar winding UP PORT Bipolar winding BP PORT
1 a 1a PB0
2 b 2a PB1
3 1a PE0/PE4 1b PB2
4 2a PE1/PE5 2b PB3
5 1b PE2/PE6
6 2b PE3/PE7
  1. Versichere dich, dass der Strom ausgeschaltet ist
  2. Verbinde das Actuator-Board und das Main-Board mit einem 26-pin Kabel.
  3. Connect the stepper to the actuator board, as shown in Figure. Note: The unipolar motor cable must be properly connected (wires a and b, according to figure 1, connects to pin 1 and 2 on connector UNI1 or UNI2).
  4. Connect the JTAG converter with the ATmega128 main board and the PC.
  5. Finally, connect the power to the main and actuator boards.

Test programs

Bipolar.hex (moves 100 steps one direction and 100 stepes opposite direction in endless loop)

Example code

/*-------------------------------------------------------------
Title:		Bipolar stepper motor with Actuator Board
Date:		080328
Ver.:		1.1
Compiler:	AVR-GCC
Target:		ATmega128
Hardware:	Main board, Actuator board, bipolar stepper
Author: 	Maido Hiiemaa / Raivo Sell 2008
 
Notes:	Optimization -02
Description: Drives stepper in both directions by 100 steps
---------------------------------------------------------------*/
#define STEPDELAY (50) // one step delay
#include <avr/io.h>
#include <util/delay.h>
 
//global variables to store commutation patterns
static unsigned char bipolar_pattern;
 
//Function prototypes
void bipolar_clockwise(int number_of_steps);
void bipolar_counter_clockwise(int number_of_steps);
 
///////////////// Functions //////////////////////////////////
void bipolar_clockwise(int number_of_steps){
	int i;
	for (i=0; i<number_of_steps; i++){ //repeat for each step
	bipolar_pattern = bipolar_pattern << 1;
	//shift pattern to the left
	if (bipolar_pattern>8){ bipolar_pattern=1; }
	// alter b'10000' to b'0001' if needed
		PORTB &= 0xF0; //zero last output (low bits)
		PORTB |= bipolar_pattern; //apply new pattern
	_delay_ms (STEPDELAY); //wait for the motor to complete the step
	}
	PORTB &= 0xF0; //turn off motor
}
 
void bipolar_counter_clockwise(int number_of_steps){
	int i;
	for (i=0; i<number_of_steps; i++){//repeat for each stepbipolar_pattern = bipolar_pattern >> 1;
	//shift pattern to the right
	bipolar_pattern = bipolar_pattern >> 1;
	if (bipolar_pattern==0) { bipolar_pattern=8; }
	//alter b'0000' to b'1000' if needed
		PORTB &= 0xF0; //clear low bits
		PORTB |= bipolar_pattern; //apply pattern to output
		_delay_ms (STEPDELAY); //wait for the motor to complete the step
	}
	PORTB &= 0xF0;//turn off motor
}
///////////////// Main function //////////////////////////////////
int main(void){
//output ports initialization
	DDRB=0xFF; //output port for bipolar stepper drive signals
	PORTB=0; //initial PORTB output
	bipolar_pattern=0x01; //initial pattern for bipolar stepper
 
	while(1){
		bipolar_clockwise(100);
		bipolar_counter_clockwise(100);
		}
}
de/examples/motors/stepper.1240411097.txt.gz · Last modified: 2020/07/20 09:00 (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0