<< return to Pixycam.com

Control a robot with Labview

Hi,
For a project I want to control a Robot arm by a Pixy2, my robotarm can be only controlled by a Labview connection, so I connected the Pixy2 to an Arduino Uno with the ICSP port, to send the XY cordinates to the Labview programm, but I don’t know how to find the ICSP Port on the Labview, I made a connection to the Arduino but I don’t know how to connect the Labview with the Pixy2.

Am I doing this wrong? Should I connect the Pixy2 directly to the Labview, is this possible? and then connect the labview to my robot to send the directions ? if yes, how should I make a connection to Labview. I am a biggner in all this so i hope you can help me.

Hello,
Using Pixy with LabView sounds like a challenge! :slight_smile: You could possibly make LabView speak the Pixy protocol through one of the serial ports (UART, i2c, or SPI). I’m assuming you have a UART serial on your computer. If not, you can add one via USB. Can you send data through a COM port in LabView?

Information on the serial protocol can be found here;
https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:porting_guide

Edward

Hey,
thanks for your respond.
i am not sure but i could make a connection to the Arduino thrugh LabVIEW(LW), i am not sure how to do this.
should i connect the Pixy2 to an Arduino and make the connection by an Arduino to a LW or should i connect the Pixy directly?
if there is any similer projekt you know about, can you please forword the link so i can get an idea?

A connection between Arduino and LW can be done, but if i am connecting the Pixy2 to the ICSP on Arduino how should i chose this i can only select Pins on LW and not the ICSP Port.

i am a bit lost in all this new connections and platforms that i have to learn and try and connect :’)

SO after trying to understand all the points.
what i have found out with the link you send to me and another searchs, i have to connect the Pixy to the arduino by UART connection not by ICSP becuse i can’t get the Labview read the data from the Pixy through the ICSP.
is this correct? :smile: if yes, i couldn’t understand what pins have to use on my Arduino for the connections. how should i make the program for labview, like what pins should the Labview read to get the X and Y corrdinates ? and if there is a Code to programm the Arduino for it in any library, please let me know, i have the pixy library on my Arduino IDE.

Thank you very much for your help.
it is starting to be fun :partying_face:

Hello,
You can connect your Pixy to an Arduino. This page describes how to get started:

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:hooking_up_pixy_to_a_microcontroller_-28like_an_arduino-29

Since Labview runs on a PC I was thinking that one way for Labview to talk to Pixy is over a COM port on your PC. You can get a USB to UART converter, which creates a new COM port:

https://www.sparkfun.com/products/13830

You could then talk to Pixy (in theory) with Labview by sending and receiving bytes over the COM port using the protocol guide.

Alternatively, you could use an Arduino as a middle-man (somehow). It seems to me, you still need to bridge Labview to your Arduino, and again, it would probably involve a COM port (serial port).

Hope this helps.

Edward

Hello,

the problem is that there is no library for pixy2 on LabVIEW, so i have to use the Arduino as a middle-man to get the connection, as i have found a library for Arduino on LabVIEW.
there is only a library for Rio.

so the best way is to get this that way, unless you can provide me an other solution or a library for LabVIEW and Pixy2.

if i want to connect the Arduino with LabView it has to be by an COM Port and i allready succeed, this my problem is that on the LabVIEW if i want to call the Pixy through Arduino, i can’t because it is connected with the supplied cable through ICSP port, and i can only choose on LabVIEW the Pins nummbers, no ports so i can’t conntact the Pixy2 because it is connected to ICSP.
but u told me i can connect it by UART so through the Pins on Arduino, this way i can make the commands on LabVIEW through the Arduino to the Pixy2, right?

but which Pins can provide me the X and Y information that i need?
i have seen on the links that i have to read the date from the TX Pin, is this right?

i wrote this code for the Arduino, is this ok too?

#include <Pixy2UART.h>

Pixy2UART pixy;

void setup()

{

Serial.begin(115200);

Serial.print(“Starting…\n”);

pixy.init();

}

void loop()

{

int i;

// Daten von der Pixy2-Kamera abrufen

pixy.ccc.getBlocks();

// Wenn Blöcke erkannt wurden, sende sie über die serielle Schnittstelle an LabVIEW

if (pixy.ccc.numBlocks)

{

Serial.print("Detected ");

Serial.println(pixy.ccc.numBlocks);

for (i=0; i<pixy.ccc.numBlocks; i++)

{

  Serial.print("Block ");

  Serial.print(i);

  Serial.print(": ");

  Serial.print("X: ");

  Serial.print(pixy.ccc.blocks[i].m_x);

  Serial.print(" Y: ");

  Serial.println(pixy.ccc.blocks[i].m_y);

}

}

}

#include <Pixy2UART.h>
Pixy2UART pixy;

void setup()
{
  Serial.begin(115200);
  Serial.print("Starting...\n");
  
  pixy.init();
}

void loop()
{ 
  int i; 
  // Daten von der Pixy2-Kamera abrufen
  pixy.ccc.getBlocks();
  
  // Wenn Blöcke erkannt wurden, sende sie über die serielle Schnittstelle an LabVIEW
  if (pixy.ccc.numBlocks)
  {
Serial.print("Detected ");
Serial.println(pixy.ccc.numBlocks);
for (i=0; i<pixy.ccc.numBlocks; i++)
{
  Serial.print("Block ");
  Serial.print(i);
  Serial.print(": ");
  Serial.print("X: ");
  Serial.print(pixy.ccc.blocks[i].m_x);
  Serial.print(" Y: ");
  Serial.println(pixy.ccc.blocks[i].m_y);
}
  }
}

Hello,
If you want to communicate with the Arduino via Labview, you can use the Arduino as a middle-man. That is, the Arduino talks to PIxy and the forwards the information to Labview.

You have to write the protocols between labview and the Arduino, however.

There are lots of details here that are beyond the scope of this forum…

The Arduino code you provided is for communicating with Pixy via UART serial. Please refer to this link:

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:hooking_up_pixy_to_a_microcontroller_-28like_an_arduino-29

It describes hooking your Pixy to Arduino using the cable that came with your Pixy. (It uses SPI (ICSP port) communication instead of UART). It’s the easiest way to get your Arduino talking to your Pixy.

Edward