If you have the Mindsensors EV3Console and you’re keen to use it on Linux, you’ll find that it is not immediately detected by the drivers built-in to Ubuntu 13.04. Have no fear, though, it’s fairly easy to fix. The specific distribution used here is Ubuntu 13.04. If you’re using something else, you may need to tweak some path names and parameters.
udev to the rescue
udev is a system that allows you to automatically run some pre-defined rules when a device matching a specific signature is added or removed. We’ll do the same for the EV3Console.
The VID (Vendor ID) and PID (Product ID) of the EV3Console is 0403 and abb9. We can use these values to create the following udev rule in a file named /etc/udev/rules.d/70-mindsensors-ev3-console.rules:
root@ubuntu:/etc/udev/rules.d# cat 70-mindsensors-ev3-console.rules ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="abb9", GROUP="users", MODE="0666", RUN+="/lib/udev/ev3console", SYMLINK+="ttyEV3"
That will also fix the permissions of the serial device that the EV3Console has created and make a fancy symlink from /dev/ttyEV3 to it. That way you don’t have to look up what device was attached to it. The script that it executes, /lib/udev/ev3console, has the following contents:
root@ubuntu:/etc/udev/rules.d# cat /lib/udev/ev3console #!/bin/sh /sbin/modprobe ftdi_sio && \ echo 0403 abb9 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id
Ensure that this ev3console script is executable.
Now when you plug it in, the /dev/ttyEV3 symlink will point to the correct USB TTY, which will have the permissions specified in the udev rule.
root@ubuntu:/etc/udev/rules.d# ls -l /dev/ttyEV3 lrwxrwxrwx 1 root root 7 Aug 15 04:27 /dev/ttyEV3 –> ttyUSB0 root@ubuntu:/etc/udev/rules.d# ls -l /dev/ttyUSB0 crw-rw-rw- 1 root users 188, 0 Aug 15 04:27 /dev/ttyUSB0
You can tighten up the permissions to this device if you like, by creating a new group and adding yourself to it. You’ll have to tweak the GROUP and MODE parts of the udev rules as well.
Accessing the console
You can now access the console at /dev/ttyEV3. I like to use the screen program for this, but there are many others. The EV3’s serial console operates at 115200 baud, using 8N1 (8 bit, no parity, 1 stop bit).
xander@ubuntu:~$ screen /dev/ttyEV3 115200
This should open a full screen session to your EV3.
You can exit the screen session with CTRL-A SHIFT-k.
How does it work?
The EV3Console uses an FTDI USB to UART bridge but the Product ID is not something that’s been added to the FTDI kernel module, yet. The cool thing is, you can dynamically add new IDs to the kernel module’s list of recognised devices. Simply echo the VID and PID into the /sys/bus/usb-serial/drivers/ftdi_sio/new_id file and you’re done. Now when it’s plugged in, you’ll see the following appear in your logs:
[2717184.665929] usb 2-2.1: new full-speed USB device number 15 using uhci_hcd [2717184.787965] usb 2-2.1: New USB device found, idVendor=0403, idProduct=abb9 [2717184.787968] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [2717184.787970] usb 2-2.1: Product: EV3Consol [2717184.787972] usb 2-2.1: Manufacturer: mindsensors.com [2717184.795042] ftdi_sio 2-2.1:1.0: FTDI USB Serial Device converter detected [2717184.795060] usb 2-2.1: Detected FT232RL [2717184.795062] usb 2-2.1: Number of endpoints 2 [2717184.795063] usb 2-2.1: Endpoint 1 MaxPacketSize 64 [2717184.795065] usb 2-2.1: Endpoint 2 MaxPacketSize 64 [2717184.795066] usb 2-2.1: Setting MaxPacketSize 64 [2717184.798242] usb 2-2.1: FTDI USB Serial Device converter now attached to ttyUSB0
Pretty nifty, eh?
Please note that I am not an expert on udev, in fact, this was the first time I’ve ever really looked into it. I am sure there are nicer ways to doing this. If you have suggestions, please leave a comment.
Very nice. I can’t wait to get going with this little beauty. I should receive mine within a week.
Hopefully I can get Linux working on my desktop… UEFI and Secure Boot doesn’t like Linux.
[…] Linux users: Xander has a great tutorial on getting this to work on his blog at http://botbench.com/blog/2013/08/18/tutorial-using-the-mindsensors-ev3console-in-linux/. […]
Do you think we can use the same commands to enable a different wireless usb dongle on the EV3? The WNA1100 that is currently supported is pretty hard to find!
No, there is no support for any other WiFi dongles compiled into the kernel or available as loadable modules.
Even if you did get another module compiled, the VM currently checks to make sure if the inserted WiFi modules is exactly the WNA1100. If it isn’t, it won’t enable wireless networking.
Hi,
I’m trying to get the sensor working but I’m working from a Windows machine. Unfortunately, I’m a little lost what I might need to do! I believe if I mount the operating system onto an SD card, I can customise the OS and then run the terminal from any machine. Do you have any idea how to do this? I’m a bit lost and not the most tech savvy person! Any help would be great.
Thanks!
You won’t be able to customise it under Windows. The SD card’s Linux filesystem is going to be a real chore to read. Consider using something like VirtualBox and a Ubuntu Virtual Machine to do your tweaking. It will save you a lot of hassle and you’ll learn something new in the process! Win-win 🙂
Hi Xander,
Thanks a lot! I have access to a Linux system, I have colleagues who are familiar with it. How do I actually get the OS onto the SD card and edit it? Any useful instructions you know of on the web? Sorry to be a pain, really not my expertise here!
Thanks!