Inventor_Tommy
Posts: 14
Joined: Sun Jun 01, 2014 8:26 am

4 Phase Stepper Motor and CNC Application

Sun Jun 01, 2014 8:32 am

Dear All

I am not a newbie by any means to Python, the RPi or real world applications. However I have hit a road block and wondering if there is any way around my problem that follows without purchasing new hardware?

I am trying to build a CNC machine from my Raspberry Pi. I did some research, purchased some 4 phase stepper motors (28BYJ-48) with a ULN-2003 driver board. I can move these motors fine with a python script using [1,0,0,1] [1,0,1,0] etc except when I try to apply this to the real world I hit a road block. So in a nut shell I know I can move the motors smoothly with a 0.004 second delay however all applications so far with examples on the net with python all show a bipolar motor setup. I even tried compiling my own kernel with LINUXCNC drivers etc, the application works but it require 2 pins only for drive/step. I clearly need 4 GPIO pins per phase.

Can anyone help with a solution around this or should I just bite the bullet and buy some 2 phase motors?

Thanks in advance and I look forward to your replies :-)

Tom

MrGreg
Posts: 66
Joined: Sun Jun 10, 2012 7:25 pm

Re: 4 Phase Stepper Motor and CNC Application

Mon Jun 02, 2014 10:33 pm

Bite the bullet and go for bipolar.
They are deal easier to use and if you are building something cnc, likely you will need all the IO you can muster for other functions.

Inventor_Tommy
Posts: 14
Joined: Sun Jun 01, 2014 8:26 am

Re: 4 Phase Stepper Motor and CNC Application

Mon Jun 02, 2014 11:58 pm

No problems. Thank you for your quick answer. I will get some bipolar stepper motors and see how I go :-)

Inventor_Tommy
Posts: 14
Joined: Sun Jun 01, 2014 8:26 am

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 12:43 am

OK

So I got the following motors that are "made for CNC applications". However they still have 4 wires. Anyone know of a driver I can use with the raspberry Pi to interface with these stepper motors?

http://www.ebay.com.au/itm/231162408535 ... 1439.l2649

Tom

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 9:47 am

Hi,
Inventor_Tommy wrote:However they still have 4 wires.
... because they are bipolar stepper motors.
Inventor_Tommy wrote:Anyone know of a driver I can use
You (obviously) need a driver for bipolar stepper motors. Add word "bipolar" in your google search string.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

Inventor_Tommy
Posts: 14
Joined: Sun Jun 01, 2014 8:26 am

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 9:51 am

Ivan

At the risk of sounding even more like an idiot I can only find drivers that have a parallel interface. The raspberry pi does not have that.

However I did find on eBay a driver that has a step/drive input and apparently it does the translation and it has the A-, A+, B-, B+ outputs. It is the A4988 I briefly mentioned earlier. I will post back if this piece of hardware works with my custom kernel.

Tom

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 10:06 am

Hi Tom,
Inventor_Tommy wrote:II can only find drivers that have a parallel interface. The raspberry pi does not have that.
The RasPi GPIO is parallel interface. (Parallel <> Centronics)


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

Inventor_Tommy
Posts: 14
Joined: Sun Jun 01, 2014 8:26 am

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 10:08 am

Can you point me in the direction of some information in regards to interfacing the Pi with the parallel interface of a bipolar driver?

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 10:21 am

Hi,
Inventor_Tommy wrote:Can you point me in the direction of some information in regards to interfacing the Pi with the parallel interface of a bipolar driver?
Parallel interface is interface containing parallel signals. This is actually primary GPIO interface, but some GPIO pins are capable (additionally) to provide some other interfaces.

So, if (for example) your parallel interface is 8-signals wide, you need 8 GPIO signals. Let's simplify that the driver board signals (mentioned 8) are named as A, B, C, ... and H. And you connect them to GPIO 1, 2, 3, ... 8 (pick proper numbers, this is for easier explanations)...

Ok, then you find out that according to the driver board capabilities and motors connected, you rotate one stepper in one direction with the sequence:
A B C D E F G H
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
...
...

You then need this to directly map int your pins (just substitute A, B, ... with GPIO 1, 2, ...) and you get your sequence to be executed by the code.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

Inventor_Tommy
Posts: 14
Joined: Sun Jun 01, 2014 8:26 am

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 11:34 am

Ivan

Perfect mate, that is definitely something I understand. Wish me luck creating my interface cable.

Thank you so much for your time :-)

User avatar
joan
Posts: 13932
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 11:39 am

I'm not sure if building a "Centronics" port will automagically make the port work under LinuxCNC.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 11:43 am

Hi,
joan wrote:I'm not sure if building a "Centronics" port will automagically make the port work under LinuxCNC.
Just to clearify... I mentioned earlier that "parallel" is not equal to "Centronics". (Centronics is just one type of parallel interfaces.)


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
joan
Posts: 13932
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: 4 Phase Stepper Motor and CNC Application

Mon Jul 14, 2014 11:47 am

FLYFISH TECHNOLOGIES wrote:Hi,
joan wrote:I'm not sure if building a "Centronics" port will automagically make the port work under LinuxCNC.
Just to clearify... I mentioned earlier that "parallel" is not equal to "Centronics". (Centronics is just one type of parallel interfaces.)


Best wishes, Ivan Zilic.
Yes, I understood that.

I was just wondering if the OP plans to use his steppers under LinuxCNC.

RaspISteve
Posts: 98
Joined: Wed Oct 24, 2012 9:15 pm
Location: Cheltenham, UK

Re: 4 Phase Stepper Motor and CNC Application

Sat Jul 19, 2014 2:53 pm

Tommy,

Did you really look at the stuff I pointed you at in http://www.raspberrypi.org/forums/viewt ... 29&t=80766? Heard nothing so I assumed you'd cracked it. I see now you still have some way to go.

Those modules (and a big power supply) will solve most of the problems. You will maybe need to add some mosfet type devices between the PIO output pins and the real world motor drivers. Also remember that with step-motors you are switching some big currents and higher voltages which means a lot of thought with wiring and layout.
Share and Enjoy.

Return to “Advanced users”