Connecting Lego EV3 to mBot via Bluetooth


#1

I’ve mentored my eldest daughter and her friends for the creation of a robot dance performance using Lego EV3 bricks. For this they used Bluetooth extensively (check it out here if you are interested: https://www.youtube.com/watch?v=xpWPyyBr4Co). This allowed for great interaction between the robots but EV3s are not cheap. For the future, I wanted to include more affordable robots whilst still being able to get the robots to interact.

I’ve bought a couple of mBots (v1.1 Bluetooth) and am wanting to investigate connecting from a Lego EV3 to an mBot (or mBots if possible) via Bluetooth and then communicating simple messages between them.

I’ve seen this to give me hope:

From an EV3, if I look for Bluetooth connections, I can see the mBot (named ‘Makeblock’). When I try to connect it to (using blank or default 1234 passkey), it hangs. Any tips? If I can get past the connection, I then need to work out how to send messages EV3 -> mBot and vice versa so they can be interpreted on the other side. Any help is appreciated.


#2

Can you connect to the mBot using mobile app? If not, download the makeblock software and modify the connection type (connect mBot via USB to PC). Maybe it helps.


#3

Thanks for your reply. We can connect to the mBot using the mobile app so we are not having any issues with what is offered out-of-the-box. I’m just trying to go beyond this. I referred to the other posting not because I wanted to necessarily remote control my mBot using an EV3 but because it showed an example of the robots communicating via Bluetooth i.e. button press on EV3 triggers the send of a value via Bluetooth, mBot program receives the value and does something with it (in this case, move as directed). This could be used for other applications e.g. read an EV3 sensor value, send via Bluetooth and display on the mBot LED matrix. The example showed this might be possible (albeit with a different Makeblock product) so I am asking if anyone has successfully done this with an mBot.


#4

Hello Grant!

You can download the programs for EV3 and Arduino-Makeblock, using the links under the video:

Best regards,

Sigtrygg


#5

Thanks for the reply. I’ve looked at the programs and it looks simple enough but I haven’t got to that as yet. Have you got any tips on connecting? From the EV3, I try to connect to the ‘Makeblock’ device but can’t get them to connect. I’ve tried a passkey of ‘1234’ and blank. Any tips on how you were able to connect them?


#6

Try 0000?


#7

Hello Grant!

First get sure you have connected the Bluetooth-module to port 4 of your arduino-makeblock controller.
Motors on ports M1 and M2. Connect the ultrasonic module on port 7

Can you download the arduino-program “EV_remote_for_RobotStarterKit.ino” without errors??
If not: Try to replace the “#include makeblock.h” with #include “MeOrion.h”, because I used a MeOrion for this.
It is two years ago, when I made this project and in the time makeblock has changed their libraries for arduino.

Did you set the parameters right to the EV3?
Under settings “Bluetooth” “Visibilty” must switched on and of course “Bluetooth” too.
Under “connections” of EV3 you should find “Makeblock” now. Otherwise try “search”. Of course makeblock has to be switched on. Then click “connect” onto your EV3.

Now it should work.

Please let me know, if it works now.

Bye,

Sigtrygg


#8

Oh, now I have seen, what the problem might be: I used an extern Bluetooth module in port 4 for my Orion board, but the mbot comes with integrated Bluetooth, which isn’t accessable through a port and it is a mcore board.
Maybe I got the time to try it out with the mbot.

Bye,

Sigtrygg


#9

Hi,

Thanks for the helpful comments so far. I’ve used Bluetooth extensively with EV3 so I can find ‘Makeblock’ but I couldn’t connect using the EV3 default ‘1234’ passkey. As per the suggestion from Andreas, I used the ‘0000’ passkey and it connected straight away. Success! Looks like this is a one-time requirement as now it is on my favourite list, the EV3 doesn’t require a passkey to be entered on subsequent connections.

I haven’t had time to get any further as yet but will next try to do something similar to what you did to show that the EV3 can send a Bluetooth message to the mBot, the mBot can receive the message, extract the data and use it in some way. We have the LED matrix on the mBot so I thought an EV3 sensor value being communicated to the mBot and displayed on the LED matrix would be a cool demo.

I am using mBot v1.1 which came with a Bluetooth module. As you noted, I expect this will operate a little differently to what you did 2 years ago. Happy to accept any tips but will otherwise post my progress here when I get time.


#10

I had 30 minutes last night to have a go and I made some progress. I didn’t have time to put together an exhaustive test but I also tried out some ideas from Sending data to mBot via Bluetooth to get up and running quickly. The progress is that I was able to connect via Bluetooth, send messages to the mBot. On the mBot side, I was able to receive messages and display values on the LED matrix as messages were received.

However, what I haven’t had time to investigate is how to interpret the messages received. Poking around, I’ve also found:


I have always expected that the EV3 would have some proprietary message format so the above seem of interest. What does give me hope is that I am relatively sure I saw 129 & 158 regularly in sequence in my quick test and the above links indicate that EV3 messages include such a sequence in them (0x81 0x9E in hex).


#11

I’ve been able to replicate Sigtrygg’s remote control of the mBot by pressing buttons on the EV3 brick. I’ve also confirmed that the Bluetooth message structure is as per the recent links I posted so I know how to unpack more complex messages. This opens up possibilities for cool interaction between EV3 and mBots. I’ll put together a page on this later with code so others can reproduce this easily. Thanks to Sigtrygg and Andreas for your helpful posts.


#12