Skip to content

Installation

Harco Kuppens edited this page Dec 6, 2022 · 65 revisions

About versions

Since this plugin is developed we saw new improvements on both the Ev3dev operating system as the Thonny IDE. This plugin is compatible with the Thonny IDE version 3. To get a good working system install the specific versions of the Ev3dev operating system and Thonny IDE mentioned below in the installation instructions.

In the future I will try to improve the plugin so that it also works with the eclipse and Intellij Idea IDEs.

Install Ev3dev operating system on sdcard

The thonny-ev3dev plugin requires an alternative operating system from a microSD card, called ev3dev, which makes it possible to run, a Debian Linux-based operating system. The ev3dev operating system runs from a microSD card and doesn’t ever touch the firmware installed on the EV3.

The thonny-ev3dev plugin requires a pretty new version called 'stretch' of the ev3dev operating system:

  1. download image here

  2. install the ev3dev image on the microSD card as described here: http://www.ev3dev.org/docs/getting-started/

Note: thonny-ev3dev requires a least the stretch version of ev3dev because it uses the new brickrun utility to supply starting the program on the ev3 remotely from the Thonny IDE, which then executes in the exact same way on the EV3 as if it was started from the brickman GUI on the EV3 itself. For details see the ev3dev-stretch fundamentals page. Also only since the stretch version of ev3dev does it support outputting the stderr to a .err.log file.

Note: if you are going to use bluetooth on the EV3 then you may apply the following fix to the installation.

Enable usb tethering mode on the EV3

The thonny-ev3dev plugin assumes by default that you use USB tethering mode on the ev3 with the default ev3dev credentials to connect with usb cable to the ev3.

ip=192.168.0.1
user=robot
password=maker

The reason for using usb tethering is the fixed ip=192.168.0.1. Once setup you can allows access the EV3 brick by just connect the usb cable and you can just connect using this ip address.

To enable tethering on the EV3 brick do the following:

  • Insert the microSD card into the EV3 brick
  • Disconnect USB cable (if connected)
  • Start (or reboot) the EV3 brick
  • In the menu select:
    • Wireless and Networks > Tethering > Gadget : click ‘enter/OK’ button to enable (if not yet enabled)
    • Note: switching between enable / disable does not work without rebooting
  • Then EV3 setups a LAN where the EV3 has IP address 192.168.0.1 and the EV3 brick is also the router of this LAN
  • This IP address is shown on top of screen when not connected to notebook/PC via USB – it disappears when connected via USB

For more details see Connect with EV3.

Install Thonny with the ev3dev plugin

Thonny is an Integrated Development Environment (IDE) for Python.
See the demo video at the website http://thonny.org/ which explains Thonny nicely. The thonny-ev3dev plugin extends the Thonny IDE to more easily program the EV3.

Portable Install of Thonny with the ev3dev plugin

At the releases page https://github.com/ev3dev-python-tools/thonny-ev3dev/releases you can download a portable installation of Thonny with the ev3dev plugin with simulator already installed.

Installation:

  • In Windows extract the zip file from the release page. Launch the program with thonny.exe
  • In macOS extract the zip file from the release page and simply copy the app bundle to /Applications. Launch the program as usual. Note: on the new M1/M2 macs the simulator does not work. This can be fixed by upgrading as follows:
    • Tools > Manage plugins
    • In the pop-up window, type in the Search box: ev3dev2simulator
    • Click Search button
    • Click Upgrade button

This installation is called portable, because it has no external dependencies, everything is contained within this portable folder.

If you want the latest version possible, you can better do the manual install, because the portable zip files are not build for every release.

Manually Install Thonny with the ev3dev plugin

Note: For M1/M2 macs this installation doesn't work, instead use the portable install above which does work.

  • Download and install the Thonny IDE version 3.2.6 from https://github.com/thonny/thonny/releases/tag/v3.2.6.
    Note: that newer versions probably also work but aren't tested.

  • Start the Thonny IDE

  • Within the Thonny IDE install the thonny-ev3dev plugin for easy programming the EV3 within Thonny:

    • Tools > Manage plug-ins
      Notice: not "Manage packages", we are now extending the Thonny IDE with functionality.
    • In the pop-up window, type om Search box: thonny-ev3dev
    • Click Search button – should find https://github.com/ev3dev-python-tools/thonny-ev3dev
    • Click Install button
  • This step only needs to be done when you have a different Python Interpreter installed within the Thonny IDE, because the 'ev3dev2simulator' package is also installed by the 'thonny-ev3dev' plugin. If you just installed Thonny, and don't understand this message, then you can safely skip this step!

    • Install the ev3dev2simulator package to install the simulated ev3dev2 API we use when running the python program on the PC using the ev3dev2simulator.

      • Tools > Manage packages
        Notice: not "Manage plugins", we are now extending the API we can use in our python programs.
      • In the pop-up window, type in the Search box: ev3dev2simulator
      • Click Search button
      • Click Install button
  • Exit Thonny and start it again (plugins are loaded at startup)

  • Connect the Thonny IDE to the EV3 brick as described here

  • From within the Thonny IDE give the command to install the ev3devlogging package on the EV3

    • Device > Install ev3devlogging to the EV3
  • You are now finished installing.

Advanced installation for rpyc steering mode or remote start/stop mode

Before you can use the rpyc steering mode you first must install a rpyc client package in Thonny and a rpyc server on the EV3.

Within the Thonny IDE install the ev3devrpyc package:

  • Tools > Manage packages
  • In the pop-up window, type in the Search box: ev3devrpyc
  • Click Search button
  • Click Install button

Installing a rpyc server on the EV3 can be easily done in two ways:

  • with the Thonny IDE:
        select the menu item "Device > Install the rpyc server on the EV3."
  • with the ev3dev command line tool:
        ev3dev install_rpyc_server

The remote start/stop mode uses both the ev3devcmd library's 'start' and 'stop' commands to start/stop programs remotely on the EV3 without using the buttons on the EV3.

The remote start/stop mode can also work without installing an rpyc server on the EV3. But in general it is advised to install an rpyc server on the EV3. The reason why is that the ev3devcmd library's 'stop' command can also work over the rpyc protocol, and then it works MUCH and MUCH faster then over the ssh protocol. The 'stop' command tries to use the 'rpyc' protocol, but when it fails communicating over that protocol it falls back the 'ssh' protocol which is available by default on the EV3.

Both modes work over the usb cable, but a bluetooth/wifi network connection can then be more convenient.

Dependencies

The thonny-ev3dev plugin, the ev3dev2simulator and the other ev3dev packages have the following dependencies:

  • thonny-ev3dev: ['ev3devcmd','ev3dev2simulator']
  • ev3dev2simulator: ['ev3devlogging','arcade','pyyaml','pymunk']
  • ev3devcmd: ['ev3devlogging','paramiko','rpyc']
  • ev3devlogging: [ ]
  • ev3devrpyc: ['rpyc']

Note: dependencies to modules in the python standard library are not listed.