davidb24v
Posts: 19
Joined: Sat Dec 10, 2011 9:32 am

Controlling stepper motors via I2C?

Sat Nov 10, 2012 9:31 pm

I'm out of pins on an Arduino for something I'm trying to do with a Pi controlling an Arduino.

I have I2C available and in the right place, is there any chance that chucking in another MCP23017 will let me control a stepper motor? It's just a cheap one - the 28BJY-48 with the ULN2003 board.

If nobody knows then I'm content to give it a shot and report back in the pursuit of knowledge :D

Dave

davidb24v
Posts: 19
Joined: Sat Dec 10, 2011 9:32 am

Re: Controlling stepper motors via I2C?

Sun Nov 11, 2012 8:06 pm

Ok, as those of you who know, er, know.

Not a problem. It just works, well for this particular stepper motor anyway.

Phew! That saved a complete re-think.

Dave

User avatar
TonyD
Posts: 448
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: Controlling stepper motors via I2C?

Sun Nov 11, 2012 8:09 pm

Controlling el-cheapo steppers via a MCP23017 I2C port expander is definitely possible especially if you're using a ULN2003 (or ULN2803) to drive the stepper coil voltage/current.

There are several MCP23017 boards for the RPi, here's my design for one here:

Image
Tony

User avatar
Grumpy Mike
Posts: 918
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
Contact: Website

Re: Controlling stepper motors via I2C?

Sun Nov 11, 2012 8:16 pm

Yes you can control a stepping motor with I2C and a Pi but you will not control it well.
Depending what you want to do with it, the pulses you can give it will be slow and erratic due to the fact that Linux steals time off every thread. This will cause the motor to stutter or stall at times.

idem
Posts: 12
Joined: Mon Feb 18, 2013 3:23 pm

Re: Controlling stepper motors via I2C?

Thu May 09, 2013 10:49 pm

UP
Any examples for a begginer?
My Raspi is out of Pin, but my MCP23017 have still some free Pin.
I wanna control my stepper motor with my ULN2803A.

Thanks for all

btidey
Posts: 1627
Joined: Sun Feb 17, 2013 6:51 pm

Re: Controlling stepper motors via I2C?

Fri May 10, 2013 12:57 pm

If you are running out of pins because you are using 4 pins per stepper and have multiple steppers then maybe consider just using 2 pin control of the steppers. That can be done easily just by inverting the 2 controls using the 2803 to produce the other two controls. Also simplifies the driving software which only has two pins to worry about.

idem
Posts: 12
Joined: Mon Feb 18, 2013 3:23 pm

Re: Controlling stepper motors via I2C?

Wed May 29, 2013 8:58 pm

UP

so..noone have ever user a stepper with an MCP23017 ?

WickedPenguin
Posts: 33
Joined: Wed Sep 04, 2013 7:11 pm

Re: Controlling stepper motors via I2C?

Tue Oct 22, 2013 6:08 am

idem wrote:UP

so..noone have ever user a stepper with an MCP23017 ?
yes, I have multiple steppers controller via a MCP23017 chip via i2c. I use them for my CNC mill work in progress

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Controlling stepper motors via I2C?

Tue Oct 22, 2013 8:33 am

You can have up to EIGHT MCP23017 on each I2C bus, just set each one to to a different I2C address.

Even the boards pictured have jumpers to set address.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Loonhaunt
Posts: 55
Joined: Sat Nov 16, 2013 5:13 am

Re: Controlling stepper motors via I2C?

Wed Dec 25, 2013 8:55 pm

techpaul wrote:You can have up to EIGHT MCP23017 on each I2C bus, just set each one to to a different I2C address.

Even the boards pictured have jumpers to set address.
Hello,

I am in approximately the same position as the orginal poster to this thread, Looking for some guidance to setting up RPi I2C to controll more steppers motors, using ULN2003 controller for each motor. I am intending to go from RPi SDL SCL to Abel Electronics IO 32 expander board. Any Hints would be welcome. I am eventually going to take a stab at controlling some process vacuum system that require two way com from mass flow controllers and the like. I think that your designed boards will eventually be a good solution for the number of points that I need to control, many!

Thanks Dave

User avatar
wymand
Posts: 47
Joined: Thu Nov 28, 2013 2:06 am
Location: relocating to hiddenridge
Contact: Website Facebook Google+

Re: Controlling stepper motors via I2C?

Sat Feb 01, 2014 11:16 pm

WickedPenguin wrote: yes, I have multiple steppers controller via a MCP23017 chip via i2c. I use them for my CNC mill work in progress
Would it be rude to ask you to share an example of your code to control the stepper?
I would prefer to control my steppers via python but may have to resort to some sort
of c++.

Thanks Doug
Never stop learning
Never stop evolving

Return to “Interfacing (DSI, CSI, I2C, etc.)”