One of the great things about the EV3 is that it is actually a very powerful computer. The graphical programming language developed by LEGO and National Instruments is excellent to get started with programming, but the EV3 can do much more. In fact, The LEGO Group encourages the community to unleash the full potential of the EV3 system by releasing the firmware source code and hardware schematics. Several community based projects such as LeJos are already starting to take shape. Another project that recently got my attention is ev3dev.
The ev3dev project is still under heavy development, and a lot of features and functionalities of the EV3 brick are still being implemented. I don’t think it’s quite ready for the beginning programmer at the moment, but it certainly looks promising. I’ll likely blog more about this project in the future. Meanwhile, check out their wiki.
The video above is a demonstration of a basic obstacle-avoidance Python program I created for the EXPLOR3R robot. With this setup, it is possible to write the program directly in a browser, which means that you can even program the EV3 from a tablet. Check out the source code here. In the rest of this post, I’ll give an overview of some of the essential components at work here. Note that this isn’t a tutorial, but rather some background information for those who are just getting started exploring all the possibilities of the EV3.
Much of it actually comes down to learning to play with Linux. (We’ll get to what Linux is in a moment.) I didn’t know anything about Linux until about one and a half years ago, when I started working on a university project for which I used the Beaglebone controller. As it turned out, it was a lot of fun to learn how to work with Linux, and it was actually not hard at all. On the other hand, once you master some basic skills, the possibilities are endless.
As with many technical topics, it can be difficult to get started if you’re completely new to the subject and its terminology. This post won’t cover all the basics, but my aim is to provide a starting point for further reading and discovery.
What is an operating system?
Before we can get to the basic working principles of ev3dev, we need to take a step back and look at how an EV3 program normally runs. To make this a bit more tangible, it’s helpful to think of the EV3 brick as a real computer. (It is a real computer, it just doesn’t look like a conventional PC.)
An EV3 program for your robot doesn’t just run on its own. In fact, many different programs are running at the same time, and there’s a certain piece of software that always runs on the brick, called the operating system. The operating system, or OS, handles a wide variety of tasks. For example, it manages which running programs can use the processor to calculate things and when. The OS also controls the devices connected to the brick, such as sensors. Basically, it makes the right thing happen at the right time, without you having to worry about it.
The computer, tablet, or phone you’re using to read this article is also running an operating system to manage which applications can use the processor and memory. In addition, it reads the input you enter with a keyboard or touch screen, and it displays the output of the applications on the screen. For example, if you enter some text in a messaging app, the operating system will tell the app what you entered. In turn, the app gives instructions to the operating system to display the text on the screen.
The operating system allows many other applications to work by letting them run at the right time, and by providing the applications with access to the devices attached to the computer.
What is Linux?
Popular operating systems include Windows, OS X, iOS, Android, and Linux. Some of these operating systems are specifically designed for certain types of devices. For example, Apple’s iOS is designed for portable devices with a touch screen, while Windows is widely used on desktop and laptop computers.
On the other hand, Linux can be customized to work on many different types of devices. Linux can power desktop computers, laptops, servers, TV’s, satellites, the Raspberry Pi, and even robots. Sure, most of these devices don’t really look like a conventional computer with a keyboard and a screen with shiny application icons on it, but that doesn’t make the operating system less important.
Linux is also free and open source. This means that any individual or company can adjust an existing version of Linux and use it for their own hobby project or commercial product. A customized edition of Linux is often called a distribution, or distro.
When LEGO designed the EV3 system, they developed their own Linux distribution for the EV3 brick. The menu you see when you turn the brick on is an application that runs on the Linux operating system.
Why do you never see the word operating system, or Linux, when using the standard EV3 software, you might ask? This comes down to terminology. In the LEGO software, the Linux operating system is referred to as firmware to keep things simple. When you click ‘update firmware’ in the EV3 software, you’re actually updating the Linux distribution. After all, not everyone needs to know about these technical details. (But you want to know about them.)
What is ev3dev?
You guessed it, ev3dev is another Linux distribution that can run on the EV3 brick instead of the Linux distribution designed by The LEGO Group.
The default LEGO distribution works well with the standard LEGO MINDSTORMS EV3 programming software, but because of its design, it’s not very suitable for other uses. For instance, it’s not trivial to install new programs such as Python. It’s probably possible — it is Linux after all — but it’s not easy for beginning developers.
Contrary, the ev3dev distribution is based on Debian, a popular Linux distro. Interestingly, operating systems like Ubuntu and Raspbian (the default Raspberry Pi operating system) are also based on Debian. This means that ev3dev already has a solid and easy to use operating system in place. Many things you can do with the Raspberry Pi can now also be done with the EV3. How cool is that? As a result, no EV3-specific steps had to be taken to get the programming environment demonstrated in the video (Python3 with iPython Notebook) installed on the EV3.
Right now, the ev3dev team are working on making it possible to access all of the EV3 hardware from the operating system. When ev3dev is closer to a first release, it could be interesting to create a more complete EV3 python library to make it even easier to program the EV3. There’s a lot more interesting topics to cover here, but I’ll save those for future blog posts. Stay tuned!