Frankincense
Posts: 4
Joined: Tue Mar 12, 2013 3:00 pm

GPIO to control stepper motors and switch.

Tue Mar 12, 2013 3:04 pm

Hi guys,

I am currently working on a project which is using two stepper motors controlled by this board: http://www.ebay.co.uk/itm/251218184781? ... 1497.l2649 which obviously takes up the 8 GPIO pins.

I would also like to control an electronic switch, and i understand a relay is out of the question due to low current from the pi. How can I control something like a transistor from the pi, when I have taken up the 8 GPIO pins?


Many thanks,
Frank

Frankincense
Posts: 4
Joined: Tue Mar 12, 2013 3:00 pm

Re: GPIO to control stepper motors and switch.

Tue Mar 12, 2013 3:31 pm

Or am I getting confused with the green pins, and which ones are actual GPIO pins?

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

Re: GPIO to control stepper motors and switch.

Tue Mar 12, 2013 3:45 pm

See http://elinux.org/Rpi_Low-level_peripherals for P1

The green pins are the general gpios.

You can also use txd, rxd, sda, scl, miso, mosi, sclk, ce0, ce1 if you don't need their special functionality.

Just open them as inputs or outputs.

Frankincense
Posts: 4
Joined: Tue Mar 12, 2013 3:00 pm

Re: GPIO to control stepper motors and switch.

Tue Mar 12, 2013 4:16 pm

That's fantastic news, I was getting worried then! For anyone else looking at this thread I will be using this guide for using a relay with the Raspbery Pi: http://www.susa.net/wordpress/2012/06/r ... sing-gpio/

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

Re: GPIO to control stepper motors and switch.

Tue Mar 12, 2013 4:23 pm

On Rev2 boards there are four more gpios available on P5 (gpios 28-31) to make a total of 21 usable gpios.

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: GPIO to control stepper motors and switch.

Tue Mar 12, 2013 4:52 pm

joan wrote:On Rev2 boards there are four more gpios available on P5 (gpios 28-31) to make a total of 21 usable gpios.
But there's a small catch. :lol:

You have to solder on that header yourself.
Alex Eames RasPi.TV, RasP.iO

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

Re: GPIO to control stepper motors and switch.

Tue Mar 12, 2013 6:22 pm

Also if you are controlling the stepper in the normal 4 step sequence then the 4 drive signals are actually in two pairs so 2 that GPIO pins per motor is sufficient (rather than 4) providing one can invert the signals.

Coil 1 = GPIO-A
Coil 2 = Not GPIO-A
Coil 3 = GPIO-B
Coil 4 = Not GPIO-B

If you are using a ULN2803 and you have access to the pins then this can be done by using spare drivers on the ULN device as inverters with some pull up resistors, but you may not be able to do that easily with the board you are using.

The principle and circuit is well explained on page 13 of

http://www.philadelphia.edu.jo/academic ... erface.pdf

Driving all 4 signals independently does allow half stepping control.

Forris
Raspberry Pi Certified Educator
Raspberry Pi Certified Educator
Posts: 279
Joined: Fri Jan 06, 2012 7:46 pm

Re: GPIO to control stepper motors and switch.

Tue Mar 12, 2013 6:42 pm

btidey wrote: The principle and circuit is well explained on page 13 of

http://www.philadelphia.edu.jo/academic ... erface.pdf

Driving all 4 signals independently does allow half stepping control.

Thanks for that link. There's some useful stuff in there, and explained really well for us mortals!

geeus
Posts: 39
Joined: Fri Oct 21, 2011 7:03 pm
Contact: Website

Re: GPIO to control stepper motors and switch.

Wed Mar 13, 2013 1:28 pm

Are you using 5 or 4 wire stepper motors. If it is 5 or 6 wire you can use a darlington array. There is a very cheap little IC called ULN2003A that is more than capable of shifting enough current to drive a stepper motor. or relay or any other high current device from the Pi
Gee The Rabid Inventor :)

Frankincense
Posts: 4
Joined: Tue Mar 12, 2013 3:00 pm

Re: GPIO to control stepper motors and switch.

Wed Mar 13, 2013 3:11 pm

I am using a: ULN2803 to control two: 28BYJ-48 5 VDC which is currently taking up 8 pins + two for power. But aslong as I can use other pins as regular GPIO pins ( which as the above posts state, i can ), I will be also powering two replay switches using this: http://www.susa.net/wordpress/2012/06/r ... sing-gpio/

zaxxon007
Posts: 8
Joined: Mon Jul 16, 2012 10:37 am

Re: GPIO to control stepper motors and switch.

Mon Mar 25, 2013 11:50 am

You can use smart stepper driver like this:
EasyDriver V4.4 Stepper Motor Driver Board for Arduino

It has one input for direction and another for steps. It can also do microsteps to avoid vibrations.
It is compatible with GPIO voltages and includes output protection.

It starts each step with higher voltage which decays to achieve higher reliability of steps and speed of steps. No regular H bridge can perform that.

Return to “General discussion”