Ardiuno UNO and a4983 with regulator and stepper motor

Hi there, I have the following hardware - suggested by the store after explaining my project

Arduino UNO

  • a4983 driver with regulator
  • Stepper Motor: Unipolar/Bipolar, 200 Steps/Rev, 42x48mm, 4V, 1200mA
  • and a 3 pin potentiomenter dial
  • a bag of resitors
  • breadboard
  • red and black wire

The goal of the project is for a camera track and dolly system to be pulled very very slow.
(for timelapse photography)
The potentionmeter is so that I can have manual control of the steps - (micro steps)
Camera and dolly wiegh about 10lbs and will be pulled in 45degree inclines, up and down.
Motor and boards to be attached to the dolly, which runs along a fix chain, with a cog on the motor.

1: I need to power the board and motor seperately - I have a 12V 3.6amp Led Acid battery, will this run both?
2: Do I need anymore parts, pieces? Do I need an H-bridge???
3: Could someone help with the wireing of these on a breadboard please, I am very new at this :frowning:

Please help, I am very interested in all of this, am willing to learn and not have someone do it for me :slight_smile:

It sounds like this project is ambitious for you. I would recommend learning about the individual parts of your system before trying to make a complete system that does what you want to do. There are many issues that it seems you might not have addressed yet. For example, have you calculated if the torque of the stepper motor will be enough to drive your dolly?

You can use the 12V battery to power your Arduino and the stepper motor driver. You can also use the voltage regulator on the Arduino and get the stepper motor driver without the regulator.

The stepper motor driver has the necessary h-bridges built into it to drive the stepper motor you listed.

We have an example wiring diagram of how to wire a driver to a microcontroller on the product pages. There is a different diagram on the product page for the driver with regulators.

I encourage you to post your wiring schematics and pictures of your wiring here before you apply power.

- Ryan

Hi there, thanks so much for the reply.

I agree this is a tad ambitious for me - thats just the type of person i am.

Here is my schematic with an attempt at the bottom of it using the graphic you linked me to.
See the last circut of the graphic - after the help one.
The are a couple of wires i’m not sure where to attach to the UNO from the Driver board.
Also is the 5V to VDD just one wire from one 5V to VDD slot?

From what ive read, powering the Step Motor from the 12V Battery sperately from the Arduino is the way to go.

Is it possible to get an idea of how to wire all of this based on my graphic and parts?

The connection between 5V and VDD that you have labeled “What does this mean?” is the connection from the 5V regulator on the stepper motor driver carrier to the VDD of the A4983. If you make that connection, you do not need to make the other red wire connection to VDD on the right side of the board. However, I do not recommend you make that connection. Here are the changes to your schematic I recommend:

  1. Connect the red wire you have labeled “?” to Arduino’s 5V pin.
  2. Do not make the connection you have labeled “what does this mean?.”
  3. Connect STEP and DIR to any free digital IO line on your Arduino. For example, you could use pins 7 and 8.
  4. For the motor connections, verify that the connections you are making are the correct ones based off of our FAQ about stepper motor wiring. That should also help you understand why two wires are not used.

If you want to, you can post an updated schematic for me to check.

- Ryan

Thanks so much Ryan!

This is realy helping and making things a lot clearer to me - I just needed a little coaching to get started.

Here is the schematic with your direction.
[ img ][/img]

Afer your review ill give a shot - I understand the 5V motor may not pull the camera, we shall see :slight_smile:

SO assuming all of this works, the next step would be wiring the Pontentionmeter - any ideas on that?

Thanks again for your suggestions and help.

If you’ve made sure your motor connections are good, I think your circuit is good. Let’s make sure we can control the stepper motor with the Arduino before we tackle adding a pot!

- Ryan

Thanks again Ryan.

Here is a shot of the breadboard. (right click and view image for full image)
[ img ][/img]

Never done this before except to make LED’s flicker :).

I am hestitant to hook up VMOT and GND to the 12V battery untill you have had a look at this - I dont want to short anything out.

Also would you happen to know where I might get a quick test code, just to make the stepper turn with this setup - assuming its correct.
I was going to test with this.
// Stepper
#include <stepper.h>

// steps value is 360 / degree angle of motor
#define STEPS 200

