Measurement of motors angle

Hello.

I am using a 4x3 keypad to send data to picaxe 28x2. Data are then sent to LCD module. These data contain an information about the angle of motor. (0-180 degree)
I haven't figured out what kind of motor i should use. Stepper or servo motor ?
After i write an info on keyboard, for ex. 128, that means the motor should move to position 128(degree).
Script for keyboard and lcd module is already done, but i don't know where to move on from here.

Any suggestions? Thank you.
 

rq3

Senior Member
Hello.

I am using a 4x3 keypad to send data to picaxe 28x2. Data are then sent to LCD module. These data contain an information about the angle of motor. (0-180 degree)
I haven't figured out what kind of motor i should use. Stepper or servo motor ?
After i write an info on keyboard, for ex. 128, that means the motor should move to position 128(degree).
Script for keyboard and lcd module is already done, but i don't know where to move on from here.

Any suggestions? Thank you.
I'm partial to steppers, and it would seem a stepper would be ideal for your application (as long as you don't let it slip).
Each pulse from the Picaxe to the stepper driver would give you one step, and the step size is strictly a function of the
stepper motor you use.
Of course, with a stepper, you'll have to keep track of where you are in relation to some arbitrary "zero point", which would
admittedly be easier with a servo.
The load you are driving and the speed of response may be the final determining factors that influence your decision.

Rip
 
I decided for stepper motor for some reasons.
Is there a way of how to measure actual angle ? E.g. last known position is 132 degree. I turn of the module. How will i identify the actual angle after turning it on? Or how do i know the angle if someone moves with it while the operating module is off ?
Should i always move it manually to 0 ? Well that would be impractical i think. Anyone dealt with this problem before?
 

Circuit

Senior Member
There are two ways to solve your problem with knowing the angle of the turn;

Firstly, you could record the present position (step numbers) in the eeprom memory of the PICAXE chip before you power down and then read this back when you power up again. This does require you to set the angle once and it does not allow for any failures of stepping that may occur to put the thing (you have not told us what the "thing" actually is...) out of synch.

The best way would be to fit an optical gate that is broken by a reference plate on the shaft of the stepper motor when the system starts up. Here are a couple of photographs of the arrangement on an actual stepper motor. These photos are are, I think, self-explanatory; but if you need further help just ask.
 

Attachments

AllyCat

Senior Member
Hi,

Or, you just drive the motor to an "endstop", either purely physical, or an electrical switch (if the motor has high torque) and then step backwards to the central location by counting pulses.

Cheers, Alan.
 

binary1248

Senior Member
You could use model servos since the servo drive output is already available on most PixAxe. Then the pulse width will define the angle, no need to have a calibration interrupter/flag.
They are available from a few bucks to hundreds of dollars (if you need a really fast one). I have used them with picaxe and it really is easy to position accurately with no starting reference.
Stepper motors are great but require considerable external hardware, where as a model servo requires no external hardware and will run off 5 volts.
Here is an example of using a servo to trip a camera shutter periodically based on the potetiometer position. More code than you need but you can pick out the servo commands.

Code:
;8/14/2011  
;   *************************
;   *Full travel servo test *
;   *************************
;Modified for up to 15 sec delay
;and longer servo stroke; REVERSED DRECTION.
;Do not exceed 25 (cw) and 200 (ccw) for this servo.
; other wise may hit internal servo limit.
;
;Servo pin is pin 8 on 18X
;Led is pin 13
; M<aximum time is 15 SEC
; Min time is 1 sec
;
;
#picaxe	18x
symbol led=7 ;pin 13 on chip

Start:
	Servo	2,100  ;preset servo
	
	
	for b1 =1 to 5 ;chance to give about 3 sec befo shutter start
	high led
	pause 100
	low led
	pause 100
	next b1
	
	
	;	Servo max 25 to 225
	;
		; 
	Main:
		high led
		servopos	2,190	;adjust up stroke, max 220
		readadc10	0,w1	;read pin 17 (chan 0) as 10 bit A/D.
		;
		;use value from a/d for delay
		w1=w1*15     ;pause up 15 sec (15000)
		;debug
		if w1 <1000 then
		   w1=1000  ;minimum delay
		endif
		
		pause w1    ;interval delay, one count = 1ms
		low led
		servopos	2,25   ;trip shutter, adj down stroke
		pause 1900
		
		goto main
Here is a link to some high torque (for models) servos. Lots of places to buy these other than Hobbyking.
http://hobbyking.com/hobbyking/store/__291__189__Servos_Parts-X_Large_Servo_50g_.html
 
Last edited:

erco

Senior Member
Lots of help here, but you haven't said (and no one has asked) what the motor is moving and how exact your position and readout need to be. Any more detail would be helpful and will help you sort it out.
 
Hello,
i did read all of your suggestions and i will try to read them again, understand and decide which one suits me best.

Lots of help here, but you haven't said (and no one has asked) what the motor is moving and how exact your position and readout need to be. Any more detail would be helpful and will help you sort it out.
Answer: I am building just a model. Motor wount be attached to nothing and it will just demonstrate that i am able to control the position. Later 28x2 module will be attached to amplifier and then to more powerfull motor which will be attached to antena.
If by "how exact your position need to be" you mean how precise does the movement need to be, then the answer is: step=1 degree.

Thank you all for help, i will try out some of your tips and i will post the final results afterwards.
 
Top