Thursday, January 9, 2014

Programming Lego Mindstorms EV3 using LeJOS on Ubuntu Linux

I have been coveting a Lego Mindstorms Robotic kit ever since I learned there was one to be had and learning that the latest version, the EV3 runs Linux was the last straw. I was still hesitant because though the EV3 ran Linux there was no support for programming it in Linux, that is, from a PC running Linux. Out of the box the EV3 can only be programmed using a Windows or Mac machine, and even then only in a GUI suite ("visual programming") geared towards children.

What I needed was the power of a fully-formed language where I could program the EV3 using my Linux desktop (it is what I call my 7 year old laptop that I run only as a box). Lego had chosen to place Linux on the EV3 to make it more hackable and their foresight paid dividends when the LeJOS project was able to fork the open-source Lego kernel allowing them to place a JVM (Java Virtual Machine) and give access to the complete functionality of the EV3 using Java classes. Since I am an Android Developer by day, this was perfect.

The really great thing about the EV3 is that it comes with a micro-SD slot on which you can place your own bootable partition which allows you to change the firmware of the device without actually having to mod it. Basically, write a suitable image to a micro-SD card and the EV3 will boot from it. Remove the sd card and the EV3 will return to booting from the Lego firmware.

The LeJOS project provides a complete tutorial on how to create a micro-sd card that will run LeJOS on the EV3:

Stay tuned for more information on how to use a (supported) Wifi dongle (USB), program the EV3 using IntelliJ and automate the deployment of custom programs using ssh, make and gradle.

Happy hacking on the EV3.

4 comments:

  1. Hi buddy, I am glad to hear this.
    Thank you for telling us this great idea.
    How is the project going now?

    ReplyDelete
  2. Thanks Paul. It is going great.

    In fact on the basis of this blog I have been invited to write a book about the EV3 (and LeJOS) which will be published soon. You can look at a preview on http://www.packtpub.com/lego-mindstorms-ev3-essentials/book

    ReplyDelete
  3. The above mentioned book is now a reality. You can find copies on Amazon at http://www.amazon.com/Lego-Mindstorms-Essentials-Abid-Mujtaba/dp/1783553499/

    Anyone who has found my blog posts about LeJOS and EV3 useful or interesting will find the book full of similar nuggets of information

    ReplyDelete
  4. LeJOS is awesome! We have included support for LeJOS in the EV3 simulator to enable Java programming on the EV3

    ReplyDelete