Show Posts
Pages: [1]
1  Using Arduino / Motors, Mechanics, and Power / Stepper motor control and Stepper library on: September 03, 2014, 01:11:02 pm

I'm thinking I am controlling a unipolar stepper motor just fine with some brute force code I modified to do half steps. ( attached as brute_Half_Step) it spins the motor smoothly around. However, using stepper_oneStepAtATime, the same setup doesn't spin. If I change the pins by swapping 9&10 in the declaration, the motor spins like it should. I really don't understand if the wiring is different. Why would they operate differently, any suggestions? I feel like I am missing something very obvious.
2  Using Arduino / Sensors / Re: IR Detect example and not getting it.. on: December 06, 2012, 11:26:51 pm
So I also have held a remote above the receive diode. Occasionally I get a 1 to switch to a 0. I'm seeing multiple people on this forum with IR sensing questions but I'm not seeing anyone say they have something working. I just want to hook up three IR LED and three detectors to determine which way someone is waving their hand over the array. Does anyone have any ideas what I am not doing right?
3  Using Arduino / Sensors / Re: IR Detect example and not getting it.. on: December 04, 2012, 11:36:26 pm
Ok, I am still stumped. Does anyone know if this example works?] ?

Because I have put this on a little breadboard, hooked it up to the basic stamp and it's fine. Take that same breadboard and hook up to the Arduino and it's always a 1 for output. I read through the example and logically it is fine. I put a scope on the input to the IR LED and it's certainly a nice little pulsetrain, but that output from the photodetector never changes. It will change if I unplug it from the sensor and ground it, then it's a zero. Are there some internal pullups in the micro that I am not overcoming? Any ideas will be welcomed. Thanks.
4  Using Arduino / Sensors / Re: IR Detect example and not getting it.. on: December 02, 2012, 09:56:06 pm

I put it on a scope and saw the parallax one was up in the 80-90kHz range, so I changed this one to make it about 80kHz, that half period makes it close to 85kHz and the 70 cycles is to make it 1 millisecond overall duration with the faster pulse train. This is one of the desperate things I tried. Thanks for looking so close.
5  Using Arduino / Sensors / IR Detect example and not getting it.. on: December 02, 2012, 08:53:59 pm
Hi all,

I am using, trying to use the simple IR distance tutorial. [url][/]
It's not working and here's what I am not getting. I had a basic stamp board nearby, and tried the same method of bit banging, a 38kHz pulsetrain on it. That one works like a champ, I can wave my hand over the IR LED and the output changes very easily. I put it on a little breadboard and then I hook it up to the Arduino Uno I have and the output never changes, meaning the sensor never sees the IR signal. I was wondering if maybe there was something with passing the variable back from the subroutine, so I tried the attached rewrite, but nothing changes.
I have tried changing from pins 4 and 5 per the demo to other pins with no effect. I also changed the digitalread to a analogread, but the analog value hovers around 1023. I am using the recommended parallax circuit as well, with 220 Ohm resistor  for the detector and a 1K for the IR LED. I have also switched around the IR LED, in case the long leg isn't the anode.  I have taken apart the circuit a couple times too. I also have used it in the dark, thinking maybe I am having IR soak from something else. Of course the Parallax circuit hasn't had those issues and it is right next to this one. Anyone have any ideas? This should be simple but I think I have spent about 3-4 hours and it's not getting better.
[///define pins. I used pins 4 and 5
#define irLedPin 3          // IR Led on this pin
#define irSensorPin 5       // IR sensor on this pin
//int irRead(int readPin, int triggerPin); //function prototype

void setup()
  pinMode(irSensorPin, INPUT);
  pinMode(irLedPin, OUTPUT);
  delay (3000);  // time to start serial window.
  // prints title with ending line break
  Serial.println("Program Starting");
  // wait for the long string to be sent

void loop()

delay (100);
//  Serial.println(irRead(irSensorPin, irLedPin)); //display the results
//  delay(10); //wait for the string to be sent
int halfPeriod = 3; //one period at 38.5khZ is aproximately 26 microseconds
  int cycles = 70; //26 microseconds * 38 is more or less 1 millisecond
  int i;
  for (i=0; i <=cycles; i++)
    digitalWrite(irLedPin, HIGH);
    digitalWrite(irLedPin, LOW);
    delayMicroseconds(halfPeriod - 1);     // - 1 to make up for digitaWrite overhead   

  int state = digitalRead(irSensorPin);
  Serial.println(state); //display the results


 * This function can be used with a panasonic pna4602m ir sensor
 * it returns a zero if something is detected by the sensor, and a 1 otherwise
 * The function bit bangs a 38.5khZ waveform to an IR led connected to the
 * triggerPin for 1 millisecond, and then reads the IR sensor pin to see if
 * the reflected IR has been detected
Pages: [1]