Show Posts
Pages: 1 ... 4 5 [6]
76  Forum 2005-2010 (read only) / Interfacing / Grasshopper to Arduino on: July 24, 2009, 01:18:19 pm
Hi guys,
I'm pretty new to the arduino, but I have a project that I'm working on that I was hoping to get some help on.  Basically, I'm trying to control the arduino by feeding information from Rhino's Grasshopper plugin.  Grasshopper is a parametric modeling program for Rhino, and I've already created a VB.net definition (with some help from Luis Fraguada) that can send data from Grasshopper to Processing via Udp.  For this method, I was using a Udp Library written by Stephane Cusot.  However, I'm having problems using the same method to send the data to an Arduino compiled file.  I did a search on here and found that Björn Hartmann has a library that seems to be what I need to load, however... I'm having some issues getting the library to be recognized, and then how to modify my arduino file to receive the data.  
As a test project, I just want to send numeric data from Grasshopper (controlling the rotation of an arm) to the arduino file which will rotate a motor in real-time.  If you guys have any suggestions, please let me know.   Thanks and I look forward to being a part of this community.
77  Forum 2005-2010 (read only) / Interfacing / Re: Nintendo DS Touchscreen + Arduino problem on: September 18, 2010, 10:27:12 am
Well, I decided to try to not use the breakout board and to just try to solder some wires to the connection strip... but I messed it all up so now that one is worthless.  I'm going to have to try to order another one and try again.  Has anyone figured out a better solution than tape or soldering wires to those little connections on these Sparkfun touchscreens?
78  Forum 2005-2010 (read only) / Interfacing / Re: Nintendo DS Touchscreen + Arduino problem on: September 18, 2010, 09:39:31 am
You know... I actually removed the code at the bottom which limits printing the touch values unless the values are between 0 and 1000 (per Richard's suggestion) and I now do actually get some numbers being printed to the port.  The problem is that they are always somewhere above 1000 (the Xpos is always around 1013 and the Ypos is 1023).  No matter where I touch on the board those are the same numbers being sent to the port.  Any ideas?
Thanks for all the help.
79  Forum 2005-2010 (read only) / Interfacing / Re: Nintendo DS Touchscreen + Arduino problem on: September 18, 2010, 09:32:12 am
Oh yeah... I forgot to mention that I did uncomment out the line at the top of the loop that prints the "on" statement just to see if I was getting something coming over the serial port...and that all works fine.  I'm just not getting any of the Xpos and Ypos variables coming over.
80  Forum 2005-2010 (read only) / Interfacing / Re: Nintendo DS Touchscreen + Arduino problem on: September 18, 2010, 09:29:23 am
My mistake Mowcius.  Thank you for the correction.  I went back and resoldered the break out board (because Richard rightly stated that I had soldered it backwards).  So, I soldered a new header on it just as it shows on the image on TmTgr's page.  I also double checked all my wires.  I have y1 going to Dpin5 and Apin3, x2 going to Dpin4 and Apin4, y2 going to Dpin3, and x1 going to Dpin2... and yet I still doing get anything coming over the port.  My setup looks exactly like the images on TmTgr's page.  I'm not sure where I'm going wrong.  The only thing I can think of is that either I have a faulty touchscreen, or somehow I'm not actually getting a good connection with the breakout board.  I wish I had known ahead of time that the slot takes a 0.3mm strip and not the 0.1mm that comes on this touchscreen.  Is my tape 'bandaid' causing any problems?  I guess I could really try to cut it up and try to resolder wires directly to it... but I only want to do that as a last resort.  Any other ideas?
81  Forum 2005-2010 (read only) / Interfacing / Nintendo DS Touchscreen + Arduino problem on: September 18, 2010, 07:48:56 am
I just bought one of the Nintendo DS touchscreens (http://www.sparkfun.com/commerce/product_info.php?products_id=8977) off of sparkfun and the break out board for it as well... but I can't seem to get it to work.  I've seen many of the tutorials on here and on another site... I'm mostly looking at this tutorial (http://tmtgr.blogspot.com/2010/06/using-nintendo-ds-touchscreen-with.html), but still I can't get anything to show up on the serial port.  First, here are my issues.  I bought the break out board thinking that since Sparkfun said they were compatible that they would work... they do not.  Turns out the break out board is looking for a 4 wire connection that is 0.3mm thick... but the actual Nintendo DS strip is only 0.1mm thick, so it when I first put it in the slot, it would continually just fall out.  So, I added two layers of fine tape to the back side (non copper side) to thicken the strip a little bit and it seems to connect better... but I'm not sure if this was the wrong thing to do or not.  Other people on here have actually just cut the strip and soldered wires directly to them, but I don't think I have any hook up wire small enough for this connection (it's incredibly small).  Then the code I'm using is pretty much straight from that tutorial.  All I'm trying to do is to print the X and Y positions to the serial port.  Here's an image of my hardware setup http://www.flickr.com/photos/30229089@N08/5001190934/.  Does anyone know what I'm doing wrong?  I don't get anything showing up when I open the serial monitor.  The code I'm using is below.  Any comments would be greatly appreciated.  
Thanks again,
Andy

Code:
//Code originally written by TmTgr http://tmtgr.blogspot.com/2010/06/using-nintendo-ds-touchscreen-with.html
// Digital connections (used to drive power)
#define Lo 2 // LEFT to digital output 2
#define Bo 3 // BOTTOM to digital output 3
#define Ro 4 // RIGHT to digital output 4
#define To 5 // TOP to Digital output 5

// Analog connections (used to read the touch position)
#define Ti 3 // TOP also to analog input 3
#define Ri 4 // RIGHT also to analog input 4



// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
// set initial touched position
int touchX = 0;
int touchY = 0;
boolean wasTouched = false;
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


void setup()
{
  Serial.begin(9600);
}

void loop()
{    
  //Serial.println("on");
  if (touched())  //if the screen is touched then...
  {
    //if (!wasTouched)
    //{
      //Serial.println("on");
    //}
    Serial.print(touchX);
    Serial.print(" ");
    Serial.println(touchY);
    wasTouched = true;
  }
  else
  {
    wasTouched = false;
  }
}

// return TRUE if touched, and set coordinates to touchX and touchY
boolean touched()
{
  boolean touch = false;

  // Horizontal routine - set L to gnd and R to Vcc
  // set L = ground
  pinMode(Lo, OUTPUT);
  digitalWrite(Lo, LOW);
  // set R = Vcc
  pinMode(Ro, OUTPUT);
  digitalWrite(Ro, HIGH);
  // T e B high impedance (input mode)
  pinMode(To, INPUT);
  pinMode(Bo, INPUT);
  // wait a bit, then read from Top
  delay(5);
  touchX = analogRead(Ti);

  // Vertical routine - set B to gnd and T to Vcc
  // Set B = gnd
  pinMode(Bo, OUTPUT);
  digitalWrite(Bo, LOW);
  // set T = Vcc
  pinMode(To, OUTPUT);
  digitalWrite(To, HIGH);
  // R e L high impedance (input mode)
  pinMode(Ro, INPUT);
  pinMode(Lo, INPUT);
  // wait a bit, then read from Right
  delay(5);
  touchY = analogRead(Ri);

  // Only read touch if coords are below 1000 and above 0 (stops errors with certain screens)
  if(touchX < 1000 and touchX > 0 and touchY < 1000 and touchY > 0)
    touch = true;

    return touch;

}

82  Forum 2005-2010 (read only) / Interfacing / Re: Wheel Potentiometer on: September 08, 2010, 07:32:32 am
Thanks for the help.  The device I'm making doesn't have to be all that precise (I'm thinking more in the line of an instructable).  It's definitely in prototype phase.  I think I'll try the trim pot suggested above, but if those fail, I'll try an optical shaft position encoder.  Anyone know where to get one of those?
83  Forum 2005-2010 (read only) / Interfacing / Re: Wheel Potentiometer on: September 06, 2010, 04:06:27 pm
That's perfect.  Thanks for the advice.  You mentioned that you thought it was a log device... I'm guessing this will make it more difficult to find the exact angle (or position) of the pot because I can't use a linear correlation... hmm. I'll have to think about that one.  Thanks for the hookup suggestion.
Cheers,
Andy
84  Forum 2005-2010 (read only) / Interfacing / Wheel Potentiometer on: September 06, 2010, 03:53:36 pm
I'm thinking about making a forward kinematic arm (sort of like a microscribe - http://microscribe.ghost3d.com/gt_microscribe.htm) and I need to find a way to determine the angle between each leg.  My thought had been to use a potentiometer at each joint, and just convert the analog value into rotational degrees using a little math.  I found these really small wheel potentiometers at radio shack (http://www.radioshack.com/product/index.jsp?productId=3064080) that look like they could do the trick, but they have 5 pins instead of the typical 3 that I'm used to (Gnd, 5V, and pin).  I believe these wheel pots are generally used for audio control, but I'm wondering if you guys can help me figure out how to wire it up (ultimately, I'm hoping it works just like a standard pot in that it returns a value between 0-1023).  In the comments section, I noticed one poster states:

Place it with the pins pointing down and the 5-pin edge facing toward you. From left to right, the pins are:

1) Common (GND for audio use)
2) R1 Wiper (Out 1 for audio)
3) R2 Wiper (Out 2 for audio)
4) R2 End (In 2 for audio)
5) R1 End (In 1 for audio)

The only thing is that I'm not using it for audio.  Is there a way I can wire this to just return a single value?  Thanks in advance for the help.
Pages: 1 ... 4 5 [6]