Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect to sbRIO with bluetooth

Hello,

 

I am a new labview user and currently working on a class project. I want to control an RC with my computer. I am using sbRIO 9606 as my controller, and I have finished making FPGA VI to control the car.

 

Right now my problem is the connection from the computer to the board. So far I have been doing all of my testing with the sbRIO 9606 connected via ethernet cable, and I want to make it wireless. I bought a bluetooth module (http://www.robotshop.com/productinfo.aspx?pc=RB-Dfr-10&lang=en-US), and I have been trying to learn how to connect it to the computer. I found an example vi in the labview library called "basic serial read write" and used it to test the TX and RX pin of the module, and they seems to pass signal fine.

 

Does anyone have similar experience and can explain to me how to connect to the sbRIO to run my labview project and vis? Any help would be appreciated.

 

Joey

0 Kudos
Message 1 of 8
(6,336 Views)

Hi Joey,

 

You will not be able to send VIs over Bluetooth to your sbRIO.  What you will have to do is setup an RT VI that listens for serial commands and then passes the data forward to your FPGA control code.  On your host computer you can setup a Host VI that will send the serial over Bluetooth commands to the Bluetooth receiver on the RC Car.  What you can do is program the sbRIO over Ethernet then disconnect the Ethernet cable and drive it via the serial over Bluetooth commands.

Regards,

Mike Altmann
Product R&D
NI
0 Kudos
Message 2 of 8
(6,323 Views)

Hi Mike,

 

Thank for replying. I am doing something similar to what you said. I use a sample project from my instructor that read and write serial string from DIO of the board, and I converted the strings to control the FPGA output to the car. I am using a modified Basic Serial Read Write to send command over to the bluetooth module.

 

Right now I am still working on integrating the two FPGA projects so they can run on the sbRIO at the same time. I'll update again once I finish that.

 

 

0 Kudos
Message 3 of 8
(6,302 Views)

Ok, so I put together my serial project and my controller project, tried to compile the FPGA VI, and I got an error.

 

I have no idea what this means...  I have attached the error message, can someone translate it for me?

 

0 Kudos
Message 4 of 8
(6,300 Views)

Hey Joey,

it looks like the error that you are getting is coming from an array item that is larger than either expected or allowable.  Are you using any large arrays or anything like that?  It looks like you started from the Basic Serial Read Write.vi and built on to this example, is that right?  Were you able to successfully compile the VI before your modifications?  If so, what have you added since that point?

0 Kudos
Message 5 of 8
(6,282 Views)

I figured out the error, my VI opened two FPGA VIs, and that's the problem. I created a new FPGA VI with all the necessary DIO and my computer was able to compile it this time.

For some reason I am having a problem with the bluetooth connection again, which I thought I got it working. When I test the bluetooth module, the serail string goes into TX pin can come back from RX pin and reads correctly. When I test the sbRIO, the DIO I assigned to be TX can also send string out and receive it on the RX DIO. But when I connect the DIO TX to the RX pin of the module, and DIO RX to the TX pin, and run both VI at the same time, neither of them receive the serial I passed out, and I tried switching TX with RX. Sometime one might get part of the serial string, and just quickly disappears.

 

I wonder is this is a result of the sbRIO running at different speed than the bluetooth module? Since both VI are running in timed loop of same attributes.

 

 

 

Also, I tried to work on the sbRIO at my place today, using my Cisco E1000 router. I connect both my laptop and the sbRIO with ethernet cable to the router, and turned off wireless on my computer. MAX says the sbRIO is connected and running, and I can connect to the board in the project explorer, with the new ip address, but when I run my VI, I can't even get the temperature reading from the board. I think I am setting this up like our lab, and I am using the same project and VIs, but nothing is reading from the FPGA VI.

 

 

0 Kudos
Message 6 of 8
(6,277 Views)

Hey Joey,

I'm glad to hear that you got your compilation error worked through.  If I understand your last post correctly, you are able to get communication from the TX to RX pins on your DIO module, but your bluetooth device isn't registering these signals when sent from the DIO module, is this right?  When you say that sometimes "one might get part of the serial string and just quickly disappears," what exactly do you mean?

 

You also mentioned that you were trying to run the VI you wrote from home on your laptop.  You can see the sbRIO, but aren't getting any data from the board, is this right?  Are you using network published shared variables to monitor these values?  Are you running this program interactively?  If you run the VI in FPGA interactive mode, do your values update on the FPGA program?

0 Kudos
Message 7 of 8
(6,254 Views)

Hi Ben,

 

Let me explain my hardware set up first, sorry for not being clear in the last post. My computer has a Bluetooth USB adapter that I set up to connect to the Bluetooth module, and I use the Basic Serial Read Write VI to pass input strings to the module. To test the module connection, I wire the TX to the RX pin, and send string out. I am able to get the same string back on the VI.

 

On the other hand, I have a LabVIEW project that utilizes DIO1 and DIO2 of the sbRIO 9606 (with a custom mezzanine card plugged in) as TX and RX. I do the same test with TX wired to RX, and this is fine too. In both cases I have the VI run in loops. When I change the string input, the output can respond very quickly and stay there in the indicator control.

My next step is connecting the TX of the Bluetooth module to the RX of the sbRIO, and vice versa. When I do that and input "12345" through the Bluetooth module, the sbRIO would get something like"45123" or "2345123", and has a significant delay in response to the input change. When I input "12345" through sbRIO, the Bluetooth module either get nothing or get a flash of signal on the indicator.


For the second part, I actually don't know what an interactive mode is. When I am in the lab,  I connect the computer and sbRIO with Ethernet cable to the lab’s LAN network, with wireless turned off on my computer, and running a LabVIEW project, with all the VIs under the sbRIO. I run the FPGA VI and use FPGA I/O like the LED and Chassis temperature to confirm the connection, and I am able turn on and off the DIOs. When I do this at home, I connect the computer and board to my router and run the same VI from the same project, and I can’t even get the temperature reading.

 

I really appreciate all the help I get from here, unfortunately the project was due yesterday, so I don’t have access to the sbRIO for testing anymore. I ended up just running the car with an Ethernet cable attached. I also couldn’t find a good power source for the board. I used 9.6V Ni-Cd RC batteries for powering the board only, not even the car. Fully charged battery can only power the board for about 10 min, after that the LED on the mezzanine card started flashing, and I lost connection to the board.

 

Again, thank you all for the suggestions!

0 Kudos
Message 8 of 8
(6,246 Views)