LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Response Time between Labview and Arduino

Good morning,

I am working on my university project and I have some questions I hope you can help me a little bit.

 

A brief description of what I must develop:

Make a real mode based on PONG game from Atari, using artificial intelligence, in my case I am going to use Fuzzy Logic control.

 

Hardware selected and their purpose:

-Arduino UNO R3: read signals from encoders attached to my DC car motors and read/write data processed in Labview fuzzy logic tool.

-USB Camera: Used as input on my fuzzy control, because of this I have installed all Vision toolkits, but for now I am investigating how it works.

-12 VDC Motors: Move the cars of my printer riels (2) according to received & processed packets from Labview in Arduino.

-Sparkfun quadrature encoders: Used to get the position from both cars and interact with Labview giving the second input used in my fuzzy control.

-Kick-pallets: This kicks the ball from one side to other, but this is not part of my control logic, just mechanical.

 

So, the aim is kept the ball in the field avoiding goals, all in automatic mode.

 

I am working first on my encoder readings, not using interrupts, just pulling method, and my first question, anticipating any error is time response between Arduino and Labview enough to do all this processing? considering read position (X, Y) from an object and also reading the encoder data from both motors and then get the processed fuzzy output and send it to Arduino?

 

First test I am gonna make this week is manual movement applicated on one motor, send the digital pin to LV, from LV send a digital output, making both motors move at the same direction, ideally at the same time.

 

I will appreciate your hel and guide, sorry about my english.

 

Best regards,

 

Alberto.

 

0 Kudos
Message 1 of 11
(3,839 Views)

Assuming that the ball speed and direction of travel will be close to linear, a simple predictive strategy to determine where and when the ball will cross the line would work best.

 

If the speed and direction have some degree of unpredictability, then there will be a point where you will experience an inability to keep up.  Where that point is depends on more than just the processing speeds, and communication between Arduino, and your software.

 

Paddle size, Motor ramps (starting and stoping), and how fast you can read the encoder counts need to be looked at.

Machine Vision, Robotics, Embedded Systems, Surveillance

www.movimed.com - Custom Imaging Solutions
0 Kudos
Message 2 of 11
(3,811 Views)

Dear MoviJOHN,

I am agree about the linear response, but I trust this will not be a trouble, well, in my next experiences this will be revealed.

 

But, I am even more worried about time response of Arduino, if does not work, I will need to use another devices such as PIC's, and not so much time left to make this radical decision....

 

Have you ever worked with some similar applications using LIFA? I mean, sending quick data signals (PWM)? How was your experience?

 

Thank you for the answer.

 

Regards.

0 Kudos
Message 3 of 11
(3,798 Views)

Using interrupts for quadrature encoder with LIFA is, in my opinion, the only way to use quadrature encoders.  If you try any other type of polling method then you are at the mercy of all the other code running on the system and is unreliable.  This is even true if you were polling with custom code in the firmware on Arduino.

 

From what I read, it is possible to run two quadrature encoders with only two interrupts.  Ideally, you would want two interrupts per quadrature encoders.

0 Kudos
Message 4 of 11
(3,760 Views)

Nathan_B.,

You are right, I am gonna try it using interrupts, but I am using Arduino UNO board, which means that I just have 2 interrupt pins (2 and 3).

 

Can I read my two encoders just with this board? 

 

Also I have found a special LIFA that you developed for quadrature encoders: https://decibel.ni.com/content/docs/DOC-30184

 

Read both encoders it is very important, because this will be my inputs on my fuzzy control.

 

Thanks.Regards.

 

Alberto.

0 Kudos
Message 5 of 11
(3,729 Views)

Sorry, I have forgot to mention about custom LIFA firmware for quadrature encoders does not compile on my IDE, I need to do something additional?

 

Regards. 

0 Kudos
Message 6 of 11
(3,728 Views)

I just tested compilation with Arduino 1.0.5 and it worked without any modifications.  It's hard to determine why it's not working for you without knowing the errors that you are getting.  If I had to take a shot in the dark, it's possible that if you have an encoder library (by the same name as the one I'm using) installed through Arduino, it could cause issues since I had to modify my version of the library to make it work.

 

IIRC, you should be able to use a single interrupt line for an encoder according to the encoder library but something will probably need to be changed in the firmware to make it work.

0 Kudos
Message 7 of 11
(3,711 Views)

Nathan,

Yes, you were right, I was using a library with the same name, then I removed from Arduino and compilation result successful.

 

Now I have to try to connect both encoders.

 

Thanks for your help!

 

Regards.

 

Alberto.

0 Kudos
Message 8 of 11
(3,702 Views)

Please note that in his whitepaper he says that an Arduino Uno will work with One encoder as the two inputs are dedicated to it.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 9 of 11
(3,694 Views)
Aparras I am having a trouble with compilation and I dont know how to fix it. should I modify the name of encoder library to another name or delet it ?
0 Kudos
Message 10 of 11
(3,595 Views)