Unipolar: Bipolar In1:in2 Step & Dir

Old man ; new Learner Please be gentle.

I am am getting a bit frustrated trying to steal other people ideas.

I come across a “INO” file which drives a stepper motor via In1:In2:In3:In4 but it is just not exactly what I need.

I find another which uses Step and Dir but lacks some of the good stuff from the first.

I could ( can ) cut and paste from one file to the other file but both can not drive the same motor.

This files uses this motor driver board, the other INSISTS on that one.

I am looking for some pointers to be able to steal ideas from both to be honest.

It is not just enough to get said motor to move by 50 steps. It is designed to control a focusing device while being controlled by an external program. This action then needs to recorded in said program. In turn this means I can not alter maybe 75% of the code. {Ascom for those know of it}

I can play with code and get the motor to use different PINS but still thinking the same way. It is the “my motors not like Y o u r motor” that I wish to over come.

I do accept that the answer may well be to write all my own code from scratch; however I feel I may meet my maker before finishing that game!

Thanks in advance

No offence but please read and follow this link: How to get the best out of this forum - Development Tools / IDE 1.x - Arduino Forum.

We request schematics and the best code You have. Hand drawn, pin names, power supply data, and a picture posted is fine.

Your post is full of fog, unclear messages. Please give us a second chance.

1 Like

(i) I did not insist that all help solves my issue instantly.

(ii) I asked to have some light shown on the issue, not to be handed a fully working project.

(iii) The request was purposely penned in a light hearted manner.

(iv) Having re-read my post, I struggle to find the part asking for responses to be penned exclusively by pedantic holier than thou types.

From the complexity of your OP, it seems like you may have overcomplicated the solution.

Save a backup of your existing code to have a copy of your own logic saved for later.
Then, in your ‘new’ project code, strip out everything except the stepper.
If needed, replace tour stopper code withe working
Next, ensure your motor driver and power supply are up to the task.
You should be at a point now where the motor works in your new project framework
Finally, you can copy in your backup logic for your own saved code.

1 Like

Like any project, have an overall idea/goal. Find hardware to do the job. Find libraries to move the hardware. Write your idea in steps, then into code. Some previously defind steps will need to be broken-down further.

If you get stuck, bring your work here for further discussion.

1 Like

Had I seen your OP first, I would have said much the same. We are not a free design shop or a code shop. We expect you to do your best, and when you get stuck, someone will give you a nudge in the right direction. Since I used to be an astronomer I have a good idea what your projhect is but you should havce explained all that.
In general, what I recommend is you pick a library and learn from the library examples (the ... menu beside the lib name in the library manager pane)
If you start over and explain your project and what you want the stepper to do, then maybe you will make some progress.

First up, Judging by the hour of your Very welcome responses I am making an assumption that you are not a night owl like myself, rather you hail from across the pond. This may be why the self deprecating posts where not quite seen as humour.

My issue is one of concept rather than line specific code. How do you explain a straight line to some one who walks in curves.

I understand BIpolar and UNIpolar {and Fleming, Maxwell and magnets}. I get how Step and Dir make a stepper rotate this much; this way. I get that the 4 “In” lines to the same job.

I just can not see a way of translating method A to method B. Please some one point me to a Rosetta Stone.

Not asking to do the work for me. Could it be as simple as this type of motor can not be controlled this way, this library demands this style of code. Change the library, change the method. I just don’t know.

Some times if you don’t know the answer you can not ask the question.

I may be useless but I am grateful.

Try A. If it works, continue. If it fails, try B.

From your post it is notclear what type of motor you want to control...
Is it a stepper?
What type of stepper?
Please share a type number...
Or a picture.
Or a purchase order.
Or a link to the item in the online shop where you bought it.
Same for your driver ic.
Once we have that, we can see if those are compatible and suitable for your purpose.
Only then,a suitable library can be chosen...

That is your answer. Pick one, or start with AccelStepper

Thank you.

I think it was then a case of I knew in my head but I needed a kind soul to confirm it.

Again Thanks

This library gets recommended a lot on the forum but I still have it in my todo list.

There is no universal solution for switching from method A to method B. It depends greatly on how it has been implemented so far. And you haven't shown anything about that yet.

A stepper motor requires the coils be energized in a particular order. For example a unipolar stepper they may be numbered in1,in2,in3 and in4. A controller that has inputs for step and direction converts the step and direction pulses into the in1,in2,in3 and in4 pulses to drive the motor. You are confusing two different levels of control.

1 Like

Once again may I say thanks for the responses. Not sure which movie it is from but “ I got my head on straight now, Boss”.