kv36
Posts: 6
Joined: Mon Mar 02, 2015 6:39 am

Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 6:48 am

Do any of you have python code to control 2 stepper motors using raspberry pi with 2 ULN2003 drivers. I don't want to control the speed of the motor nor the angle movement, i just want the speed to be constant and slow. My project is about doing image processing and moving the motor either in clockwise or anticlockwise direction according to the result. I only want to control the number of revolutions in the clockwise or anticlockwise direction. A maximum of 2 revolutions of the motor in both the direction is enough for my project. Please help,I'm new to raspberry pi and i have to complete this project in 2 weeks time.

User avatar
DougieLawson
Posts: 33832
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 11:28 am

The ULN2003 isn't a driver chip, it's a buffer chip (it only prevents back EMF).

Think again.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

PiGraham
Posts: 3401
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 11:53 am

If your stepper motor coil current is within 1/2 specification for the 2003 (IIRC that would be 250mA (500mA/2) per coil) you could connect two steppers in parallel so that they move together. Given 7 drivers in the chip you might be able to common one pair of coils and control the other pair independently to drive two motors from 6 GPIO via one ULN2003.

ULN2003 are so cheap it's probably best to use one per motor.

Can you say more about what you want to achieve?

User avatar
mikronauts
Posts: 2637
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 1:32 pm

UNL2803's will only work for unipolar stepper motors (as far as I know)
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

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

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 1:47 pm

The inexpensive 28BYJ-48 steppers generally come with a ULN2003A driver board. I've also driven them with a ULN2003A on a bread-board.

You need to tell us the model of the steppers you want to control.

kv36
Posts: 6
Joined: Mon Mar 02, 2015 6:39 am

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 5:49 pm

I want to use 28BYJ-48 motor only.

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

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 5:52 pm

Did they come without a driver board? It's slightly more complicated to set up a ULN2003 on a bread board.
img_3393.jpg
img_3393.jpg (54.74 KiB) Viewed 5148 times
stepper.jpg
stepper.jpg (53.29 KiB) Viewed 5148 times
Last edited by joan on Mon Mar 02, 2015 6:02 pm, edited 1 time in total.

kv36
Posts: 6
Joined: Mon Mar 02, 2015 6:39 am

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 5:59 pm

I haven't bought them yet. Definitiley i will buy ULN200 on a control board only

danjperron
Posts: 3032
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Controlling 2 stepper motors with 2 ULN2003

Mon Mar 02, 2015 6:00 pm

Please read this post up to the end.

http://www.raspberrypi.org/forums/viewt ... 03#p678903

Stepper driver for 3D printer are so cheap and so easy to setup!

Daniel

PiGraham
Posts: 3401
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Controlling 2 stepper motors with 2 ULN2003

Fri Apr 27, 2018 10:47 am

DougieLawson wrote:
Mon Mar 02, 2015 11:28 am
The ULN2003 isn't a driver chip, it's a buffer chip (it only prevents back EMF).

Think again.
Actually it's a darlington array commonly supplied with cheap unipolar stepper motors.
The switch higher currents and voltages when driven with very low current an voltage from gpio pins. They also have flyback diodes to protect against back EMF.
You control the stepper by turing on the four gpio driving the inputs to the darlington array in the proper sequence.
It works fine but the coding a little bit more involved than with a pulse and direction stepstick type driver.

Here is a tutorial using similar ULN2803 / L293D darlington arrays.
ULN2003A functions the same way but note the different package.
https://en.wikipedia.org/wiki/ULN2003A


https://learn.adafruit.com/adafruits-ra ... s/overview

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20494
Joined: Sat Jul 30, 2011 7:41 pm

Re: Controlling 2 stepper motors with 2 ULN2003

Fri Apr 27, 2018 12:11 pm

Thread Necro! Take care all.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

teprojects1
Posts: 11
Joined: Sat Jan 21, 2017 7:43 am
Location: Lahore
Contact: Website

Re: Controlling 2 stepper motors with 2 ULN2003

Thu Jun 14, 2018 8:15 pm

ULN2003 is a great IC used to control DC as well as stepper motors. I really like this one as its not that complex. You should download this ULN2003 Proteus Simulation.
An Expert in Engineering Projects | Arduino Projects

Return to “Python”

Who is online

Users browsing this forum: GOB, przemof and 9 guests