Stepper one slows down when i press a button when running Stepper two.SORTED Thanks to Benj.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

astro1234
Posts: 44
Joined: Mon Apr 10, 2017 12:53 pm
Has thanked: 38 times
Been thanked: 13 times
Contact:

Stepper one slows down when i press a button when running Stepper two.SORTED Thanks to Benj.

Postby astro1234 » Thu Jul 11, 2019 10:33 am

Hi.
I have simple sketch running two Steppers motors, Stepper one runs constant, using a forward/reverse button,
stepper two runs by pressing any one of two buttons for forward and reverse motion.
when any button on Stepper two is pressed, the first Stepper slows down, i need Stepper one running at a set speed which is one rev every 5mins and ten seconds, because this will be the driver for my telescope mount, which needs a constant speed for tracking,
what do i need to do to achieve this.?
i have built the circuit and observe the same problem, Stepper one slows down when pressing any Stepper two buttons.

My setup.
Steppers Nema23 77:1 gear reduction
Correction for supply 12v dc 2 amp plug in 240v.
flowcode v8 (latest)
win 10 pro (latest)
Enclosed is a simple sketch i am running.
PS.the delays in the sketch are for slowing down in flowcode so i can see what’s happening,
the delays in the final sketch are in micro seconds. I know that i could use two pic chips one for each Stepper, but would like to use the 18F26K22 chip because of space on my board.
Thanks Roy.
Attachments
18F26K22_TWO_STEPPERS.fcfx
(20.47 KiB) Downloaded 26 times
Last edited by astro1234 on Thu Jul 11, 2019 3:36 pm, edited 3 times in total.

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1104
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 453 times
Been thanked: 505 times
Contact:

Re: Stepper one slows down when i press a button when running Stepper two.

Postby Steve001 » Thu Jul 11, 2019 12:47 pm

is your power supply stable under load ? 45 volt 20 Amps is quite a lump

Steve
Success always occurs in private and failure in full view.

astro1234
Posts: 44
Joined: Mon Apr 10, 2017 12:53 pm
Has thanked: 38 times
Been thanked: 13 times
Contact:

Re: Stepper one slows down when i press a button when running Stepper two.

Postby astro1234 » Thu Jul 11, 2019 1:31 pm

Steve001 wrote:is your power supply stable under load ? 45 volt 20 Amps is quite a lump

Steve


Hi Steve.
I am using a Embedded Switch Mode Power Supply 48v 3.3amp, (put in the wrong one.)
Running 2 nema23 and one nema17 in my observatory using this power supply, but only one is on all the time,
the other two are on only for a number of seconds,then they are off.
At the moment have set up two small steppers on a breadboard,using the above sketch.
problem is stepper one slows down when using buttons on stepper two.
power is 12v 2amp plug in .
Regards Roy.

User avatar
Benj
Matrix Staff
Posts: 14566
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4595 times
Been thanked: 4239 times
Contact:

Re: Stepper one slows down when i press a button when running Stepper two.

Postby Benj » Thu Jul 11, 2019 2:30 pm

Hi Roy,

I've noticed a couple of things. Your input read is converting the whole of PortB into an input which may be causing temporary issues on your motor drivers. The value of delay in the loop is going to set the speed for both motors.

To solve the problem I used the switch components to allow me to read a single PortB pin rather than the entire port. Secondly I used a timer interrupt to move stepper 1 on a regular tick allowing your second motor to be controlled independently. The timer enable icon allows you to control the speed of the motor.

18F26K22_TWO_STEPPERS.fcfx
(22.14 KiB) Downloaded 42 times


Hope this helps.

As a final note, for the motor that is not moving a lot of the time, I've disabled the motor output when the motor is not moving. Just avoids burning the coils or the driver out.
These users thanked the author Benj for the post:
astro1234 (Thu Jul 11, 2019 3:05 pm)
Rating: 5.26%
 

astro1234
Posts: 44
Joined: Mon Apr 10, 2017 12:53 pm
Has thanked: 38 times
Been thanked: 13 times
Contact:

Re: Stepper one slows down when i press a button when running Stepper two.

Postby astro1234 » Thu Jul 11, 2019 3:18 pm

Benj wrote:Hi Roy,

I've noticed a couple of things. Your input read is converting the whole of PortB into an input which may be causing temporary issues on your motor drivers. The value of delay in the loop is going to set the speed for both motors.

To solve the problem I used the switch components to allow me to read a single PortB pin rather than the entire port. Secondly I used a timer interrupt to move stepper 1 on a regular tick allowing your second motor to be controlled independently. The timer enable icon allows you to control the speed of the motor.

18F26K22_TWO_STEPPERS.fcfx

Hope this helps.

As a final note, for the motor that is not moving a lot of the time, I've disabled the motor output when the motor is not moving. Just avoids burning the coils or the driver out.


Hi Benj.
Thank you for sorting the file out for me.
just tried it out on the breadboard, and it is working great. :D
Will try it out later on the nema23s.
Thank you, Regards Roy.
These users thanked the author astro1234 for the post:
Benj (Thu Jul 11, 2019 8:48 pm)
Rating: 5.26%
 

jgu1
Posts: 1125
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1041 times
Been thanked: 274 times
Contact:

Re: Stepper one slows down when i press a button when running Stepper two.SORTED Thanks to Benj.

Postby jgu1 » Tue Jul 23, 2019 9:12 pm

Hi Ben Roy!

As far I understanding concerning this stepper component, is that it is possible to control the motor directly via fet transistor or Step & Direction.
I imagine that, the Step & Direction mode is to control a moduledriver for the steppermotor. could be one like this : https://www.ebay.com/itm/DRV8825-Steppe ... SwWSlbynba
I have tested Roy´s program, and made one by myself. Converted to an Aduino and a Pic16f876. But it doesn´t work.

I suppose that the I should get a frequency out depending on the delay in the loop? I don´t get any. Have I misunderstod something, by using this? :wink:

Thank´s in advance

Jorgen
Last edited by jgu1 on Tue Jul 23, 2019 9:18 pm, edited 3 times in total.

User avatar
Benj
Matrix Staff
Posts: 14566
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4595 times
Been thanked: 4239 times
Contact:

Re: Stepper one slows down when i press a button when running Stepper two

Postby Benj » Wed Jul 24, 2019 10:37 am