Help a Student! Arduino Uno to run both a Stepper and a DC

Hi there!

This is my first post in this forum, and it's a needed one. I'm totally new to electronics, but due to being challanged with a chapter in my education, i find myself wrestling the beasts of arduino.

What i want to do is:

Making a Steppermotor control a little "carridge" on a rail. On this "carridge" i want to have a little dc motor(for weight reasons). The dc motor is supposed to make a rope (with a magnet on the end of it) go up and down.

Following this schematic: http://www.azega.com/controlling-a-stepper-motor-with-an-arduino/ i've actually got the stepper-motor to run, but it's really slow. I can't really figure out why. The motor i'm using is a Sanyo Denki 103H7121-0144. I first thought it was something with the power, so i plugged the power into "Vin" and plugged a 12V 1A AC/DC into the arduino port. Sure, the difference is noticeable soundwise, but it still can't go faster even though we change the code. Is there some other way of bringing power in or am i just missing something?

The dc motor is hard. We know it can go in both directions by switting the pos/neg, but we don't know how to control it on the board. Everywhere online that i look, i keep hearing about shields but I don't really know what shields do and here in Stockholm, Sweden, it seems you can't buy a ready made Motor Shield.

I need sooo much help. I think you guys are awesome so i trust you to guide me in the right direction.

I also want to control this with a joystick, where the stepper is the X-axis and the dc is the Y-axis, but don't worry about that for now. I think i can figure it out by myself.

i've actually got the stepper-motor to run, but it's really slow.

The speed of a stepping motor is governed by software, want it to run faster change the software.

but it still can't go faster even though we change the code.

So you haven't changed the right part. Post the code and lets see what you did. Please use the # icon when posting.

You will get to a point where the motor will not turn at the speed you command it but just makes a buzzing noise. Then you are telling it to go too fast, so you need to up the voltage or lower the speed. Also those puny transistors will not deliver much current.

A shield is simply a pre built electronics board that plugs in the top of an arduino and covers it, hence the name shield. You can make all the circuits yourself you don't have to but a shield. For DC motors look at:- http://www.thebox.myzen.co.uk/Workshop/Motors_1.html Other links from that page also discuss stepping motors. For motor control in both directions look up the term H-bridge

Here’s the code as requested. I haven’t really changed much, except the random generation and commenting the delay out.

#include <Stepper.h>

// change this to the number of steps on your motor
// 360 / 1,8 = 200 steps
#define STEPS 200

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 2, 3, 4, 5);

void setup()
{
  // Initialize random number generator
  randomSeed(analogRead(5));
}

void loop()
{
  // Pick a random direction and distance to move
  // int rand = random(-200, 200);
  int rand = 200;
  
  // Pick a random speed
  // int spd = random(25, 100)
  int spd = 50;
  // it stops spinning at 75
  
  // Go
  stepper.setSpeed(spd);
  stepper.step(rand);
  
  // delay(1000); 
}

Might our stepper be too strong? The only info i can get that it’s max 1A. Can’t get any info on the V. It’s from an old printer, by the way.

If we attatch another power supply, we’ll just burn our transistors, right?

// it stops spinning at 75

So work with that figure and try more voltage.

The only info i can get that it's max 1A.

That is little use without the voltage you need to achieve that current. Can you measure the DC resistance? Also that is likely to be 1A per coil, at any one time there will be two coils on so you power supply needs to be able to supply 2A.

If we attatch another power supply, we'll just burn our transistors, right?

Depends on exactly what transistors you are using but probably yes. You need to replace those transistors with some Logic level FETs (it has to be a logic level FET)

Here's the code as requested. I haven't really changed much, except the random generation and commenting the delay out.

Where did you get this code and what do you expect it to do? You haven't changed much from what? Why did you remove the delay?

Don

Grumpy_Mike: So work with that figure and try more voltage.

I've been trying, but I cant figure out how to attach and manipulate an external power source. Right now I have a 12V 1A AC/DC adapter from a router here in school which i've been trying to set up, as i've said before. I'm gonna try out a different motor as soon as i figure out how to get the steelbar attached to it off.

I'm going to buy some of those logic level FET's you where talking about. Do you have any more specific model you could suggest?

Just for the sake of sharing, we were using 2n3904 NPN transistors (with a max of like 0,2A) due to them being specified in the schematic i linked to in the start. The diodes is the 1n4000 series.

floresta: what do you expect it to do?

This code is what came with the first link with the schematic. It's only used now, so that we can now that the motor is functioning.

floresta: Why did you remove the delay?

The reason I commented out the delay and that I've altered the code is that I want to go in one direction and at a set speed. Before it was set to a random value. It's all covered in my first post (or if you check out the link).

Do you have any more specific model you could suggest?

How about the IRLB8748

You NEED to measure the coil resistance of your motor before you can make any sensible decisions.

This code is what came with the first link with the schematic.

There was no code on that link when I looked the first time and there is no code there now.

Have you given any thought as to why the original code was in loop() and why your modified code really belongs in setup()?

Don