Use 2.4G serial in Arduino mode


#1

Hello, I have the mBot with 2.4G serial communication option. I have no trouble controlling the mBot using 2.4G through mBlock when the default firmware is installed.
I’m pretty sure that the mBlock software is sending serial commands to the mBot via the 2.4G interface to enable the scratch program execution. I also have no trouble uploading custom Arduino code to the mBot. I’d like to combine the two.

Two questions:

  1. I would like to use the 2.4G as a wireless serial interface in my own custom Arduino programs. For example, using a terminal program on the PC and send/receive characters from the mBot wirelessly using the 2.4G interface. Is there an API for this?
  2. If not, is source code provided to enable the mBlock 2.4G control in my own custom Arduino programs?

#2

I’d recommend checking the official repo on Github. I suspect you can do that, but not from Scratch.


#3

Thanks.

From your clue, I found the mbot_firmware.ino sketch in Program Files (x86)/mBlock/firmware. I deciphered enough of the serial protocol being used to communicate between mBlock and the Arduino to understand (I think) how to implement this in my custom Arduino code. Essentially, I’d need to copy all the read/write serial functions from this example! (Hooray for CC-BY-SA 3.0 license!) Now I can write new firmware and still let the kids use mBlock to interactively control the mBot.

With mBlock running and the Arduino view open I can send data from the mBot via 2.4G and see the hex data appear on the bottom right of the screen. From the makeBlock firmware sketch above, I see this is simply a matter of using the normal Arduino “Serial” methods. Now I just need to figure out how to attach the Arduino environment (or some other generic terminal program) to the 2.4G dongle in Windows.

Anyone have any hints for how to do that?


#4

Hello,
I’m facing the same question, Does 2.4G wireless serial interfacce with Microsoft Visual Studio programs?
anyone have figure out the API ?

Thanks for answer,
Hao


#5

cc’ing @tec_support on this one.


#6

Hello Hao,

I’m sorry that our 2.4G serial does not interface with Microsoft VS, thanks!


#7

@HAO, there is a library called ahid.dll (www.ahidlib.com) that may solve your problem. Since the 2.4G serial adapter implements HID protocol, this library should be useful to interface the dongle with VS. However, you will need to know exactly how the dongle handles the data, since the library needs the USB Report IDs, Types and Descriptors to open data pipes to transfer data to/from the dongle (Hope @tech_support helps us with that). As of now, I only have information from USBView that I don’t really know how to read, besides the vendor and product IDs, which are necessary too.


#8

Hi CristianDL,

Regarding to the info you request, we have consulted our engineers, but sorry to say that we don’t have such info available for providing.


#9