Which Python modules to use? Compare LEGO’s EV3 MicroPython and EV3DEV’s Python – Part 2

Updated information for this post: In May 2020, LEGO released its LEGO MicroPython 2.0, which enhanced the functionality of LEGO MicroPython 1.0 dramatically. You could refer to another post: First Experience of LEGO MicroPython 2.0 for further information.


In the previous post, I explained the relationship between EV3Dev Python and EV3 MicroPython. They provide the similar functionalities but EV3Dev Python offers more methods to control the EV3 robot. After all, the development community of EV3Dev has been existed for many years.

In this post, I will compare the functionalities of Motor and sensors modules. They are the core of your robots. At the end of the post, I will compare the pros and cons of two versions of Python libraries and give my personal recommendation.

Motor Module

The following is the EV3Dev Python’s motor module. It realizes all of the functions in the LEGO block language. It also offers some new properties which the user could set or get (as I circle them in the frame).

MoveTank, MoveDifferential and Other Modules

EV3Dev Python also defines other relevant modules, such as the MoveTank module. It implements the same function of the LEGO’s MoveTank block by allowing two motors to run at different speed so as the vehicle could turn flexibly. It also wraps up a method called “follow line”, which uses the PID algorithm so that the vehicle could follow the line of any shape.

The advantage of EV3 Python is that it has already wrapped up some methods and users could use them just by calling. However, it might also make the users depend on those methods and ignore thinking about how and why the methods are designed like this. Take the example of “follow_line”, we should not only know how to use this method, but also understand the concept of PID and how to realize PID control by designing our own method. The medium level course at The Coding Fun will explain PID in detail.

Besides the MoveTank, there are several other modules such as MoveSteer, MoveJoySticks and MoveDifferential modules, which allow to control the EV3 vehicles more flexibly.


In EV3 Micro Python, although there are not so much varieties as that in EV3Dev Python, it does define a set of methods so that you could control motors and check if they are stalled or not. Via combining those methods, you could define your own MoveTank or MoveSteer methods.

Sensors Module

I am not planning to go through each sensor for comparison. I will list two sensors as examples to compare their differences.

Touch Sensor Module

In LEGO block language, sensors will work together with Wait block and Loop block as an judgement condition. EV3Dev Python has included those methods.


For EV3 MicroPython, there is only one method defined for touch sensor: pressed(). However, I would say it is enough generally. You could define your own methods to realize the function of “wait_for_pressed” or “wait_for_bump”, as shown below.

Gyro Sensor Module

As the other modules, EV3Dev Python realizes all the functionalities in LEGO block language. It also offers some additional methods such as “wait_until_angle_changed_by”, and “circle_angle”, so users do not need to wrap up their own methods.


LEGO EV3 MicroPython offers three methods: speed(), angle() and reset_angle(). If you want to realize the same function as “circle_angle”, or “wait_until_angle_changed_by”, you could define your own methods.

Recommendation

Through the above analysis, I believe many of you have noticed that EV3Dev Python offers far more functions than that of EV3 MicroPython (LEGO’s official version). More specifically, EV3 MicroPython is especially weak in controlling Display, Buttons and Sound.

As to motor module, although there are not as much functions as that of EV3Dev Python, EV3 MicroPython provides enough functions to control the motors move, turn and follow the line. Unless you plan to make your robot make very complicated move, motor module and robotics module are enough to manipulate your EV3 vehicle. Moreover, if you plan to develop your own methods to control the modules, this is a good starting point for you, because you have to learn to write your own methods due to the limited functionality of EV3 MicroPython. 🙂

As to sensors, my opinion is the same. Unless that you want to get/set complicated data from your sensors, those existing methods offered by EV3 MicroPython are generally enough for beginners. After all, the purpose of LEGO EV3 not only focuses on programming, but also emphasis on the mechanical design and holistic problem solving skills.

However, if you are serious to know more about EV3 programming, I would suggest you to install and use EV3Dev Python. Its rich methods and properties would make your robot more flexible and vivid in some sense.

Moreover, there are more sample code and projects showing on www.ev3dev.org. You could learn much from the community. It is active and new methods and properties are continuing being added to the latest version, which is advantageous to LEGO MicroPython. As I know, the existing version of EV3 MicroPython is the only one released and it has been over 1 years till now, there has not been any update.

Finally, a table summarizes the pro and cons, just for your reference.

EV3 MiroPythonEV3Dev Python
Installation EasyA bit complicated. but still be OK if you follow the step-by-step guide.
Running EnvironmentVS CodeVS Code
Supported Functionalitieslimited for Brick, Display and Buttons; generally enough for Motors and Sensors.Rich methods and properties. Have equivalent methods to that of LEGO Block language. Also define some new methods.
Community SupportWeak.Good. Community of EV3Dev allows you to interact with other EV3 fans or ask questions.
Sample code and documentationWeak. There is a user guide to be downloaded from LEGO website, but no other docs.Good. You could get sample code and API specification on the website.

One thought on “Which Python modules to use? Compare LEGO’s EV3 MicroPython and EV3DEV’s Python – Part 2

  1. Pingback: Several Ways to Design Your Own MoveTank Method by Using LEGO EV3 Micro Python – Coding Courses Designed for K12 Students

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.