Starting leJOS might be very problematic, since you need to install a few libraries and make some configurations. In this video tutorial I am showing a step-by-step guide on how you could install leJOS on your Ubuntu Linux. And it is quite easy.
- 26 Apr 2013
In this lesson I will show you how
to flash the firmware of the brick
and install the a new firmware
based on the java platform.
All of this is thanks lejos project.
You can see it looks in a different way than the standard NXT firmware
002 - software
I will used the latest ubuntu linux as of this moment
In one of the next lessons
I will stop at working with other operating systems.
At the end of the lesson
we would have the new firmware installed and working.
003 - software
Currently there is a brand new virtual machine installed
on my computer.
This are the steps I will try to follow:
First download java
Second download lejos
Then download a tool called ant
The next step is setting environment variables... special for linux
Then we would have to download and install libusb. A library for the usb driver.
Then we have to configure the rules for accessing the usb
Adding udev rules and a new group
And at the end we have to reset the brick and install the new firmware
OK. lets do it.
Our first step is to install java on this computer. I am going to start a new terminal and I will try to install java on this ubuntu. Install open-jdk-6. You must install the JDK not the JRE version of java. Type in your password. There will be some downloading and installation. Yes. After the Installation we have java already installed on this computer. We can try it and type java and we can see different options. Java -version gives the version of this java installation.
Our next steps is to install lejos. I will start the Firefox browsers and search for lejos. We have two versions for the NXT brick and for the RCX brick. Download for the NXT. Since I am currently on an ubuntu I am downloading this tar archive. The version of lejos is 0.9.1 Download... Direct Link... Save..
After the downloading is complete we can open the containing folder, we can see the archive and we extract it here. Lets see what is in the archive. We have a few folders, bin, build, docs and lib. The main folder we need to access is bin, but before accessing the bin folder we must install one more tool and that is ant.
We again open the terminal and type in install ant. And we have ant already installed.
005 - installing usb driver
Our next step is to try to locate the NXT brick from ubuntu linux using lejos. I will go to the Downloads folder. But first I should probably zoom in here so that you can see more clearly what am I typing. We go to download then to lejos. Then we have several folders. One of them is bin. And in the bin folder we have a number of executables. The interesting one is ... well all of them are interesting, but the one that we need is nxjbrowse and when we type in nxjbrowse in the terminal we get the following error. We can not find an USB comm driver and a Bluetooth driver. So there is no way for this ubuntu linux to locate our NXT brick.
Now we must install the usb driver. Installing the usb driver is pretty straightforward I think. We can do a sudo apt-cache search and search for usb. We can see that there are many results for usb when we search the ubuntu repository. I will be more specific. I will search for libusb and for libusb we have let me find it... we have several.... libraries... and the one that we need...the one that we need is this one. libusb-dev. So we install libusb-dev.
If we now try to access the brick it will again give us an error because we must compile a library for native access using the driver. And this is done in the build folder. When we are in the build folder we type “ant”.
As a result we have builded a native library that can access on our machine the usb driver and lejos can use this jlibnxt. And it was installed correctly. Lets try to access the brick.
You might think this is all we should do, but if we now try to access the brick we get the same error. And even if we turn it on, the brick is turned on and type nxjbrowse, but again we have this error and our next step is to fix this error
After installing the usb driver there is one more step we should do and this is to configure the rules for accessing the usb.
For this we will go to the system folder, udev, then rules and we should create a new file called, might be called 70-lego.rules.
Now in this file you should describe the rules for accessing the usb. But you can see this rules on the site of lejos. Just to show you how to get there. You search on the internet, you go to the site of lejos, then in tutorial, then in getting started and because we are on linux we choose Linux. And then we have in this section a section called usb driver and we have the rules. We can just copy paste them. Copy. Then paste them. Save this file. In this file you can see that there is a group lego described, and to be able to access the usb driver we should add the user that we are currently using - kiril - to this group.
Adding a user to a group... you can do it in the following way. You can create a new group. Groupadd lego. Then you can add user Kiril to group Lego. Then because I am currently the user kiril and I can see that using groups I am already part of the group lego and if we now go to the folder, where we installed lejos and we start the brick, you might think that everything is ok, but when we start nxjbrowse we will again get an error that the brick is not found. And this here is the moment that you could either reload all the udev rules or just restart your system. I will keep it with the restarting the system.
008 Lejos is working
After the system is restarted we again make sure that the brick is working. Then we start a new terminal. We go to the Download and leJOS folder then bin. Because I am on a virtual machine I will make sure that the usb is connected. Yes it is recognize and if I now start NXJ browse, ....we are waiting...., we can see that the brick was found and we can now connect to this brick.
OK. So we are already connected to this brick.