Read/Write over Bluetooth in Ev3?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
totokan
Posts: 45
Joined: 28 Sep 2013, 04:22

Read/Write over Bluetooth in Ev3?

Post by totokan »

Hi, I have been pouring over the lms2012 source code and I can't for the life of me figure out how to read/write over Bluetooth. It seems like I can connect to my PC and open a terminal to the COM port that Windows configures the Ev3 as, but I have no idea how to set that up. Furthermore, Windows seems to assign 2 COM ports to the brick, making it even more difficult to determine what's going on. I thought perhaps writing to /dev/lms_bt would work, but a cursory investigation determined that it doesn't seem to do anything, either. Anyone have any experience here?
dlech27
Posts: 9
Joined: 19 Aug 2013, 23:08

Re: Read/Write over Bluetooth in Ev3?

Post by dlech27 »

In the doxygen docs created from the lms2012 source code, it explains the communication protocol. It is not complete, but enough to get you started. Also, you won't be able to do it from a terminal to the COM port. The messages are binary, not text and each message must fit in a single bluetooth packet. Each time your press a key in the terminal, you are probably sending a new packet.

You could also have a look at one of these projects:
http://ev3messenger.codeplex.com/
http://www.monobrick.dk/

There are probably some others that I don't know about too.
gloomyandy
Posts: 323
Joined: 29 Sep 2010, 05:03

Re: Read/Write over Bluetooth in Ev3?

Post by gloomyandy »

What are you actually trying to do? If you want to talk to the standard Lego firmware/VM then see the previous post. If you want to write programs that run on the EV3 that use Bluetooth to communicate with other devices and systems then the EV3 has a pretty standard Linux Bluez setup (though it is rather out of date). In leJOS we make use of the Bluetooth PAN (personal area network) feature to enable TCP to run over Bluetooth and talk to the device that way. There are lots of other options (we have also enabled the use of the standard serial protocol to enable communication with the NXT Bluetooth stack).

Andy
totokan
Posts: 45
Joined: 28 Sep 2013, 04:22

Re: Read/Write over Bluetooth in Ev3?

Post by totokan »

Ideally, I want to have some kind of function that waits for input, and a way to send info from a PC. That is to say, if I could treat it as a general serial port that would be best.
totokan
Posts: 45
Joined: 28 Sep 2013, 04:22

Re: Read/Write over Bluetooth in Ev3?

Post by totokan »

Monobrick is apparently closed source, which is annoying (I think it only implements the system commands/direct commands listed in the source files anyways)
ev3 messenger seems like it might work, but I have no idea how to access mailboxes inside a standard C program! Any ideas how one might do that?
eels4free
Posts: 1
Joined: 02 Dec 2013, 13:44

Re: Read/Write over Bluetooth in Ev3?

Post by eels4free »

Hi

I am the author of MonoBrick communication library - it is open source. Download the test project from http://www.monobrick.dk/?wpdmact=proces ... 90bGluaw==. This includes some test code and all the source code. I will upload the source to Github soon.

Anders
totokan
Posts: 45
Joined: 28 Sep 2013, 04:22

Re: Read/Write over Bluetooth in Ev3?

Post by totokan »

Thanks for that, although it's not necessarily helpful for me since I've got students with a month and a half of work entirely in C. I'll surely take a look at it for other projects, I was curious about how it worked!
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests