Using bluetooth for simple android app to control mBot


#1

Hi, I bought an mBot robot and I was able to get it working ok. Also the mBot app on my Android phone works great. I did also do the tutorials using the mBlock software.The idea to be able to use Scratch to write mBot programs is great!
So, I can write programs to control my mBot using the IR-controller. But what I want to do is to write simiar programs to control the mBot from my Android phone. I intend to use App Inventor 2 for this, which you can use to send and receive bluetooth data easily. But I do not know what the API to the built-in firmware is. And there seem to be no blocks that allow me to use the bluetooth module in my scratch programs (from the phone, not from the PC).
I hope that you can give more information about this…


#2

You can download the mBot app on google play for your android phone here directly: https://play.google.com/store/apps/details?id=cc.makeblock.mbot
Thanks
Una


#3

Thanks for your reply. I did download the Android mBot app, and it runs fine.
But, I would like to make my own! And I cannot find how to proceed with that, how to communicate with the mBot, preferably using mBlocks in Arduino mode.


#4

Do you mean you want tp design your own android App.if so that is outside of the Arduino relm, but if you want to make your own sketch for bluetooth you can connect to port 5 which uses pin 0-RX and pin 1 TX and you can use any Arduino bluetoth sketch or write your own.


#5

I mean that I would like to make an Android app to control the standard mBot, in the same way I am able to do with the mBot app that I can find in the PlayStore.
I am not asking how to make the Android app, I know how to do that. I am just asking how to communicate with the mBot via bluetooth. What should I send to the mBot to control it in similar ways as the available Android and iOS apps?


#6

You can have a look to the code of the apps in the github repos:


The protocol to communicate should be the same for the two apps.
Perhaps they share the same protocol than the mBot.


#7

It is not what you send to the MBOT but you need to write a sketch or firmware if you want to call it that to tell the MBOT how it receives the signal from the Android or IOS. Like what to do when you push a certain button.


#8

Thanks. It seems that I have to do a lot more study, before I am able to do this.
I was hoping that there would be something similar for Bluetooth as for the IR remote, for which there is a nice scratch block which you can use to program the mBot and control it with the remote.


#9

Bit of a late reply, but I had been thinking the same thing. There is an open source project called PocketCode that has an Android app that is based on Scratch. They have actually written blocks for Arduino, Lego MindStorms and the Phiro robot, so blocks for the mBot should be doable. I’ve started some work on the programming, but I’m not too far along yet. I’ll post back when I have something usable.

https://share.catrob.at/pocketcode/


#10

I’m very new to this and I would also like any information that I can get on the type of communication that occurs via Bluetooth. Can an app like Roboremo be altered to send the appropriate codes to the unit? I can make the connection, but I have not figured out a single command the responds. Please keep me informed on the progress with regards to Pocketcode. If there is anything substantial existing for the mBot, I would love an update!


#11

@hillechien, I’m also very interested in learning how to control my mbot via bluetooth using my my phone. I’ve used the mbot app, which worked great, but like you I would also love to be able to write my own custom apps. if you figure out what is the blutooth analog of the mbot’s “ir remote A pressed” blcok, please do share.

@nedhale,
I gotta say, that pocketcode app looks like a pretty cool way to do this, especially for smeone with zero Android coding experience. i’d love to learn how to connect it via bluetooth to the mbot. if you figure it out, definitely let us know.

best,
SK


#12

@CoolPink
Buy a Sparki from Arcbotics! They have a much better website and example apps to use with MIT App Inventor, which was what I wanted to use to make an Android app. And it is really simple to do.
That said, I actually like the mBot better, it is more sturdy and more expandable I think. I know now how to make the bluethooth connection and how to program the Arduino in the Sparki, so in a while I will try the mBot again.
I will post here when I succeed. Cheers, Hillechien.


#13

Thanks, Hillechien. I hadn’t seen MIT App Inventor before. Just watched a couple tutorials. Very cool! Can’t wait til I have some time to play. I’m hoping we can figure out how to connect it via bluetooth to the Mbot.
SK


#14

Hi,

I’ve done a simple app, using App Inventor 2, in order to investigate the possibility to use it with my students (I’m an italian computer science teacher).

I’ve done a post where I describe how to control the color of mbot’s RGB leds. You can find all the infos here: http://webtoolsreview.blogspot.it/2016/04/programming-mbot-with-app-inventor-2.html

You’ll find there also the link to the page that describes the underline protocol.

I’d like to receive also your updates about this topic. Thanks

Ivan


#15

Ciao Ivan,
You are my hero!
For the time being I gave up on the mBot, and I bought a Sparki from Arcbotics, which is easy to program and for which there is good documentation. I made App Inventor apps for it to let it move etc. But I like the mBot, because it looks more sturdy. I am going to try again, thank you for finding out how to do program the mBot!
Cheers, Ghica.


#16

This thread may help you to understand Bluetooth communication with Makeblock (and other) robots.
Cheers, Stefan


#17

ivenuti,

Thank you for your post. It inspired me to buy a set of robots for my classroom. Rather than learn the Orion protocol, I found the MIT App Inventor plugin 1.9, released March 2017. It works very well with the mBot, and I would recommend using it with App Inventor :slight_smile:

Dan


#19