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: 

Did anyone ever used mbed with LabVIEW?

My boss wants me to use an mbed microcontroller to control a mircopump using labview. But I have no idea about mbed and how to control stuff like micropumps!!! and he has no idea about LabVIEW, he only knows mbed and pumps with matlab but now he wants to do it with LabVIEW. Anyway mbed wesite says many about mbed and LabVIEW interface but I don't really seem to understand anything

So I'm wondering if anyone has any experience in this thing and where can I read and find more info or examples? any help is appreciated! I'm a bachelor student doing an internship and it's very complicated when your supervisor has no idea how the thing he wants to achieve can be done 😞

 

Thanks! 

0 Kudos
Message 1 of 13
(5,088 Views)

@valdi wrote:

My boss wants me to use an mbed microcontroller to control a mircopump using labview. But I have no idea about mbed and how to control stuff like micropumps!!! and he has no idea about LabVIEW, he only knows mbed and pumps with matlab but now he wants to do it with LabVIEW. Anyway mbed wesite says many about mbed and LabVIEW interface but I don't really seem to understand anything

So I'm wondering if anyone has any experience in this thing and where can I read and find more info or examples? any help is appreciated! I'm a bachelor student doing an internship and it's very complicated when your supervisor has no idea how the thing he wants to achieve can be done 😞

 

Thanks! 



From looking at the link you provided, it looks pretty straightforward.  The hardest part (and it's not that difficult, really) is getting the communications up and running, but that looks pretty standard.  You said, "...But I have no idea about mbed and how to control stuff like micropumps!!!" implying that you know how to communicate with other stuff.  If you can communicate iwth "other stuff," you should be able to communicate with "this stuff."  I really think you are just unsure of yourself, and that you really are quite capable of doing this.  🙂  Either get the programmer's guide out for that thing or ask your boss what commands do what.  You should be able to translate what he did into what you want to do fairly easily.

 

Of course, everything is easy when it's not your butt on the line.  😉

 

Good Luck!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 13
(5,053 Views)

The mbed works with firmware you develop on a website (can also work with Keil and other embedded tools on your computer, but that is so far not really officially supported, although it seems there are some developments to support that with integrated source level debugging in the future).

 

In your C programmed firmware you do whatever you want to do, using various library functions to access the different peripherials. One function allows to read the virtual COM port that the mbed provides to the attached computer over the USB interface. So you can build whatever command parser you want to have in your firmware to respond to commands that are sent over a terminal interface or of course through a VISA connection from LabVIEW, and return strings too.

 

However your firmware for the mbed is programmed in C and that can be an interesting challenge when you start with no embedded programming experience. I would recommend to play around with some of the samples on their website to get a feeling about how to setup a program skeleton and then go from there. Once you have a running framework, extending it to do more or different things is an incremental trial and error process. It's pretty simple once you get the hang of it, and the webbased compile/link process is an interesting and very easy concept, that avoids any hassles about getting a toolchain properly installed on your system, which can be a painful experience sometimes. The only possible drawback I see is that your source code resides on an external server, so if you plan to develop super secret IP, that could be an issue. But the ease of just visiting a website and edit and compile an embedded firmware on their servers without any hassles to install a compiler toolchain locally and get it properly configured (and the according license costs for such toolchains) is a major attraction.

 

I have developed for a client a programming tool for their highspeed onchip manchester encoded in-cicuit programming interface in about a week, which accepts a number of simple commands to read, verify and download binary program code, encoding and decoding it on the fly. It required some non standard timer settings to achieve the necessary serial bit stream that also resulted in a non standard RS-232 baudrate for the terminal interface but it worked fine.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 13
(5,033 Views)

What rolfk said.

 

To simplify, any microcontroller can speak to LabVIEW (or any other language like Matlab) through the serial port (or COM port, probably implemented as USB).

 

In LabVIEW, go to Help >> Find Examples.... and search for serial, then start with "Basic Serial Write and Read"; that will give you the lowest level communication; you just have to make sure the baud rate, stop bits, parity, and handshaking. match the microcontroller's.

0 Kudos
Message 4 of 13
(5,028 Views)

So basically you say that I need to write a program in C using the mbed compiler on their website(save it then import it into the mbed) as an interface with the thing that I should write using LabVIEW!!! if yeah then please could you tell me what is the difference between the code I'll write for the mbed using the compiler and the one using LabVIEW? and why should I write 2 things?

0 Kudos
Message 5 of 13
(5,004 Views)

Why to write two things? At the most basic level, they are two different pieces of software that communicate to each other through a serial port. If the mbed code is already in place, then you just have to write the LabVIEW part.

0 Kudos
Message 6 of 13
(4,993 Views)

So is this mbed code general for any written code in LabVIEW or depends on the application and the LabVIEW programming? I mean if I change my LabVIEW programming should the mbed code be changed or it works with any kind of programming? I seem dumb but I've really never used a Microcontroller or programmed one, not even learned the basics...I have no background about it so it all seems complicated. What is more complicated that my supervisor thinks that the problem lies somewhere else!!!

 

Imagine that they have a program written in Matlab to control the pump connected with mbed, they have a LabVIEW code to control the same kind of pump connected with another mbed , both work perfectly, but they want me to use this LabVIEW code to control the pump in their application, but this interface isn't working for some reason...I'm confused and can't decide where the problem lies!!! 

0 Kudos
Message 7 of 13
(4,988 Views)

OK, after I read this thread more carefully, it sounds liike the mbed code is already written, and you have to figure out how to talk to it. You will send the pump a command through the mbed chip, and the pump will reply through the mbed.

 

You will connect through the mbed to the pump through a (1) serial port, (2) USB port, (3)  Ethernet or (4) whatever; it will all work the same as far as sending and receiving commands. The trick will be getting your very first command to work, each of those 4 things above are set up in different ways.

 

It will liikely be serial commands, in which case you can find examples such as LabVIEW's Help >> Find Examples... >> Browse >> Hardware Input Output >> Serial >> Basic Serial Write and Read.

 

Chances are the pump will have some commands, and I'm making these up, like this:

 

LabVIEW or Matlab or other host command: model_number?

Pump reply: pump_model 123abc

 

LabVIEW or Matlab or other host command: serial_number?

Pump reply: pump_model SN0000456

 

LabVIEW or Matlab or other host command: set_pump_rate 20

 

LabVIEW or Matlab or other host command: get_pump_rate?

Pump reply: 20

 

 

 

 

0 Kudos
Message 8 of 13
(4,972 Views)

@valdi wrote:

So is this mbed code general for any written code in LabVIEW or depends on the application and the LabVIEW programming? I mean if I change my LabVIEW programming should the mbed code be changed or it works with any kind of programming? I seem dumb but I've really never used a Microcontroller or programmed one, not even learned the basics...I have no background about it so it all seems complicated. What is more complicated that my supervisor thinks that the problem lies somewhere else!!!

 

Imagine that they have a program written in Matlab to control the pump connected with mbed, they have a LabVIEW code to control the same kind of pump connected with another mbed , both work perfectly, but they want me to use this LabVIEW code to control the pump in their application, but this interface isn't working for some reason...I'm confused and can't decide where the problem lies!!! 


The mbed firmware is specific to whatever solution you want to implement on it. If it is about controlling a pump it will of course be different than controlling an oven, or writing a little internet enabled device. It is in principle completely independant if you then interface that device to LabVIEW, Matlab, a VB program or even Hyperterminal.

 

It has to provide a command interface of course through either the virtual com port or the built in ethernet interface, but since you say the device already exists and can be controlled from Matlab, this seems to be a given. Now you need to find the commands this device understands, the interface it uses (probably virtual COM over USB) and then you can go and write a little LabVIEW VI library that sends those commands to the device instead of from your Matlab application.

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 9 of 13
(4,967 Views)

ok so far I understand, I managed to write this LabVIEW code, when I input a number for the frequency the pump should rotate but nothing happens. if I measure the voltage on pin 11(initializing pin) on the mbed i find 3.3v which is correct but on the pin 26 which controlls the frequency of rotation i get no voltage!!! the connection can't be wrong because it's the same used with Matlab, the mbed .bin file is the same, so I guess the problem lies in my LabVIEW programm and I have no idea. But I guess it has to do with the while loop and what is inside it. So would be pleased if someone can help!

 

PS: the pump needs only 2 signals, initializing signal and running signal(at least this what I've been told)

PS: You need mbed library to see all elements

 

thanks!

 

 

0 Kudos
Message 10 of 13
(4,955 Views)