Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Stepper motor

Status
Not open for further replies.

uaefame

New Member
This is my schematic that i am using to drive a bipolar stepper motor. The thing is i want to know what wrong with it?

Here is the connection:

Q1> Do i need to connect a 10k resistor between the 16F84a and sn754410 pins 2,7,9 and 15 or leave it as it is?

Q2> I am using same power source for Vcc1 and Vcc2 does it matter because the pic need 5V and the stepper need 5V same volt why get a new power source?

Q3> The motor behavior is strange going back and forth, its strange if you spot any mistake in the schematic let me know?

Thanks in advance
 
Try adding more DC filtering around VCC2.
 
What does that suppose to do dc filtering?

Do you mean i add capacitor or something?
 
Yeah, caps. I would add a 10uf cap right at the reg output. I would also put a .01 cap near the PIC power pin. And caps around the VCC1 and 2 pins. DC supply noise causes erratic behavior. It is just good practice to use good DC filtering.
 
Do you mean i connect between VCC2 and ground a capacitor of 10 or 0.01uF. Same goes to the VCC1 and ground another 0.01 or `10 uF.

Q1> Is this the proper way to connect them?

At the output of the voltage regulator and pic power supply there are alreay capacitor there.

I already did this but nothing work still same problem? Did i understand dc filtering wrong?

Thanks in advance
 
Last edited:
I just noticed something, why are you not connecting the enable pins. They should not be floating.
 
Yes, enable pins need to be tied to VCC1 via a 10k resistor.

You also don't seem to be implementing any current limiting - If you use a higher voltage than the motor's rated voltage (About 10x higher max !) and limit the current to the rated current for the motor you will get much more torque.

The only reason my stepper motors oscillate around the same point are because I've reached the torque limit. Remember that as speed goes up, torque goes down for a stepper motor.

You might also want to think about adding some protection diodes to the outputs, depending on the size of your motor. (The driver already has some.)
 
Last edited:
Here is my additions to the previous circuit after taking into consideration yngdrw and mikebits suggestions. Still the motor osicilates in the same place. The only thing i didn't add until now is diodes as mentioined yngdrw and in sn754410 there are internal diodes but adding more diodes will not hurt for the time being i will stick without diode.

Here is my

Sorry for my poor knowledge in electrical but with ur helps, I can one day help as may as i can maybe to you guys as well because i have strong (solid) knowlege in other fields.

Any suggestion is welcomed and will be looked into it.

Thanks in advance
 
Last edited:
You only need one resisotr for the enable pins. Tie both enable pins together then use a single 10k resistor to VCC1.

Double check that the motor coils are connected as you expect them to be.

Post the code that you're using on your PIC, maybe that is wrong ?

Do you have any load on the motor ?
 
Perhaps your stepper needs more current than your regulator can supply. Have you measured your supply voltages? Maybe as a test, you can run VCC2 from seperate supply.
 
Thanks yngndrw,

1) I removed the extra resistor 10K and i connected it as you told me here

2)The motor coil is fine i double check it again and again

3)The codes are here
Code:
LIST	P=PIC16F84A
	#INCLUDE "P16F84A.INC"
	__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
	errorlevel -302

	cblock	0x0c
	d1,d2,d3
	endc

	org	0
init
	banksel	TRISA		;bank 1
	clrf	TRISA
	clrf	TRISB
	banksel	PORTB		;bank 0
	clrf	PORTB
main	movlw	b'00000001'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00000100'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00000010'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00001000'
	movwf	PORTB
	goto	main

Delay8ofsec
			;124993 cycles
	movlw	0xA6
	movwf	d1
	movlw	0x62
	movwf	d2
Delay8ofsec_0
	decfsz	d1, f
	goto	$+2
	decfsz	d2, f
	goto	Delay8ofsec_0

			;3 cycles
	goto	$+1
	nop

			;4 cycles (including call)
	return



	end

4) Nothing is connected to the stepper motor in term of loads

I wish these information can help you figure what wrong

Thanks in advance
 
Ah, you only have one coil energised at a time. Because of the driver IC and that fact that the enable pins are not used, this means that the second coil acts as a break.

Try:
00000101
00000110
00001010
00001001

I think that's the reason anyway.
 
Last edited:
Hello yngndrw,

I did as you said but the problem still the same moving back and forth

Here are the updated codes
Code:
LIST	P=PIC16F84A
	#INCLUDE "P16F84A.INC"
	__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
	errorlevel -302

	cblock	0x0c
	d1,d2,d3
	endc

	org	0
init
	banksel	TRISA		;bank 1
	clrf	TRISA
	clrf	TRISB
	banksel	PORTB		;bank 0
	clrf	PORTB
main	movlw	b'00000101'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00000110'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00001010'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00001001'
	movwf	PORTB
	goto	main

Delay8ofsec
			;124993 cycles
	movlw	0xA6
	movwf	d1
	movlw	0x62
	movwf	d2
Delay8ofsec_0
	decfsz	d1, f
	goto	$+2
	decfsz	d2, f
	goto	Delay8ofsec_0

			;3 cycles
	goto	$+1
	nop

			;4 cycles (including call)
	return



	end

Thanks in advance for any suggestion
 
Maybe I got the order wrong, try:
00000101
00000110
00001001
00001010
(Swapped the last two lines.)

How long is the delay ? (I'm not an asm person...) Try using a very slow delay if you're using a fast one - It may be too fast. (0.5 seconds, etc.) You could also make it only step on when a button is pressed - Then you can check all of the outputs with a multimeter.
 
Last edited:
OMG it worked, I just add a call before it repeat it self here is the codes that works.
Code:
LIST	P=PIC16F84A
	#INCLUDE "P16F84A.INC"
	__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
	errorlevel -302

	cblock	0x0c
	d1,d2,d3
	endc

	org	0
init
	banksel	TRISA		;bank 1
	clrf	TRISA
	clrf	TRISB
	banksel	PORTB		;bank 0
	clrf	PORTB
main	movlw	b'00000101'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00000110'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00001010'
	movwf	PORTB
	call	Delay8ofsec
	movlw	b'00001001'
	movwf	PORTB
	call	Delay8ofsec
	goto	main

Delay8ofsec
			;124993 cycles
	movlw	0xA6
	movwf	d1
	movlw	0x62
	movwf	d2
Delay8ofsec_0
	decfsz	d1, f
	goto	$+2
	decfsz	d2, f
	goto	Delay8ofsec_0

			;3 cycles
	goto	$+1
	nop

			;4 cycles (including call)
	return



	end
I used this pattern the one u mentioned first
Try:
00000101
00000110
00001010
00001001

Ya it worked the problem was as you said it was looping to fast.

Not all of it but the last code when it was repeating there was no delay it was like this

0.125second/step
0.125second/step
0.125second/step
1cycle/step

I add the delay and now it behave 0.125second/step everytimes :) i can go faster but i will stay like this for a while :)

I am so happy thanks to yngndrw and mikebit for helping me out i couldn't do it without you guys :)
 
Hello eveyone,

My stepper motor is working fine the problem is the LM7805 is getting warm so fast only 12second and it is heating up.

My bipolar motor stat is this 5V, 800mA, 7.5degree/phase. The motor is still not warm but the LM7805 is, anyone suggest me a way to drive the stepper motor without getting the LM7805 warm.

I am scared that LM7805 will burn out? But the spec say it can handle up to 1A? How long can i run the bipolar stepper motor and PIC 16F84a togather using same LM7805.

My plan was to run it for 4.5hours i don't think the battery can hold that long but i will soon replace the battery with 9V adapter. Therefore, how long you think the LM7805 will last?

Thanks in advance
 
Last edited:
I'm glad it works. :)

I think the 800mA is per coil - You have two coils. However as you're running the motor using it's voltage rating, chances are it isn't using the full 800mA per coil.

It would be best if you could measure the current. (Measure after the regulator.)

If I remember correctly, the 7805 can only supply 1A if it is attached to a heatsink, are you using one ?

Can you measure the temperature of the 7805 ?
 
Nigel Goodwin, I am not sure what you mean.

The output of the voltage regulator is 5V and the input is 9V. Bad idea feeding it from the output which is 5V??

I am trying to find a voltage regulator that can handle 2A if anyone find something let me know
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top