// create a object on pins 6 and 7
Stepper stepper(STEPS, 6,7);

void setup()
void loop()
///// Turn the stepper 200 steps with a 1 sec delay between steps at 60rpm
/// then reverse the direction and do 50 steps at 20rpm with a 1sec delay between steps
Im just not sure how to complete the circut from the Arduino to the Driver with the wire, across the division down the center of the breadboard.

Almost there, once I have this working I can move on BIG TIME :slight_smile:

Hmm here are the error codes I get with that Sketch

_1stTest_boardComplete.cpp:2:21: error: stepper.h: No such file or directory
_1stTest_boardComplete:7: error: ‘Stepper’ does not name a type
_1stTest_boardComplete.cpp: In function ‘void loop()’:
_1stTest_boardComplete:16: error: ‘stepper’ was not declared in this scope

Your picture looks good except you need to solder the male header pins to the stepper motor driver carrier to make a secure electrical connection! In your code, it looks like you are trying to use a library called “Stepper” but have not installed it. Does the place where you got the code from explain how to install the library?

- Ryan

Ahhh I should have known Capital S in stepper Line 1

Ok, so I have all the wires hooked up with power, no soldering yet.
I hooked up the 12v Batter to the VMOT and GND on the driver
(Red to VMOT and Black to GND.)

It seem as though the Arduino is not talking to the Driver board - Is my breadboard correct in its wiring (last post image)

I understand that defining pins 6 and 7 needs to be to done to talk to the driver boards STEP and DIR pins - do they need to be defined somehow too? I am sort of lost here as to how the boards talk to each other.

There really is no hope of all your header pins making contact with the carrier’s pads unless you nicely solder them together. I suspect that is your problem.

- Ryan

Hmmm im hesitant to solder yet.

So they way everything looks to you is correct right?

Would there be a way to test and ensure the Arduino is talking to the a4983?

Sorry what is the carrier? is that the breadboard?

While I still think the soldering is crucial to it working, I just looked at the Stepper library, and there isn’t any reason to expect it to work with this driver. (The description of pin1 and pin2 parameters of the Stepper constructor make no mention of direction and step lines.) Can you try not using the library and just try setting DIR to HIGH and toggle STEP using digitalWrite?

When I say “carrier,” I am referring to just our board, the A4983 Stepper Motor Driver Carrier. You should definitely not be soldering the header pins to the breadboard. The whole point of using a breadboard is that you can easily rewire your circuit.

- Ryan

Do you have an example of this please?


You might find this thread helpful:

- Ben

Thanks Ben - why do I feel like I am missing parts on my circut here, when I look at those examples?

I cant rewire based on those specs, as from what I read this should all work with what I have… ideas?

I think Ben was mainly pointing you at the code that is attached to the first post of that thread. If you’ve soldered those header pins to the carrier, your connections should all be fine. The reason the wiring is different is because most people are using the version of the board without regulators on it.

Were you asking for an example of the code or of the soldering?

- Ryan

Hi again Ryan, I was asking for a sample of code to get the thing going so that I can make sure its all wired correctly.

A simple stepper sketch would be amazing please.

The forum thread Ben linked to has an attachment called StepperTester.pdf that is a simple stepper sketch. You can modify it to work for you by removing the lines that refer to the enablePin and setting dirPin and stepPin to the pins that match your wiring.

- Ryan

Ok Tried this - nothing…

#define stepPin 6
#define dirPin 7
//#define enablePin 4
void setup()
// We set the enable pin to be an output
//pinMode(enablePin, OUTPUT);
// then we set it HIGH so that the board is disabled until we
// get into a known state.
//digitalWrite(enablePin, HIGH);
Serial.println("Starting stepper exerciser.");
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
void loop()
int j;
// set the enablePin low so that we can now use our stepper driver.
//digitalWrite(enablePin, LOW);
// wait a few microseconds for the enable to take effect
// (That isn't in the spec sheet I just added it for sanity.)
// we set the direction pin in an arbitrary direction.
digitalWrite(dirPin, HIGH);
for(j=0; j<=10000; j++) {
digitalWrite(stepPin, LOW);
digitalWrite(stepPin, HIGH);

Are we positive my connections on the board are correct?