Show Posts
Pages: 1 [2] 3 4 ... 10
16  Using Arduino / Project Guidance / Re: code with zoetrope with stepper on: June 05, 2013, 10:56:07 am
thanks so much for the code.
unfortunately my motor was all over the place. it didn't do a full rotation, it was super jerkey and kind of went back and forth. would a driver other than just an h-bridge chip help? or any other ideas?

after running the code for a little bit something popped!! what could it have been? powering this with a 12V 5amp supply...i think it was the h-bridge chip because when i give power to the stepper it budges and has

here is the exact code i had:
#include <Stepper.h>
#define STEPS 200

Stepper stepper(STEPS, 8, 9, 10, 11);

const int ledPin =  13;      

int ledState = LOW;            
long previousLedMillis = 0;        
long previousStepperMillis = 0;        

long ledInterval = 25;
long stepperInterval = 5; // I think this is 60 rpm

long currentPos = 0;

void setup()
   pinMode(ledPin, OUTPUT);

void loop()
  // You could just step 5 times for every led interval, this is more flexible however
  unsigned long currentMillis = millis();
  if(currentMillis - previousLedMillis > ledInterval) {
    previousLedMillis = currentMillis;  
    if (ledState == LOW){
      ledState = HIGH;
      ledState = LOW;
    digitalWrite(ledPin, ledState);
  if(currentMillis - previousStepperMillis > stepperInterval){
previousStepperMillis = currentMillis;
currentPos += 1; //assumes clockwise stepping
stepper.step(currentPos & 0x3);
17  Using Arduino / Project Guidance / Re: code with zoetrope with stepper on: June 05, 2013, 09:36:46 am
thanks so much! this is all super helpful! so yes, it was 20 seconds to rotate at 10 steps per second. so it's a 1.8 degree at 200 pulses a second.

i have other questions now
when i set the stepper.setSpeed(); to too low of a number (below 500 or so), the motor is very jumpy and sort of makes noises and has almost no torque. why is this? i'm just using an h-bridge, would an EasyDriver or something like that help this? do motor drivers help because they do microstepping, thus making the motor rotate smoother?

if i make the flash into the steps does this mean i have to do this in the stepper library? or just write my own code? is there anywhere you recommend where i could learn to write code for a stepper? everything i've found through google is so so confusing and more for robots/printers and not just setting smooth rotations.

thanks again!
18  Using Arduino / Project Guidance / Re: code with zoetrope with stepper on: June 04, 2013, 12:28:28 pm
thanks so much for the help.

where is a good place to start where i could learn how to write my own stepper code? everything out there that i've found i don't understand because i just simply want to control RPM. would an easy driver from sparkfun help? or you think it's better to use this h-bridge?

how do i find out how many steps per rotation i have?

i can't find the datasheet to my stepper anywhere. it's a moons stepping motor 17HD4063-01N, bipolar, the regular 40mmx40mm ones if that helps at all...4 wires.

thank for any more feedback!
19  Using Arduino / Project Guidance / code with zoetrope with stepper on: June 04, 2013, 12:00:45 pm

i posted about this earlier and have gotten a little further along.

basically, i have a 3D print of 15 different guys in different positions walking. I am spinning them around in a 2way mirror box with an array of LEDs flashing. I am using a bi polar stepper motor with this configuration: but I'm using the accelStepper library instead of the arduino stepper library.
this is my first time using a stepper so i'm very much in the dark with how to control it.

the problem is, is that i can't seem to time the motor RPM and the LED flashing perfect enough to get anything other than a blur.

what would be ideal is if I can know the exact RPM of the stepper. I have the speed set to 600. Can I assume this is 60 RPM? how would I know?
why do i need to set a max speed with the motor for it to work?

the reason i want to know the exact RPM is because, since i have 15 different positions to animate, i assume if i flash the LEDs 15 times per rotation i will get a zoetrope effect.

any ideas? thanks so much for any guidance!

#include <AccelStepper.h>

AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5, i changed to 8,9,10,11

const int ledPin =  13;     

int ledState = LOW;           
long previousMillis = 0;       

long interval = 25;           

void setup()

    pinMode(ledPin, OUTPUT);     

   stepper.setMaxSpeed(1000);  //why do i need to set this?
   stepper.setSpeed(600);  //is this at 60RPM?

void loop()

//run stepper

//blink LEDs
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;   
    if (ledState == LOW)
      ledState = HIGH;
      ledState = LOW;
    digitalWrite(ledPin, ledState);

20  Using Arduino / Project Guidance / Re: zoetrope on: May 27, 2013, 10:40:39 am
ah thanks. i blew out my other easy driver but now i ordered that bigger one so hopefully i won't have the same problem any more
21  Using Arduino / Project Guidance / zoetrope on: May 27, 2013, 09:32:02 am

i want to make a 3d zoetrope using a pulsing LED array and a stepper motor so I can get a precise RPM. I do not have much experience with stepper motors so my only question right now is what would be a good place to start? I have a few good bipolar ones laying around but no drivers. I was going to get a few of these:

Will those enable me to get a smooth and endless 360 degree rotation?

thanks so much for any feedback
22  Using Arduino / General Electronics / Re: stepper motor question on: May 25, 2013, 08:43:22 am
thanks so much for the help. i tried the sample code and nothing happened. i think that the board/motor are fried. it came with an arduino also and the arduino was fried so i guess whatever happened to it also ruined the motor driver. i also tried it with enable on HIGH and reaction at all.

what driver would you recommend to start out with for a stepper? i always have such a hard time with these things....i just want to spin something around. i don't need any precision. just want to use a stepper because they are quieter and smaller than a dc motor.

23  Using Arduino / General Electronics / stepper motor question on: May 24, 2013, 03:10:05 pm
i recently was given one of these old stepper motor drivers:

it has a STEP/DIR/ENABLE type of interface if that means anything (doesn't really to me)

I think it might have been fried...but the light turns on when i give it 12v.

i have never in my life been able to get a stepper motor working. but this driver seems easy enough. i have the step pin, direction pin and enable pin hooked up to my arduino and am powering the driver with a 12v .8 amp wall wort. it's a bipolar motor.

i don't really know what i'm doing when it comes to programming this. I have the enable pin on LOW, the direction pin on HIGH (i don't care what direction it goes in) and then i've been trying different configurations with the step pin but i'm not getting anything at all out of the motor.

any suggestions? i can't find any tutorials on this old makerbot driver this point i just want to see if i can get the stepper to move!

thanks for any help!
24  Using Arduino / General Electronics / Re: stumped by this LED array on: March 22, 2013, 02:49:57 pm
6 of the LEDs are in series....2 are parallel right now sharing the same resistor so you're both right  smiley

so I'll put in separate resistors for the 2 that are in parallel...but this tutorial says you only need's totally wrong?
25  Using Arduino / General Electronics / Re: stumped by this LED array on: March 22, 2013, 09:23:26 am
thanks so much for all the is a png of what i had wired up:

it's controlled by a tip120 with a diode and a 1k resistor going to the arduino pwm pin.

now what i have is the last two LEDs aren't in series...they're in parallel...with one 120ohm resistor for both, 1/2 watt, which is definitely overkill but i don't want to burn them out again. they are just slightly dimmer than the others that are in series. It's been working fine for a few hours but i do need this to work for around 7 hours a day for a month. you think it'll be okay?

thanks so much for the help
26  Using Arduino / General Electronics / Re: stumped by this LED array on: March 21, 2013, 12:01:25 pm
i'm just using one works fine for the other 6 LEDs. currently everything is working it's just I have those two weird LEDs wired up wrong. Both + sides are in 9v rail and both - sides are in the 33ohm resistor, into the transistor's GND rail. Does anyone know why/if this is bad? it's been working fine for the past 30 minutes, pulsing away. thanks for the help!

edit: both LEDs just fried. what is going on????????
27  Using Arduino / General Electronics / Re: stumped by this LED array on: March 21, 2013, 10:55:16 am
no broken wire as the wires work fine when configured differently...also i tested the wire connections with a multimeter...everything seems normal.
28  Using Arduino / General Electronics / stumped by this LED array on: March 21, 2013, 10:45:43 am
I am controlling 8 LEDs in an array (these: through a TIP120 and an arduino...doing PWM on them. They are powered by a seperate 9V wall wort. There are two for each resistor, 33ohm 1/ 4 resistors in all. I used an LED calculator to make the array. (this one:

it goes: 9V to positive end of LED, negative end of same LED to positive end of next LED, negative end of this LED through resistor, resistor goes into a ground controlled by TIP120. repeat 4 times.

It's working fine except for two of the eight are not working and I'm not getting any multimeter reading on their wires. However, when I mix the wires, use the power from one and gnd from other, I get light. But I don't get any power the other way around. I redid the whole thing and still getting the same.  this is so weird and I'm very stumped. Why would just 2 not be working even though they are wired exactly the same as the other 6? any ideas? thanks!

also: these two lights in the array WILL work if I wire them up like this:
both + sides are in the 9V rail, both - sides are in the resistor that goes to the GND controlled by tip120

could I do this or this wouldn't be good in the long run, right?
29  Using Arduino / Programming Questions / Re: reading SPST button on: March 09, 2013, 02:03:26 pm
i click the button, press it, it goes in. it's an spst button, so it's either high or low.

not sure about the's a 10k resistor going to ground on the same connection where the button goes into the arduino.

i changed some of the code, but one more logic type switch "int ignore=0;" and everything seems to be working great now.

//1 - 5v in arduino (red)
//2 - 10k pull up resistor and to PIN 2 (orange)
//3 - GND (brown)

int speaker = 13;
int relay = 12;
int led = 10;
int button = 2;
int ignore = 0;

int buttonState = 0;
int lastButtonState = 0;

int brightness = 0;
int fadeAmount = 3;

int debouncer = 0;

void setup() {
  pinMode(button, INPUT);
  pinMode(speaker, OUTPUT);
  pinMode(relay, OUTPUT);
  pinMode(led, OUTPUT);

void loop() {
buttonState = digitalRead(button);
if ((buttonState != lastButtonState)&&(ignore == 1)) {
  debouncer = 1;

if (debouncer == 1) {
  tone(speaker, 500, 1000);
  tone(speaker, 500, 500);
  digitalWrite(relay, HIGH);

//write a loop that fades an array of 12V LEDs on tip120s for 15 min
//and meanwhile the button is deactivated

for (int i = 0; i<30000; i++){ //was 333 for 10 sec...30k is 15min
  analogWrite(led, brightness);
  brightness = brightness + fadeAmount;
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount;
//turn off relay and wait for another push
  digitalWrite(relay, LOW);
  digitalWrite(led, LOW);
  debouncer = 0;
  ignore = 0;

else {
debouncer = 0;
ignore = 1;

lastButtonState = buttonState;

30  Using Arduino / Programming Questions / Re: avrdude: stk500_getsync(): not in sync: resp=0x00 on: March 09, 2013, 11:36:12 am
I don't know much, but almost every time I get this error it's because I have a fried the IC (atmega 328p) if the uno is one where you can pull out the chip, and you have extra, you could put one in and see if that fixes it ( Almost always does for me. Another possibility maybe double check you have the right board selected in the menu, try uploading default programs that you know work, etc...
Pages: 1 [2] 3 4 ... 10