How does bluetooth work


#1

I am able to write scratch programs and transfer them via the usb port. I am also able to connect the bluetooth (sometimes). Is it possible to transfer programs to the mbot via bluetooth? Some documentation would be nice - is there any?

thanks
Selwyn


#2

I would like to know as well, as my tank is no longer connecting through bluetooth. It would help me with troubleshooting.


#3

Jallen, have you had any responses from folks on this forum?


#4

It is not possible to load a program over Bluetooth. This is a serial communication channel that mBlock uses to send commands to the mBot. When you load an Arduino program, it uses the onboard programmer and requires that the robot be connected via USB.


#5

I don’t know about that. I got my board to load mBlock programs using Bluetooth nicely.


#6

Really? My understanding is that you can run mBlock programs over Bluetooth / 2.4GHz WiFi, but you can’t set up programs that start with an mBot Program block over Bluetooth because the AVRdude programmer is only available over the USB cable. I don’t have any Bluetooth mBots, so I can’t verify either way. :slight_smile:


#7

Well, it isn’t perfect, but it works. Double clicking a “When Flag Clicked” block can immediately start and stop the robot, and using an “Mbot program” hat block requires a reset after starting it up.


#8

Tobor, what did you have to do to make bluetooth programming work? I got the connection to work but mbot won’t let me upload my programs.


#9

I’m pretty dissatisfied with the lack of documentation for this product. My 9yo received the bluetooth mBot as a gift and we got it assembled pretty quickly. Tonight I installed the software to get to programming it in Scratch, which he’s used before. Getting it to work was pretty painful.

Here are my notes; I hope they help someone.

  1. We’re running on an older Macbook Pro, with Yosemite 10.10.4

  2. It wasn’t obvious (no docs), but we had to pair the mBot via the system Bluetooth control panel. Sort-of, because it doesn’t stay paired, which is apparently OK. Turn on the mBot, open the System Bluetooth control panel, pray that the mBot appears in the device list after a few seconds. Tap the Pair button. It will pair, then flash a code, and report “Disconnected”. Grumble, but guess what - Success! In retrospect, it’s Bluetooth - it must be paired. But not everyone will know that.

  3. Run the mBlock software (we installed v3.2 via the web. It took a bit of Googling to find it. Grumble.) Go to the Connect menu. Ignore the grayed out Bluetooth submenu because clearly that’s not what you’re after. (!) Instead, go to Serial Port, and look for /dev/tty.Makeblock-ELETSPP. Select that because clearly that’s what you want. (!) Look at the title bar of the main window and pray that it says “Serial Port Connected”. Also, the blue flashing light on the mBot bluetooth module should stop flashing and light up solid. If you’re lucky.

  4. Write some Scratch code. OK, I’ve done Hour of Code, and I’m a software engineer by trade, so this should be easy. It wasn’t “easy” but ok… I found the mBot Program block and dragged that out, and also a “move forward” block, which I configured for speed 100.

  5. Run it. But How??? This stumped me for a while. I looked in the menus for an Upload command. I pressed the green flag. Repeatedly. Nothing. Then, all of the sudden the mBot moved forward (and wouldn’t stop…) What did I do? Apparently I had double-clicked the mBot program block. Yay. But really? Why is this hidden?

  6. Experimenting a bit more, I discovered that you can toggle an advanced Arduino code-view by single-clicking the mBot program block. And there’s an Upload to Arduino button hidden there.

That’s about all I figured out. I wrote a bit more code (our mBot can drive a square now.) I explored the “upgrade firmware” options but never got them to work - I suspect they require a USB connection but that isn’t documented either. Sigh.

Makeblock: You got a lot of people to buy and gift your $79 kit to 9yo boys and girls this holiday season. I’m certain most of them won’t figure this sequence out - more power to them if they do. Please take your money and hire some more engineers and write some better documentation.


#10

@spolit ,
That’s odd.
All I had to do was write the code I wanted, connect the bluetooth to the board I wanted, and then double-click the hat block.

@TomSwift ,
Scratch is as simple as it gets, really. Sorry you had some issues :crying_cat_face:
Anyway, the issue with going forward forever stems from Arduino programming. If you put an ‘Mbot’ hat block above your code, it requires a reset because Arduino puts all of your code under an infinite loop. If you use a Scratch ‘when flag clicked’ hat block, you should be able to double click to instantly stop the robot. :smiley_cat:


#11

My issues aren’t really with Scratch, the language. They are with the lack of documentation, and on the discoverability of features in the mBlock IDE.

Additionally I think it’s odd that there aren’t any default blocks that tell the robot to “move forward 10” or “turn right 90”. Not having these pretty much guarantees that the first experience will involve running the mBot into a wall while the programmer frantically tries to figure out how to do a reset.

You’re 12 - how did you know to double click the hat block? Maybe that’s a Scratch-ism I wasn’t aware of but everyone else is?


#12

You can double-click the hat block or click the green flag over the stage pane (upper left hand pane with the Panda). :slight_smile:

The motors do not come with encoders, so turning a specific number of degrees or moving forward a specific number of inches/cm is challenging because you have to work out the time required. I’m working on a maze solver, and my solution for 90 degree turns is to have a black line that runs through the center of each square for the North-South / East-West axes and use the line following sensor to make the robot stop when both sensors are over the line. Running the code from the mBot works reasonably well, but the time lag due to the serial connection over WiFi just wasn’t getting it done.

Did you work through the two PDFs that Makeblock provides for the mBot? They contain a lot of the information you’re asking about. You can find it here under the resource tab. It would be great if the links to the docs and software were on the front page, and perhaps Makeblock will get around to putting them there at some point. You do have to keep in mind that the Makeblock products are not LEGO Mindstorms, but there are a number of people working with them that are active in the forums. Just keep asking questions. :slight_smile:


#13

:slight_smile: One of the first things I did was to make a simple move program and I found that I really needed to have:

mBot Program
wait until Button [pressed]
run [forward] at speed [70]
wait [1] second
run [forward] at speed [0]

to have a controllable robot. The Arduino runs in a continuous loop, as you note, so it’s REALLY important to remember to turn off the motors. :smiley:


#14

@TomSwift
As per the “turn right” blocks, it should work if you use the default Scratch blocks “turn _” and “move forward _ steps”, but you’ll need to begin the program with a “When flag clicked” block.

As per the question about me being 12, I’ve been using Scratch for around 4 years now, so it ended up being a pretty normal transition to figure it out. I used to just click the Flag, but I found that in mBlock it ended up being a bit easier. I honestly don’t remember how I ‘knew’ how to click it. I guess it was just something I did, haha.

@chuckmcknight
Yeah, that looks right! :smiley_cat: