mBlock working with mBot on linux, but not wireless


#1

I was able to get mBlock installed and running via wine on linux. This includes connecting, programming, and controlling the mBot through USB serial. I was really surprised at the lack of linux support for mBlock, even if just through wine.
Unfortunately I don’t have the 2.4 wireless connection working (and I’m not even sure if it’ll be possible in wine). Before I try though I thought I’d ask if anyone has already had any success with the mBot’s 2.4G module in mBlock on linux?


#2

Do you mean the Bluetooth connection?
I was running it though Wine too, but THEN I realized there was no way to get Wine to work with bluetooth, as in it’s actually impossible.
Now I just use Win10 with mBlock, because it’s much more convenient.


#3

no, not bluetooth, we’ve got the 2.4 wireless modules on our mBots, and even though it’s a serial communication device, the usb dongle is handled as an HID device instead. if it was just me using the robots I wouldn’t be bothering with mBlock at all, but my kids are young and already like to use scratch at their current level of programming skills. We switched the kids’s from Windows to linux last year though and it’s been otherwise fantastic.


#4

Oh, I wouldn’t know about those, I haven’t tried it. Anyway, good luck. :smiley_cat:


#5

Hi Brent, could you maybe explain the steps to get the serial working using ubuntu and wine?


#6

Brent, another request - could you explain how you got serial working in wine. I got mBlock program running with wine and created the symbolic link, but the serial device does not appear in the mBlock menu.


#8

In the end I needed three different steps:

  • added a udev rule to create a symlink as mbotUSB for the mBot’s serial usb connection

  • added a symlink entry for mbotUSB (instead of ttyUSB?) to com1 in wine’s dosdevices folder

  • added a key in wine’s registry under Hardware\Devicemap\Serialcomm called “Serial0” with a string value of “COM1”

step one solves the problem of being connected variously as ttyUSB0, ttyUSB1, etc. at different times

step two makes the device available in wine

step three just makes the the com port detectable to mBlock b/c of how it’s probably looking for com ports via AIRSerial::getAvailable() function

you can look in SerialManager.as (which further filters the list from AIRSerial on just ports with a “COM” prefix) and other mBlock source files for more info as well, but the adobe air code is not available of course

hope that helps

brent


#9

@brent
Your posting gives me hope! Even though wireless still seems to be a problem.
But could you please add some details for the not so hacking experiened folks like me? It would be great if you could share the different steps to take fo follow your three mentioned steps. Hope these are not too many.

For those who ran into this posting and didn’t find the other one: there is another way to get your mbot working with linux using scratchx and using chrome
One can even use bluetooth that way!


#10

On Linux native Arduino ( no wine ) with USB cable and ‘Uno’ as target I can program the mBot and get most things working however the IR transceiver and the wireless serial 2.4G RF I cannot. I purchased this in the last month not clear if I need to update any firmware.

So far with the standard mBot setup I’m using …

Both Motors ok - MBotLeftWheel,MBotRightWheel
UltraSound ok - MeUltraSonicSensor PORT_3
Both LED’s ok - MBotRGBLed
LightSensor. ok - MeLightSensor PORT_7
Buzzer ok - MeBuzzer
LineFollowing - ok MeLineFollower PORT_2
Serial 2.4G RF - not working.
IR Tx/Rx - not working.


#11

Hi Brent
i am very sad about the statements of makeblock that a linux version of mblock is not forseen in the near future. Even about a workaround of linux with wine they are not interested (or able to).
So i am very entuthiastic about your success: That you was able to use the mblock in wine with the USB serial connection. But unfortunatly i am not a linux specialist and cannot follow your short instructions.
It would be very helpfull for me (and i asume a lot of other linux users) if you could give us a bit more detailled instruction how to use mblock.exe in wine.

Thank you very much in advanvce

Ole


#12

Well, and does the grey item Bluetooth become black?


#13

I have a linux mint 18 system. I was able to install mBlock but there were no listed serial ports. how do I get mBlock to connect to the arduino in linux mint 18 cinamon.


#14

