Show Posts
Pages: 1 [2] 3 4 ... 7
16  Forum 2005-2010 (read only) / Interfacing / Re: unable to read ir sensor value on: November 24, 2009, 07:14:48 pm
Use a digital camera to tell if the IR LED is functioning at all.  The CCD is sensitive to IR wavelengths and it will show you the LED lit if it is.
17  Forum 2005-2010 (read only) / Interfacing / Re: unable to read ir sensor value on: November 24, 2009, 06:43:33 pm
Could it be that you've placed the IR LED in the place of the IR Transistor?  In a lot of cases they do look similar.  
18  Forum 2005-2010 (read only) / Interfacing / Re: Target following? on: January 05, 2010, 11:20:15 am
Or you could use an IR Detector placed inside of a short length of opaque tube.  When the bot does not detect the IR strobe, it rotates until it does, then drives forward until the IR strobe again is not detected.  You can enrich the scheme then by placing two more sensors to the left and right of the "center" sensor.  This will tell you which direction the strobe was traveling when it left the center sensor's field of view, and therefore you know which direction to turn to reacquire it.
19  Forum 2005-2010 (read only) / Interfacing / Re: Target following? on: January 04, 2010, 10:46:43 pm
Place an IR LED beacon on your cat's collar and localize on that?
20  Forum 2005-2010 (read only) / Interfacing / Re: Mouse Scroll Wheel Sensor and Arduino on: December 20, 2009, 03:18:59 pm
Welcome!   smiley-wink
21  Forum 2005-2010 (read only) / Interfacing / Re: Mouse Scroll Wheel Sensor and Arduino on: December 10, 2009, 05:55:57 pm
You should connect it like a switch using a pull down resistor perhaps.
22  Forum 2005-2010 (read only) / Interfacing / Re: Mouse Scroll Wheel Sensor and Arduino on: December 10, 2009, 11:29:37 am
That's odd... the getQuadDir() function will return one of 4 values.  Either 0 (the wheel didn't move), 1 (the wheel moved clockwise), -1 (the wheel moved counterclockwise) or 999 (a pulse was missed).

The loop() function should only print something to the terminal if something has changed (i.e. the wheel has been turned or a pulse was missed).

Now you're going to make me break out an old mouse, tear out the wheel and try it out! ;-)
23  Forum 2005-2010 (read only) / Interfacing / Re: Mouse Scroll Wheel Sensor and Arduino on: December 10, 2009, 06:53:36 am
How about this one:

Code:
/*
Quadrature Example
*/
int quadAPin = 1;
int quadBPin = 2;

int lastQuadValue;

int CLOCKWISE = 1;
int CCLOCKWISE = -1;
int MISSEDPULSE = 999;

void setup()
{
  lastQuadValue = readQuadValue();
  Serial.begin(9600);
}

void loop()
{
  int newQuadValue = readQuadValue();
  int quadDir = getQuadDir(lastQuadValue, newQuadValue);
  
  if (quadDir == CLOCKWISE) Serial.print("Clockwise");
  if (quadDir == CCLOCKWISE) Serial.print("Counter Clockwise");
  if (quadDir == MISSEDPULSE) Serial.print("Missed Pulse Detected");
  
  lastQuadValue = newQuadValue;
}

int readQuadValue()
{
  int val = digitalRead(quadAPin);
  val = val * 2 + digitalRead(quadBPin);
  return val;
}

int getQuadDir(int prevVal, int newVal)
{

  //because the step order is 0, 1, 3, 2 lets do some switching around

  if (newVal == 3)
    {
      newVal = 2;
    }
  else
  {
    if (newVal == 2) newVal=3;
  }

  if (prevVal == 3)
    {
      prevVal = 2;
    }
  else
  {
    if (prevVal == 2) prevVal=3;
  }
  
  int quadDir = prevVal - newVal;
  
  //see if we missed a pulse (i.e. quadDir is 2 or -2)
  if (abs(quadDir) == 2) quadDir = MISSEDPULSE;
  
  return quadDir;
}

I haven't actually tried it, but it should work.
24  Forum 2005-2010 (read only) / Interfacing / Re: Mouse Scroll Wheel Sensor and Arduino on: December 09, 2009, 06:31:00 pm
The answer is "Quadrature".  Here have a look at this:  http://en.wikipedia.org/wiki/Rotary_encoder#Incremental_rotary_encoder

The three contacts serve as two bits, with one contact being common.  With two bits, you have 4 possibilities... 00, 01, 10, 11.  The order they appear in tells you the direction.
25  Forum 2005-2010 (read only) / Interfacing / Re: My next project: laundromat watcher! on: October 27, 2009, 05:34:43 pm
I guess the MOC3010's are sort of the opposite of what you were proposing huh?  
26  Forum 2005-2010 (read only) / Interfacing / Re: My next project: laundromat watcher! on: October 27, 2009, 03:48:56 pm
I always keep a few MOC3010's on hand for just such an eventuality.
27  Forum 2005-2010 (read only) / Interfacing / Re: Switches to control volume on: December 01, 2009, 06:01:24 pm
Or you could sample the switch values and then use that value to set the wiper position of a digital potentiometer chip that served as the volume control of your audio amplifier.
28  Forum 2005-2010 (read only) / Interfacing / Re: please help fast!! on: December 07, 2009, 01:00:46 pm
http://www.onsemi.com/pub_link/Collateral/P2N2222A-D.PDF
http://www.onsemi.com/pub_link/Collateral/2N3903-D.PDF

Note 1,2,3 vs 3,2,1...
29  Forum 2005-2010 (read only) / Interfacing / Re: please help fast!! on: December 03, 2009, 07:57:15 pm
Holy cow they are!  I never noticed that before.  I'm just in the habit of just grabbing the data-sheet to look at before I hook anything up.  I never noticed that they are exactly backwards of one another.
30  Forum 2005-2010 (read only) / Interfacing / Re: I'm Confused DS1307 & LCD on: December 04, 2009, 03:52:40 pm
Sure, use a digital potentiometer.
Pages: 1 [2] 3 4 ... 7