Show Posts
Pages: 1 ... 18 19 [20] 21 22 23
286  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 26, 2010, 07:56:09 pm
Quote
did it originally come with an adapter?
yea, it came new with it. it was even already on the end of the cable.
287  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 26, 2010, 06:18:17 pm
i'm using this code http://www.arduino.cc/playground/uploads/ComponentLib/mouse.txt from this tutorial http://www.arduino.cc/playground/ComponentLib/Ps2mouse.
I'm using the same pins and wired it the same way etc. the data i get back is always "1000 x=0 y=0" while moving the mouse around. the mouse is USB and optical but has a USB2PS2 adapter on it.
288  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 26, 2010, 05:33:41 pm
the code from the recent tutorial isn't working. there should be a way to tap into the chip directly. I tried to look it up but couldn't find anything.

289  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 26, 2010, 01:37:45 pm
well the bottom line is that I'm trying to find the path of least resistance that results in a small optical trackball replacing the right thumb stick.

a regular optical mouse and an optical trackball mouse are essentially the same. they are just used differently. a trackball would be preferred because if it is small enough you can put it in place of the thumb stick. with a regular mouse you have to do more work relocating all of the controller right side buttons to the mouse since your hand won't be on the right side of the controller anymore.

i went out to radio shack a minute ago and got a cheap optical trackball mouse with a PS2 adapter on the end. this other tutorial http://www.arduino.cc/playground/ComponentLib/Ps2mouse looks a little better. I think i can just solder lead wires on the end of the PS2 cable and plug them into the arduino
290  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 26, 2010, 12:44:06 pm
Quote
Assuming you have access to the opto-interrupters, you need four inputs, two from each axis. Then you need some code to interpret the meaning of the pulse sequence and timing.  See Grumpy_Mike's tutorial: http://www.thebox.myzen.co.uk/Workshop/Rotary_Max.html

that article went over my head as usual. this tutorial looks helpful http://www.martijnthe.nl/2009/07/interfacing-an-optical-mouse-sensor-to-your-arduino/

Quote
You aren't changing the requirements yet again, are you?
nope. when the ball is moving right the joystick is moving all the way right. it should work just fine once it is all hooked up and programmed. after I figure out the details..
291  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 26, 2010, 12:03:25 pm
hey how would I integrate a trackball mouse (one of those stationary mice that has a ball facing up that you roll around with your hand) into the existing circuit?
292  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 26, 2010, 01:52:48 am
Quote
I bet most of your latency would be eliminated by upping that to 115200 or something
actually that did get rid of about half of it. it still over aims though. even thought the video is running at 30fps there is still about a half second lag. anyone know how to bring analog video to an ADC so it can be processed on an FPGA?
293  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 11:53:51 pm
Quote
well at 9600 you would think that is fast enough but your delaying the process a considerable amount, I bet most of your latency would be eliminated by upping that to 115200 or something
i'll try it but there is also some at the image processing end so either way i'll have to implement a new alg to take care of it.
294  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 10:25:07 pm
nah, everything works fine. still too much latency but that's not the fault of the circuit we just made. I've got another idea on how to solve that problem.
295  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 06:47:42 pm
ok that example had way too much extra stuff in it. take a look at this code I put together and let me know if it looks ok. It should be really easy to follow.

Code:
int inByte = 0; //variable for incoming data

void setup() {
  
  //outputs for controlling the X and Y axis POTs
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
  //aim at center X initially
  digitalWrite(13, HIGH);
  digitalWrite(12, LOW);
  //aim at center Y initially
  digitalWrite(3, HIGH);
  digitalWrite(2, LOW);
 
  // begin listening
  Serial.begin(9600);
}

void loop(){
    
  if(Serial.available() > 0){

    inByte = Serial.read();

    switch (inByte) {
      case 1:                     // X axis
        //aim left
        digitalWrite(13, LOW);
        digitalWrite(12, LOW);
        break;
      case 2:
        //center stick
        digitalWrite(13, HIGH);
        digitalWrite(12, LOW);
        break;
      case 3:
        //aim right
        digitalWrite(13, HIGH);
        digitalWrite(12, HIGH);
        break;
      case 4:                      // Y axis
        //aim up
        digitalWrite(3, LOW);
        digitalWrite(2, LOW);
        break;
      case 5:
        //center stick
        digitalWrite(3, HIGH);
        digitalWrite(2, LOW);
        break;
      case 6:
        //aim down
        digitalWrite(3, HIGH);
        digitalWrite(2, HIGH);
        break;
      case 7:                      // X and Y axis combinations
        //aim up and left
        digitalWrite(13, LOW);
        digitalWrite(12, LOW);
        digitalWrite(3, LOW);
        digitalWrite(2, LOW);
        break;
      case 8:
        //aim up and right
        digitalWrite(3, LOW);
        digitalWrite(2, LOW);
        digitalWrite(13, HIGH);
        digitalWrite(12, HIGH);
        break;
      case 9:
        //aim down and left
        digitalWrite(13, LOW);
        digitalWrite(12, LOW);
        digitalWrite(3, HIGH);
        digitalWrite(2, HIGH);
        break;
      case 10:
        //aim down and right
        digitalWrite(13, HIGH);
        digitalWrite(12, HIGH);
        digitalWrite(3, HIGH);
        digitalWrite(2, HIGH);
        break;        
    }
  }
}

296  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 05:50:36 pm
Quote
the microcontroller on the arduino is connected to the usb <> ttl serial chip, you should be able to send whatever you want to the com port that shows up on your computer via program or etc
ok great. is there example for this? i found this but it doesn't look like it is what I'm after. http://www.arduino.cc/en/Tutorial/SoftwareSerial
297  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 05:41:38 pm
if you guys have a donation page I can donate $20 for helping.

I was looking around and can't find an example for sending data to the arduino with the usb cable. I don't want to use the RX TX pins. there should be a way for the arduino to listen for commands through the USB interface.

to clarify, my program is in C#. I want to send data through the USB COM port to the arduino which will interpret it and adjust the POTs accordingly.
298  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 04:42:30 pm
now that I finally followed you instructions correctly it works great. it is amazing and inexpensive just how i like it.

here's the test code. of course it is not the final code. I have to look up serial input etc but i'll do that later
Code:
void setup() {
  
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
  //aim at center X
  digitalWrite(13, HIGH);
  digitalWrite(12, LOW);
  //aim at center Y
  digitalWrite(3, HIGH);
  digitalWrite(2, LOW);
}

void loop(){
    
  delay(1000);
  //left
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  delay(1000);
  //center
  digitalWrite(13, HIGH);
  digitalWrite(12, LOW);
  delay(1000);
  //right
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  delay(1000);
  //center
  digitalWrite(13, HIGH);
  digitalWrite(12, LOW);  
  
}

and here's a pic of the second working prototype:
299  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 03:28:43 pm
ok I took your advice more specifically. see the attached pic. does it matter which way the pot is wired to it? is ther a + and - to the pot? or can it go either way?

300  Forum 2005-2010 (read only) / Interfacing / Re: I need to convert PWM analog out to TRUE analogOut on: September 25, 2010, 02:40:33 pm
i read it and looked at the page you linked to. no idea what i'm looking at though. i'll go back to radio shack and get some PNP transistors and also some MOSFETs while I'm there. I'm determined to get this working.
Pages: 1 ... 18 19 [20] 21 22 23