From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Arduino Mega Interface

Hi,

 

I work with LabVIEW 2012 under Windows 7. I bought arduino mega 2560 and I tried to make an application for control of a dc motor using arduino mega and the driver SN754410. When I connect 9V to the pin of the driver SN754410, responsible for the motor supply, there is a voltage around 2V between the pins of SN754410 where the motor is connected. The monitor of my PC starts blinking too and the connection between arduino and the PC stops.

I spoke with an expert from the arduino forum.

 

Here is his answer:

 

If it is Firmata your "problem" is entirely with LabView and nothing to do with the Arduino.
I suspect that your LabView VI is doing something silly when it powers up, I suggest you ask in a LabView forum.

 

 

I am sending my LabVIEW code and my diagram for connection of arduino to the driver SN754410.

 

Regards

 

 

0 Kudos
Message 1 of 12
(4,509 Views)

Hi,

the library you use is not officialy supported by NI, but still I will try to help you:)

 

Could you please specify which version of library do you use? Because in my verison (2.0.0.93) the function to set duty cycle is different (see the attachement). Maybe it's a good idea to update the library if you can?

 

And the second question for now, are you sure that the pin 6 in arduino means channel 6 in PWM? Because according to the scheme https://www.arduino.cc/en/uploads/Hacking/PinMap2560big.png Pin 6 is DIO2. I'm not an expert in LINX library for Arduino, so if I'm wrong, please send me a part of documentation where you have readed information about pwm channels. If you can just disconnect the PWM cable from the board and measure the voltage. If everything is ok, it should be about 5V or 3.3V depending which voltage levels are you using. If it's not like this we'll know where to look for a bug:)

 

Best regards

Marcin Twardak
Applications Engineer
National Instruments

0 Kudos
Message 2 of 12
(4,458 Views)

Hi

 

Thank you for your answer. I have changed my strategy. I use my Arduino Mega. The pin 5 is programmed as a PWM. I control one dc motor through MOSFET transistor because I need 9V supply. The control of the motor is OK. I can change the speed. But I have the following problem:

 

After the launch of the LabVIEW program, during the initialization procedure of Arduino, the signal comming from Arduino to the motor is 9V. After the successfull initialization, Arduino gives the required voltage to the motor. I would like to overcome this problem. It is not so nice to send 9V to the motor at the begining.

 

I use LabView 2012 and I can't update the LINX library. If this library is not supported by NI what kind of a library I can use for controlling arduino with Labview?

Message 3 of 12
(4,392 Views)

Hi tiho!

 

Currently we don't have officialy supported Arduino libraries for LabVIEW 😕 Maybe in the future...

 

And answering to your problem... Honestly, I have no idea. I've worked with Atmel microcontrollers only using C and here in the office we don't have arduino, so I have no possibility to reproduce your problem.

 

But my advise is to move your question to the LINX Forum (https://www.labviewmakerhub.com/forums/). Maybe there is someone with similar problem?

 

The one thing I can advise you is pulling down the PWM pin with the resistor between 4k7 - 100k (I think most of the times 10k is used). Maybe it's not the high level forced by microcontroller but just some kind of "flowing" voltage? In that case pull down resistor will help.

 

If you have any other question or problem don't hesitate to ask. Maybe together we can figure out something 🙂

 

Best Regards

Marcin Twardak
Applications Engineer
National Instruments

Message 4 of 12
(4,358 Views)

Hi,

 

Thank you for your answer. The PWM pin is connected to the GND via an resistor of 11k ohms as a pull-down resistor. You think that the resistor has to be 100kohms, isn't it?

 

Regards 

0 Kudos
Message 5 of 12
(4,325 Views)

No, I think it doesn't matter what resistance is used to pull down in that case, if it's between 4k7 and 100k of course. I just wrote is as a reminder, because it's easy to forget about that.

 

Have you tried to write the post on the LINX forum? If you do so, please paste here the link, because I want to follow the problem and learn something new.

 

Best Regards

Marcin Twardak
Applications Engineer
National Instruments

0 Kudos
Message 6 of 12
(4,314 Views)

Here is the link:

https://www.labviewmakerhub.com/forums/viewtopic.php?f=12&t=866

 

Could you please give me an advise how to control a dc motor, actuated by 9V using labview. I try to use arduino because it is a cheap but may be not so stable solution.

 

Regards

0 Kudos
Message 7 of 12
(4,303 Views)

Thank you very much for the link, I hope there will be someone who can help you.

 

As to your question: in my opinion you have two options:

 

Use myRIO (http://www.ni.com/myrio/) - it is really great hardware, I had opportunity to play with it and it's just great, it's fully supported so if you have any problem we can surely help you. But I know one thing - it's not so cheap as arduino 😕

The second solution is a little workaround but I used it many times and it always worked 🙂 and it's cheap :). Connect to arduino bluetooth (I recommend HC-05 - popular and costs some about 6$) and write in C (or just use ready to use arduino libraries) a really simple program to get the data via USART (Rx/Tx pins). Then create a program in LabVIEW and use VISA libraries (free and fully supported) to connect with bluetooth - of course your computer has to have bluetooth or USB dongle (3$) - and send commands to the arduino. If you're interested in that solution I can provide you more details and instructions how to do it 🙂

 

Best Regards

Marcin Twardak
Applications Engineer
National Instruments

Message 8 of 12
(4,292 Views)

I don't know why I assumed you need wireless communication... Of course to the second solution you don't need bluetooth, it's enough to have USB-UART converter (4 $) 🙂

Marcin Twardak
Applications Engineer
National Instruments

Message 9 of 12
(4,289 Views)

Hi

 

I am interrested in that sollution. Could you please send me more details and instructions how to do it and where to buy a USB-UART converter?

 

Regards

0 Kudos
Message 10 of 12
(4,252 Views)