Sorry for the very late reply - I’m new here.
We want to get mblock working on Linux, since that is the operating system of choice on our school. It’s sad that there is no Linux support yet, although it should be possible using Snap, avoiding the the closed source Adobe Air trap.
As it stands for now, I managed to get mblock working using a method inspired by @brent

This should work for Ubuntu 16.04 based systems:

  • The logged on user should be member of the group ‘dialout’
    ~$sudo adduser <your_username> dialout
    (might be ok by default - I need a clean machine to check that)
  • Install mblock using wine
  • Connect the robot using the USB cable and switch it on
  • do once:
    ~$ln -s /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 ~/.wine/dosdevices/com1
    (This symlink seems to be created automatically and is unique since it uses the ID of the device. I think that should make it fine to skip the extra udev rule.)
  • Before every start of the program:
    -$printf “\n\n[Hardware\Devicemap\Serialcomm] 1231984861\n"Serial0”=“COM1”\n" >> ~/.wine/system.reg
    (no idea how to get these lines persistent in system.reg)

#15

Attention MBOT operation only usb

Hello to all, copy this text notepad and saved as a script (.sh extension)
Once you do make it executable by the terminal as root with this command ( chmod +x )
Run it as root terminal root .
For the record I found this script on a Spanish blog, the name of the author and written in the script, a thank you to Fran M…

hello and good work,andy.

.

Before executing the script give permissions to the file


Autor: Fran M.

#!/bin/bash

if [ “$EUID” -ne 0 ]
then echo "Run the command as root: sudo $0"
exit
fi

if [[ -z “$SUDO_USER” ]]
then
SUDO_USER=$USER
fi

adduser $SUDO_USER dialout
usermod -a -G tty $SUDO_USER

echo ‘KERNEL==“ttyUSB0”, SUBSYSTEM==“tty”, SUBSYSTEMS==“usb-serial”, ATTRS{idVendor}==“1a86”, ATTRS{idProduct}==“7523”, SYMLINK+=“mbotUSB”’ > /etc/udev/rules.d/mblock.rules

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1

echo ‘[Hardware\Devicemap\Serialcomm] 1231984861’ >> ~/.wine/system.reg
echo ‘“Serial0”=“COM1”’>>~/.wine/system.reg

echo “Changes. You must restart the PC.”

read -p "Restart your PC now? (S/N) " sn
case $sn in
[Ss]* ) reboot; break;;
[Nn]* ) exit;;
esac



#16

MBOT wireless only with plug-in chromium ScratchX MBOT

Important to have installed plug-in chromium, or chrome MBOT

Check if the wireless key device and recognized see Winbond
Electronics Corp
COMMAND: lsusb

Then type the following command in the terminal
COMMAND: ls -l /dev/hidraw*

Now we know that the devices / dev / Linux hidraw not to the group not
They belong root but belong only to plugdev group.

Create new rule
COMMAND: sudo nano /etc/udev/rules.d/99-hidraw-permissions.rules
edit the following string

( KERNEL == “hidraw *”, SUBSYSTEM == “hidraw”, MODE = “0664”, GROUP = “plugdev” )

save (ctrl + o ) return ---- close ( ctrl + x ) return

Start service udev
COMMAND: sudo service udev restart
Make sure that your device belongs to the group plugdev
COMMAND: ls -l /dev/hidraw*
possibly disconnect and reconnect the adapter and repeat the command
COMMAND: ls -l /dev/hidraw*

Now our plug-in chromium, or chrome connects with MBOT

scratchx.org mbotx
http://scratchx.org/?url=http://mbotx.github.io/scratchx-mbot/project.sbx#scratch


#18

I have Linux 19.2 system. When I was working with mblock on linux I faced an internet issue because of my cisco wifi router not working. Can you give me a proper solution so that i can fix the issue?I got https://www.routertechnicalsupportnumbers.com/blog/fix-cisco-router-not-working/. Is this helpful.?


#19

Hi reese04,

Do you mean when you run mBlock on your linux computer, you can’t access internet on the computer? Do you run the mBlock 5 on the linux computer? https://www.mblock.cc/zh-home/software/?zhbanner

Besides, does the internet access work properly on the linux computer when you run other software?