Go Down

Topic: 6 Wire Stepper and ULN2803A (Read 10276 times) previous topic - next topic


Hi there, I wonder if someone could point me to a diagram to wire the following.

Arduino UNU
FWD/Reverse switch

The plan is to have the POT control the speed of the stepper

I found the idea here, but I don't quite understand his schematic and cant tell if he is powering the Stepper seperately from the Arduino
I would start with this If I could, and then move on to the POT / fwd / rev version.

Any help would be greatly appreciated,


The motors are powered by their own power supply, meaning the system power runs to the motors and the system power supplies the upstream side of the arduino's regulator.


Thanks and totally understood - I have built one this way with a DC motor

Now I need to figure out how to build the same thing with the link above - its schematic that I dont quite understand - i'd love a breadboard illustration of it

Or do you know where I can find instructions on wireing the above ULN2803A and a 6 wire stepper with pot?


What don't you understand about the schematic? The letters A to F are the windings and the letter on the output of the chip shows what winding is attached to what pin.


I understand what pins to use and where to wire them - its powering the moter seperately from the arduino that I am  little miffed about, I just cant visualize it on the breadboard :/


Just wire the + from the power supply to the center taps of the motor, and make sure the common diode pin on the ULN2803A is also connected to it. Then wire the - from the power supply to the arduino ground.


This is the schematic I am attempting to build onto a breadbaord

I hesitate as I am not sure how the battery is hooked up.

Could someone please show me the light here :)

Thanks again everyone.


Still not sure what you are not getting. The battery attaches to the + and - terminals and the ground goes to the arduino ground.


Thanks for your input, i have wired it using your advice as follows

I am getting holding torque, but the motor does not step - I can feel it going back and forth in tiny increments, almost like on/off steps.
Any Ideas?

here is my sketch

Code: [Select]
#include <Stepper.h> //include the function library
#define STEPS 200 //1.8 deg motor (200 steps per revolution)
#define D0 13 // Arduino digital output numbers
#define D1 12
#define D2 11
#define D3 10
Stepper stepper(STEPS, D0, D1, D2, D3); //create the stepper

void setup()
  stepper.setSpeed(30); //set speed to 30 rpm
  stepper.step(2000); //move 200 steps = 360 deg in one direction
// delay(1000);
// stepper.step(-200); //move 200 steps = 360 deg in the opposite direction

void loop()


I SUppose at this point, my question is - How do the colors of the wires from the stepper relate to the diagram below?


Jan 17, 2012, 02:28 am Last Edit: Jan 17, 2012, 02:35 am by darkdragon Reason: 1
It would help if you followed the schematic completely. Assuming the arduino is powered up and your "To Arduino Pins" are in fact connected to the Arduino, you are still missing two connections to the ULN2803 and a tie between the grounds of the 12 v power source and the Arduino.

And, you connections to the stepper also did not follow the schematic.


Thanks for your advice - My issue is that I dont fully understand the schematic.

Firstly I am unsure as to what color wires from the stepper coordinate with what pins on the ULN2803a o,1,2,3 vs D,C,F,A, E,B  from the stepper motor.

Secondly I dont see where the GND runs to from the stepper (B).

Take a look at the image attached, I am attempting to figure this out before wiring anything and I do appreacite your input.


Jan 17, 2012, 04:01 am Last Edit: Jan 17, 2012, 04:05 am by darkdragon Reason: 1
First, you really should learn how to read an electronic schematic. Google is your friend here and a simple search will get you many sources for this.

Second, you need to determine which wire on the stepper motor is which. A multimeter is your friend here, if you do not have the schematic for the motor. And Google, again is your friend to find the schematic for the motor.

The schematic is showing the ground of the 12v battery connected to pin 9, which is also connected to the ground of the Arduino. Your drawing does not show a pin 9 connection to the Arduino ground, and is showing a connection to the stepper motor to ground, which is not in the schematic.

The schematic is showing the center wire in each winding (E and B) on the motor connected to both the positive side of the battery and pin 10. Assuming red and black are E and B, you have one correctly connected to the positive side of the 12v and one incorrectly connected to ground.

Looking at the schematic, again google is your friend here, shows that E and B are the Yellow and White wires, not the Red and Black. One winding is Red, White, and Blue. The other one is Black, Yellow, Green. http://cnsoyo.com/product_show_e.asp?id=8

Google is also your friend if you do not know how a chip's pins are numbered. Search terms "ic pin numbers"


You should also note that right and left side power busses on a solderless breadboard are not connected to one another and must be bussed by you during your breadboarding phase. All ?IC's have an index notch usually centerline unless directly adjacent to pin 1. With the index notch pointed away from you and the pins pointing down, pin 1 is in your upper left and increments in a counter clockwise fashion. The same way as depicted in the connection drawing.


Jan 23, 2012, 10:08 pm Last Edit: Jan 23, 2012, 10:55 pm by graphections Reason: 1
Thank you sooo much everyone, I managed to figure out what wires to send to what pins thanks to you all your help.

Here is the revised schematic

With the following code
Code: [Select]

Stepper Motor Control - speed control

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.
A potentiometer is connected to analog input 0.

The motor will rotate in a clockwise direction. The higher the potentiometer value,
the faster the motor speed. Because setSpeed() sets the delay between steps,
you may notice the motor is less responsive to changes in the sensor value at
low speeds.

Created 30 Nov. 2009
Modified 28 Oct 2010
by Tom Igoe


#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);            

int stepCount = 0;         // number of steps the motor has taken

void setup() {
 // initialize the serial port:

void loop() {
 // read the sensor value:
 int sensorReading = analogRead(A0);
 // map it to a range from 0 to 100:
 int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
 // set the motor speed:
 if (motorSpeed > 0) {
   // step 1/100 of a revolution:

Now my next question is in reguards to the functionality of this
I would like to have the POT work as speed control as well as Forward Reverse when it passes the halfway mark.
So 0-511 = forward with speed varience
512-1023 being reverse with speed varience.

This would eliminate having to add a forward and reverse switch

Does anyone have any Ideas on how to modify the sketch to do this?

Go Up