-
2 Attachment(s)
Quote:
Originally Posted by
scalerobotics
Hi Scalerobotics,
Thanks for the other couple of links, I`ll have a look.
One of the latest versions, but see the attachment one screen capture of BasicPro & one from Picaxe compiler and their respective messages.
Note, I don`t have any headers etc. just copy pasted the code as is, oh, and with different port#`s, which hasn`t made any difference to the error messages.
In any case, the 16F877 isn`t any good to me, my requirements/specs are for a 14 pin Pic.
I`d have to reconfigure the code to suit again, so there`s Picaxe14M/2, 16F684, 16C505, 16F505, 16F676,etc, or if I`m not fussy, I can get really universal and put one of those AVR chips in if they`re easier to configure, that way both camps can enjoy (a balance in the force, perhaps ha,ha).
Thanks again:)
-
1 Attachment(s)
Quote:
Originally Posted by
Acetronics
May I understand you use a dedicated driver circuit, Allegro 3967 i.e. ??? perhaps some existing satellite Module ???
Alain
Hello Alain,
Not quite sure of your response, so as I understand it, I`ll respond...
The Allegro won`t fit either,( but having a look at it, you`ve given me another idea, on which I must think on).
Just for the following unit I have constructed, 3 separate ICs, not "networked".
looking at a few alternatives.
Attachment 5087
Thank you
-
If you are not using Pic Basic Pro the examples from this forum will not work. Nor will they work for an AVR chip or picaxe.
-
Re: Motor Stepper Example
please help me..we have a project using stepper motor..we are making simple linear robot..when the circuit is on it will automatically open the gripper then after a seconds it will close the grip then after a seconds the slider stepper will turn forward then after a seconds again the gripper will open again then close and back to its original position..
please give me sample code or correct my code because when i tried it the gripper will only vibrate:
Code:
clear
ti var byte
c var byte
z var byte
ti=100
trisb=0
gripper open(cw the gripper stepper):
for z=1 to 2
portb=128
pause ti
portb=64
pause ti
portb=32
pause ti
portb=16
pause ti
next z
goto delay
gripper open1(cw the gripper stepper):
for z=1 to 2
portb=128
pause ti
portb=64
pause ti
portb=32
pause ti
portb=16
pause ti
next z
goto delay3
close(reverse gripper stepper):
for z=1 to 2
portb=16
pause ti
portb=32
pause ti
portb=64
pause ti
portb=128
pause ti
next z
goto delay1
close1(reverse gripper stepper):
for z=1 to 3
portb=16
pause ti
portb=32
pause ti
portb=64
pause ti
portb=128
pause ti
next z
goto delay4
delay:
portb=0
pause 2000
goto close
delay1:
portb=0
pause 2000
goto loop
delay2:
portb=0
pause 2000
goto open1
delay3:
portb=0
pause 2000
goto close1
delay4:
portb=0
pause 2000
goto loop1
delay5:
portb=0
pause 2000
goto open
loop(cw the slider):
for c=0 to 11
portb=8
pause ti
portb=4
pause ti
portb=2
pause ti
portb=1
pause ti
next c
pause 2000
goto delay2
loop1(ccw the slider):
for c=0 to 11
portb=1
pause ti
portb=2
pause ti
portb=4
pause ti
portb=8
pause ti
next c
goto delay5
end
-
Re: Motor Stepper Example
If a stepper motor vibrate this is happen because the power supply is too low or the rotation speed (given by the code) is too high.
-
Re: Motor Stepper Example
what is the correct speed or delay am i using in order to run it well?
it necessary to define the external oscillator in the program?like:
define osc 4
-
Re: Motor Stepper Example
We really need to know more about the hardware. Are you using a uni-polor or bi-polor motor? How are you driving the motor? direct from the PIC (REALLY small motor) or with some kind of amplifier/driver? I don't think you are pulsing too fast, if you have a 200 step motor, you are asking it to move at 5 RPM (i think,)
Can you make the motor move by replacing the pic with 4 switches? this will simulate the pic to test the hardware. Although this still will not tell you about current needs.
-
Re: Motor Stepper Example
i am using unipolar stepper motor...i connect the pic to uln2803...then connect to the stepper motor...
in your own experience..what time delay usually used in order the stepper to operate properly?
-
Re: Motor Stepper Example
delay time all depends on how fast you need it to move.
Please do some simple troubleshooting for us. Replace the motor with LED's. then you will be able to see if all 4 lines are stepping. Vibrating can also come from a missed step or 2. Also could you please apply 5V to the input of the ULN, 1 at a time and see if the motor moves?
This problem really needs to be isolated to hardware, software, or both. At first glance, it seems like your program should work. I don't know if you will get your desired function, but the motor should move.
-
Re: Motor Stepper Example
Check out all the labels in your code! You have names that you never call. Example:
goto close1 your goto will never goto label close1, since you have named it close1(reverse gripper stepper):.
Either move the : to the correct place and rem the rest of the label or place the correct name under the goto instruction.
Close1: ' (reverse gripper stepper)
GOTO Close1
or
close1(reverse gripper stepper):
GOTO close1(reverse gripper stepper)
Timing is not that critical. If too long your motor will run slowly if time delay is too short your motor will not run at all.
Cheers
Al.
-
Re: Motor Stepper Example
thank you for your help..i will try your suggestions...the label close1(reverse gripper stepper) , i only edit it before i post the program so that to clarify the operation of my project..actually is only close1:
-
Re: Motor Stepper Example
If it still does not work after you clean up your code. You may just have one of your coils reversed on your stepper motor. This will cause the motor hum and not rotate. A schematic of your project would help.
good luck
-
Re: Motor Stepper Example
what's wrong when i on my circuit..the led i used as indicator for the sequence will only standby on the first step..and when i touch the positive side of the supply it start to run..i construct my circuit in the breadboard as of now for trial...
-
Re: Motor Stepper Example
Quote:
..and when i touch the positive side of the supply it start to run
Did you pulled up with a 10K the MCLR (reset pin) of your microcontroller?
Why don't you post your circuit?
Al.
-
1 Attachment(s)
Re: Motor Stepper Example
i didnt use the MCLR in my mcu...
what is the right thing to do?
-
Re: Motor Stepper Example
You might be able to turn MCLR off but we do not know the chip you are using.
Post your configs, complete code, and schematic so the folks here will be able to help you.
-
Re: Motor Stepper Example
the schematic above is the one i used to...
i am using pic16f84 and uln2803...
here is the code:
define osc 4
ti var byte
c var byte
z var byte
ti=40
trisb=0
open:
for z=0 to 25
portb=128
pause ti
portb=64
pause ti
portb=32
pause ti
portb=16
pause ti
next z
goto delay
open1:
for z=0 to 25
portb=128
pause ti
portb=64
pause ti
portb=32
pause ti
portb=16
pause ti
next z
goto delay3
close:
for z=0 to 25
portb=16
pause ti
portb=32
pause ti
portb=64
pause ti
portb=128
pause ti
next z
goto delay1
close1:
for z=0 to 25
portb=16
pause ti
portb=32
pause ti
portb=64
pause ti
portb=128
pause ti
next z
goto delay4
delay:
portb=0
pause 2000
goto close
delay1:
portb=0
pause 2000
goto loop
delay2:
portb=0
pause 2000
goto open1
delay3:
portb=0
pause 2000
goto close1
delay4:
portb=0
pause 2000
goto loop1
delay5:
portb=0
pause 2000
goto open
loop:
for c=0 to 275
portb=12
pause ti
portb=6
pause ti
portb=3
pause ti
portb=9
pause ti
next c
pause 2000
goto delay2
loop1:
for c=0 to 275
portb=9
pause ti
portb=3
pause ti
portb=6
pause ti
portb=12
pause ti
next c
goto delay5
end
-
Re: Motor Stepper Example
From the schematic you have posted, you have left the MCLR pin floating, and this is the reason of the problem you reported. Connect the MCLR pin to Vdd (+5V) using a 10K resistor. If you need to reset your chip then short the MCLR pin momentarely to ground for a second and than remove the short.
Did you connect ULN2803 to ground ?
Al.
-
Re: Motor Stepper Example
yes i connect the uln2803 to ground...
should i put switch to MCLR? or just connect to 10K and +5v?
it is ok to connect the 4.7k resistor directly to the supply and MCLR without switch?
-
Re: Motor Stepper Example
Look at the example in the manual.
-
Re: Motor Stepper Example
my previous problem solved..:)
do you have an ides how to program using sensor as input? That when it is high something would activate then when it is low still activate.
-
Re: Motor Stepper Example
hey!!! im using a simple bipolar stepper motor with L297 and L298N and want a degree resolution of 1 degree, both in CCW and CW directions. but im clueless about the coding.
-
Re: Motor Stepper Example
The resolution depends on the motor and the type of stepping sequence you do.
Most step-motors from have 200 "natural" steps per revolution - or a step angle of 1.8° per step.
The L297 can do either full- or half-step depending on the state of pin 9. So if your motor has a step angle of 1.8° you get either that or 0.9°
If you need better than that you need to change the motor to one with a more steps/rev (motors with 400 steps/rev are available but not very common) or change the driver to one capable of microstepping.
The L297 is pretty easy to drive. You set the CW/CCW pin high or low depending on which direction you want the motor to move and then give it a pulse on CLOCK pin for each step. Want to move one rev, send a total of 400 pulses (if you're halfstepping with a 1.8°/step motor).
/Henrik.
-
Re: Motor Stepper Example
ok!!so the stepper i intend to use is
http://www.geeetech.com/wiki/index.p...rd_for_Arduino
so basically to get a resolution if 1 degree i need to use 0.9 is it? and half and full steps isnt an issue?
would you be able to provide me with the required coding? as im VERY new to C language as well!!!! and thanku soo much for ur reply :)
-
Re: Motor Stepper Example
Hi,
First off all, that motor is an unipolar motor with a single common connection for both windings, it can not be driven by a L298.
The documentation for that motor isn't really that great. It looks like there's a gearbox on the motor but I can't figure out if the stated step angle of 5.625° includes the gearbox, if there is one. If 5.625° includes the gearbox then you won't be able to get 1° resolution. Fullstep would give you 5.625°, halfstep 2.8125°.
Finally this is a forum for PBP, most of us don't do C so if you're looking for that you're in the wrong place basically.
-
Re: Motor Stepper Example
Hi all,
long time no see, because i'm o the business trip and really didnt have a time to meet you.
I have a question.
First of all i havent open a new thread because it is already one here.
Now let me explain you what i would like to do.
I have the following parts in my lab and would like to do some experiments. Simple not very difficult in the begining.
1) Big Easy Driver
2) Stepper Motor with Cable
Then to control the easy driver i have a pic16f88. I hope that is enough or do i need a bigger microcontroller with 4 different ports?
I understand that i need to connect from the controller to the Big Easy Driver 3 pins.
The GND, the STEP, and the DIR.
My question is: The step has to be a PWM signal? The direction pin is only high or low?
It is would be nice if anyone has a similar questions and will discuss several options.
i just want to give to the stepper motor a simple directions and basic step rotation....not microstep. I know that i can do with the Big easy driver, but i would like to start from the very basics.
thanks a lot for any help in advance.
regards,
-
Re: Motor Stepper Example
Hi astanapane, pic16f88 is more then you need to make your motor turn CW and CCW. Just connect two digital outputs plus the ground to your big easy driver and you are done. Have the pin connected to step toggling with a pause in between shorter is the delay faster the motor will run. Pull high direction pin when you want invert the rotation.
That is all.
Cheers
Al.
-
Re: Motor Stepper Example
Thanks a lot for the reply. i will give it a little bit more time for searching what i need To do.
Actually i would like to see how i can give a single Step at a time by using pwm.
Appreciate your time.
-
Re: Motor Stepper Example
Hi astanapane.
One pulse on STEP input moves motor one step only.
Ioannis
-
Re: Motor Stepper Example
Quote:
Originally Posted by
Ioannis
Hi astanapane.
One pulse on STEP input moves motor one step only.
Ioannis
Hi Ioanni
I will do some tests on the Code and once i have some Good news i will let you Know.
At the moment I'm on the 3d design of the model. Actually i design a Base for the stepper Motor.
May i ask you something that might sound stupid?
On the Motor i have it is recognised as a 1.8 degree angle.
They do say that is a 200 step per revolution.
If i turn the axis by hand i feel the steps but as i measured is not more that 50 steps.
Am i right or what i try to count doesnt have to do anything corresponding to its operation and the 200 steps.
-
Re: Motor Stepper Example
The actual steps have nothing to do with what your are feeling turning it by hand.
If you follow the step pulses then you will confirm the 1.8 degrees/step. With microstepping even less, but this is complicated for now.
Ioannis
-
Re: Motor Stepper Example
thanks for the clarification.
i will do my tests and will upload my code.
-
Re: Motor Stepper Example
The 50 detents you feel when rotating the shaft by hand comes from the 50 magnetic poles of a standard 1.8° 2-phase motor. Had it been a 0.9° 2-phase motor you would have felt 100 detents.
Moving the rotor between two "natural resting positions" (the detents) takes 4 electrical steps (the 90° phase shifted signal you use to drive the motor). 4*50=200 steps.
/Henrik.
-
Re: Motor Stepper Example
That is really interesting.
I learn from you guys everyday. Thanks a lot.
New i only need to understand how To give a step and a direction at the same time
-
Re: Motor Stepper Example
Basically you don't.
You set the direction signal high or low depending on the desired direction, then you start sending out the step-pulses. You want to make sure the direction signal is in its correct state before the step-pulse goes out. If it's not the motor might move a step in the wrong direction.
-
Re: Motor Stepper Example
This sounds much easier than i thought.
Thanks:-D
-
1 Attachment(s)
Re: Motor Stepper Example
This morning i dissasembled the stepper Motor.
I found out that There are 8 magnets with 6 teeth magnets each.
That in the middle you can find the axis shaft with a gear which the 50 teeth slighty touch the outer magnets teeth.
That is interesting.
-
Re: Motor Stepper Example
Hi,
Actually, the magnets are in the rotor. The 50 teeths on the "gear" are alternating N/S poles of the magnets.
The stator contains the windings which, together with the iron teeths forms elctromagnets. By running current thru the windings the magnetic field developed eitther retracts or repells the magnet in the rotor. By changning the direction of current flow thru the winding the polarity of the magnetic field changes, kind of draging and/or pushing the rotor in either direction.
When the motor runs there will be a rotating magnetic field in the stator and the rotor follows this field. When the torque reaches a point where the rotor "lags" the rotating magnetic field too much it will "desynchronize", if the speed is high it will just plain stall. The good thing is that you can never destroy a step-motor by simply overloading it.
The rotor does not touch the stator at all, there's a VERY fins airgap between them. You should never open a step-motor in a dirty environment since, the magnets in the rotor are very strong and will "suck in" small metallic chips from your workbench which will end up in the fine airgap and either lock the motor up completely or make run "strange".
Depending on the type of magnetic material in the rotor it's also advised against removing the rotor from the stator as it can then loose some of its magnetism. Same reason why you have what's called a keeper-plate on "ordinary" magnets. With that said I've personally had several motors appart to drill holes thru the shaft and they have been working afterwards. I don't have anything to measure the actual torque but I couldn't "feel" any difference.
/Henrik.
-
1 Attachment(s)
Re: Motor Stepper Example
Henrik,
It is very kind of you for giving all these detailed info.
I completely understand now the principles of the stepper motor.
What i have done today is to design a Base as a jig and future, in order To Work easier.
My next design will be a circle with 200 pins that represents the steps. then from the motor's axis i will put a vertical pin that will follow the 200 pins on the outer circle.
At the moment the following Mode is completed.
-
1 Attachment(s)
Re: Motor Stepper Example
sorry for uploading pictures of the design, but would like before starting with the simple code, to give you a feeling of the jig and fixture model.
So what you see is a model that has 200 steps inside the circle, and 16 points outside (8 sharp and 8 with a hole)
Those can represent basic angles on a 360.
When i have them ready then i can start to right one or two lines of program to play with.
After that i will improve the code with your help :)
thanks a lot.