Page 1 of 1
Read/Write over Bluetooth in Ev3?
Posted: 03 Nov 2013, 19:12
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?
Re: Read/Write over Bluetooth in Ev3?
Posted: 12 Nov 2013, 03:27
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.
Re: Read/Write over Bluetooth in Ev3?
Posted: 12 Nov 2013, 11:05
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
Re: Read/Write over Bluetooth in Ev3?
Posted: 13 Nov 2013, 23:35
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.
Re: Read/Write over Bluetooth in Ev3?
Posted: 01 Dec 2013, 23:26
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?
Re: Read/Write over Bluetooth in Ev3?
Posted: 02 Dec 2013, 13:49
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
Re: Read/Write over Bluetooth in Ev3?
Posted: 02 Dec 2013, 22:58
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!