Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview (LINX) control stepper motor with raspberry pi 4

Solved!
Go to solution

I try to control a nema 17 stepper motor with Raspberry Pi but i failed. I use LINX Toolkit for connecting my Raspberry pi 4. There is no problem with connection between LabVIEW and Raspberry but despite any error in block diagram it is not control the motor. When the program runs, the event structure does not pass from timeout to start subplot. Please help me. I have also tried using arduino and have been successful.

0 Kudos
Message 1 of 10
(1,682 Views)

Well without additional information, for example your code, I don't think anyone can do anything to help you with your issue.

David Wilt
The New Standard LLC
0 Kudos
Message 2 of 10
(1,674 Views)

I am so sorry, I forgot to add the project vi.

0 Kudos
Message 3 of 10
(1,665 Views)

How are you running the VI?

 

If you are deploying it to the Raspberry Pi then you will not be able to use this architecture in the long run as the Raspberry Pi does not have the Front Panel to allow you to interact with the VI.  It will work for development as you can run the VI from your PC but if you want to run this headless on the Raspberry Pi you will not be able to use Front Panel events.

 

Looking at the code I question if you are actually running your VI as it is set to run while the Stop control is true but if you try to set the Stop control to true and run the VI it exits after the first loop.  Set the While loop stop to Stop if True and your VI should run the way you expect it to.

David Wilt
The New Standard LLC
Message 4 of 10
(1,652 Views)

I am trying your suggestions right now. I tried this program with arduino uno and was able to control the stepper motor. I use the program with my pc. When I try to control it with Raspberry it stays in the timout structure. When I use the start or stop buttons, it does not switch from block diagram timout to start or stop structure. But there was no such problem in arduino.

0 Kudos
Message 5 of 10
(1,634 Views)

When using LabVIEW with an Arduino you do not deploy the VI to the Arduino and have to keep the VI on the PC.  When you deploy to a Raspberry Pi you can run headless so the whole VI is deployed to the Raspberry Pi.  Due to these differences it will behave differently when working with the 2 devices.

 

Please expand on how you are deploying and trying to interact with the VI on the Raspberry Pi.  Additional screenshot of this process will help to understand what you are doing.

David Wilt
The New Standard LLC
0 Kudos
Message 6 of 10
(1,631 Views)

We communicate with the computer via raspberry wifi connection (Local I / O). We do not upload any files to raspberry. We just connect with labview and run vi. Also, we previously controlled raspberry with labview using led blinking vi.

 

Ekran_Alnts.png

IMG_8625.jpg

I add how we deploy the VI in the screenshot. Raspberry and PC communicates with WiFi. First I connect the Raspberry in LabVIEW/LINX and add my VI on the connected Raspberry and Run my VI on the PC then the deployment process work. After that you can see there is no error in error windows and the device name write there. But The GPIO pins of Raspberry not activating. Program always stay in timeout loop.

0 Kudos
Message 7 of 10
(1,618 Views)

Sorry for the late reply, I got caught up in some other tasks.

 

Your issue is you cannot use the Event structure based off Front Panel changes on a deployed VI to the Raspberry Pi.  VIs run without Front Panels on the Raspberry Pi so the Event is never being triggered.  You need to use a different method to interact with the VI like polling a button.

 

You probably want to have 1 run button.  If enabled the stepping is running and is disabled the stepping is stopped.  In your timeout case you look at the state of the run button and if the state has changed from the previous value you decide to start or stop your the stepping. 

David Wilt
The New Standard LLC
Message 8 of 10
(1,472 Views)

David wilt
Thank you for the answer. I have applied your recommendations to VI.

0 Kudos
Message 9 of 10
(1,464 Views)
Solution
Accepted by topic author sefanoulis7

If it solves your issue please mark it as the solution so others may find the answer easily.

David Wilt
The New Standard LLC
0 Kudos
Message 10 of 10
(1,462 Views)