Page tree
Skip to end of metadata
Go to start of metadata
Content

> Home

Index:

 

 

 

To get started with your Raspberry Pi, you can find more information on their website: https://www.raspberrypi.org/help/


 

This is a Tutorial for installing the Open Roberta-server on a Raspberry Pi (Raspberry Pi 2 or 3).
It is also possible to install the server on a computer with Linux, Mac OSX or Windows.

The installation of this server might be a useful solution, if you want to use Open Roberta in an environment that isn’t able to connect to the official Open Roberta-server (i.e. incompatible encoding or no access to WLAN).

You will have to execute an instance of the Open Roberta – server on your Raspberry Pi, which will also be configured to act as WLAN-Access point. This facilitates a local connection to more EV3-Robots (that use the LEGO MINDSTORMS system).

 

 

Setup for Raspberry Pi 2 / 3

What you will need

  • Raspberry Pi 2 or 3
  • micro SD card (at least 4GB)
    --> To put the micro SD card into your Computer, you will need an adapter (SDHC or USB).
  • micro USB-cable (power cable)
  • ethernet cable (to ensure a reliable internet connection)
  • USB wifi adapter, possibly with WLAN antenna (Only necessary for Raspberry Pi 2, because Raspberry Pi 3 already has an inbuilt WLAN-chip with a small antenna. If you want to expand the range, you can also use an external USB wifi adapter for the Raspberry Pi 3.)
    recommended:
    Edimax EW-7811Un 150Mbps 11n Wi-Fi USB adapter

    or Lb-link 150mbps Mini USB 802.11n/g/b wireless adapter with antenna

Depending on the type of installation:

  • USB keyboard and mouse (see headless installation)
  • monitor with HDMI cable (see headless installation)

More information here

Preparing the SD-Card

To prepare the SD-Card you need to install the Raspbian operating system.
There are 3 possibilities for how you can do this:

  • NOOBS easy installer for Raspbian (and others):
    If you have no keyboard & mouse or a monitor, this is an instruction for a so called “headless” installation, which doesn’t need any of those parts.
    The installation of the Open Roberta-server is done by connecting the Raspberry Pi via a SSH connection.
  • NOOBS Lite network installer for Raspbian (and others):
    In this instruction, you will directly run the installation of the Open Roberta – server over your keyboard, mouse and monitor on your Raspberry Pi. (If you don’t have those parts, please use another option)
  • RASPBIAN image:
    An image of the Raspbian operating system is downloaded and manually written on the SD-card.

Click Installing Operating System Images (The README page from Raspberry Pi 2) to find more information on how to download, extract and install the image to an SD card.

NOOBS easy installer (Headless installation without keyboard/mouse/monitor)

To install the operating system without keyboard, mouse and monitor, you will need the NOOBS (New Out Of the Box Software).

  1. Insert the SD-card into your computer and download NOOBS easy install for Rasbian (a ZIP-file)

  2. Make sure that the SD-card has been formatted correctly (“FAT”).
    Right-click on your SD-card (for example in the Windows Explorer in the directory “Computer”) and click “format”. You need to select the “FAT” filesystem and start the formatting with “Start”.
    If the SD-card has been used before and still contains old files, this method might not work. The last section of this tutorial (How to reformat an SD-card) gives instructions on what to do in this case. Please do not proceed without making sure that your SD-card has been formatted correctly!

  3. Then unzip the ZIP-directory on your SD-card

  4. Then open the file "recovery.cmdline" with a simple text editor (just right-click on the file, click “Open with” and choose your preferred editor, e.g. “Editor” on Windows)

  5. There should only be one line in this file. Add silentinstall at the end of this line, so that it looks like this:
    runinstaller quiet ramdisk_size=32768 root=/dev/ram0 init=/init vt.cur_default=1 elevator=deadline silentinstall
    (Paul Lunow)

  6. Save the file and close the editor

  7. Now you can take out your SD-card (safely) and put it into your Raspberry Pi

  8. Connect the Raspberry Pi to your Router (with the Ethernet cable) and plug in the power cable (the micro USB-cable)

  9. The installation happens automatically. Meanwhile, the LED on the board should glow red. Consider, that this process may need up to 30 minutes, during which the Raspberry Pi needs to stay turned on.

  10. The installation is terminated when both LEDs glow constantly.

  11. You will access the Raspberry Pi via SSH. In order to build the SSH connection to an EV3, you can use programs like “PuTTY” for Windows. You will also need the IP-address of your Raspberry Pi (which is visible on your router’s DHCP table as “raspberry”). 
  12. From now on you can easily log in via SSH from any computer/laptop in your local network.

NOOBS Lite network installer (with keyboard, mouse and monitor)

If you have keyboard, mouse and a monitor, you can install the operating system using the NOOBS Lite network installer.

  1. Insert the SD-card into your computer and download the installer (a ZIP-file), which you can find here: https://downloads.raspberrypi.org/NOOBS_lite_latest

  2. Make sure that the SD-card has been formatted correctly (“FAT”).
    Right-click on your SD-card (for example in the Windows Explorer in the directory “Computer”) and click “format”. You need to select the “FAT” filesystem and start the formatting with “Start”.
    If the SD-card has been used before and still contains old files, this method might not work. The last section of this tutorial (How to reformat an SD-card) gives instructions on what to do in this case. Please do not proceed without making sure that your SD-card has been formatted correctly!

  3. Then unzip the ZIP-directory on your SD-card

  4. Now you can take out your SD-card (safely) and put it into your Raspberry Pi

  5. Connect the Raspberry Pi to your Router (with the Ethernet cable) and plug in the power cable (the micro USB-cable)

  6. Connect the Raspberry Pi to keyboard, mouse and monitor

  7. When the installation process starts, you need to choose “Raspbian” from the list of operating systems.

  8. The installation can take up to 30 minutes, during which the Raspberry Pi needs to stay turned on.

Raspbian image

The direct way of installing the operating system, is to write the Raspbian image onto the SD-card directly. (Here you will also need keyboard, mouse and monitor.)

  1. Insert the SD-card into your computer.

  2. Make sure that the SD-card has been formatted correctly (“FAT”).
    Right-click on your SD-card (for example in the Windows Explorer in the directory “Computer”) and click “format”. You need to select the “FAT” filesystem and start the formatting with “Start”.
    If the SD-card has been used before and still contains old files, this method might not work. The last section of this tutorial (How to reformat an SD-card) gives instructions on what to do in this case. Please do not proceed without making sure that your SD-card has been formatted correctly!

  3. Download the Raspbian image from https://downloads.raspberrypi.org/raspbian_latest. (You might have to unpack the zip file to see the image file)

  4. Also download a program that can write an image onto an SD-card, for example from Chip.de.
    If you use Windows, you could use “Win32DiskImager”

  5. When you open this program, it will give you the chance to search files in the directories on your computer by clicking on the folder symbol in the menu. Find and select the Raspbian image that you downloaded before.

  6. Select the name of your SD-card (find the name of your SD-card’s drive in the “Computer” directory next to the symbol of your SD-card)

  7. Click “write” to start writing the image onto the SD-card. This could take up to 10 minutes.

  8. Now you can take out your SD-card (safely) and put it into your Raspberry Pi

  9. Connect the Raspberry Pi to your Router (with the Ethernet cable) and plug in the power cable (the micro USB-cable)

  10. Also connect keyboard, mouse and monitor to your Raspberry Pi, so that you can work with it!

Configuring the Raspberry Pi

  1. If you have not done this already, put the SD-card into the Raspberry Pi, plug in Ethernet cable and power cable, so that your Raspberry Pi will turn on and boot from the SD card.

  2. If you are using headless, connect to the Raspberry Pi via SSH (as explained in the configuration section).
    Otherwise (with monitor/keyboard/mouse), login (User: pi, Password: raspberry) and open a terminal. (When you first use the Raspberry Pi with USB Keyboard, you will notice that it is set to the english  keyboard layout by default. This means that keys might not do what you expect them to do. For the german keyboard, y and x are switched and you can find - on the \. You will be able to configure the layout to suit your keyboard in the next step!)

  3. To do the first basic configuration, use the Raspberry Pi configuration tool (in more detail here).
    Start it by typing sudo raspi-config into the command line.
    (This means “superuser do” in short and allows the following commands to be executed with administrator rights, which is necessary for all commands that make changes on a system level!)

    By the way: You can also change the start options so that, after booting the system, you directly see the command line. This can be especially useful, if you don't want to use a mouse.

    (You can jump between menu items with up/down arrow keys. To select/finish/ok, press right/left arrow keys or Tab.)
    Go through the items in the Menu to customize:
  1. Expand Filesystem (to make sure that there is enough space on your SD card. File systems of NOOPS users is expanded automatically during installation.)

  2. Change User Password (so you can change the password. The Username is going to stay “Pi”)

  3. Boot Options (not important, you don't need to change this)

  4. Wait for Network at Boot (not important, you don't need to change this)

  5. Internationalisation Options (to change place, language, time zone and keyboard layout -> navigate the options and choose. An example: for Germany choose “de_DE.UTF-8 UTF-8” and press space to confirm. A generic QWERTZ keyboard has 150 keys.)

  6. Enable Camera (not important, you don't need to change this)

  7. Add to Rastrack (not important, you don't need to change this)

  8. Overclock (put this on “medium”, higher levels require additional cooling for the Raspberry Pi. If you do have additional cooling, select “Pi_2”)

  9. Advanced Options (this opens a sub-menu with the option “Memory split”. Choose this and set to 16)

  10. Back at the raspi-config home screen click finish (2x Tab)

  11. sudo reboot (this restarts your Raspbery Pi)

Updating the system

After the reboot, make sure your Raspberry Pi is up-to-date. You will require internet connection for this!

Type in the following commands:

  1. sudo apt-get update (update the list of available packages. This will take a few minutes.)

  2. sudo apt-get upgrade(upgrade the packages. You might need to confirm that files should be downloaded by typing “y”, pressing -> and enter. This will also take a few minutes.)

  3. sudo reboot (restart Raspberry Pi)

By the way:
 APT (Advanced Packaging Tool) is a package management system used by operating systems that are based on Debian (like Ubuntu or Raspbian).
The “apt-get” in the commands you used above is responsible for managing sources of the operating system by updating and upgrading packages (a lot of comparing versions and available options happens here).

Wifi Access Point

In this section you can read how to configure your Raspberry Pi as wireless access point. If you have a wireless router, you can use that instead and skip this step.

The aim is to use an all-in-one device that creates a wireless network, which computers, tablets, mobile phones and EV3-robots can connect to. This environment will allow you to program robots with the Open Roberta Lab.

Creating the wireless access point will take some time.
If you are using a Raspberry Pi 2, please follow these instructions (http://jankarres.de/2015/06/raspberry-pi-wlan-access-point-einrichten/ ) step by step.
For Raspberry Pi 3 you can use the same tutorial, but you should skip step 2*!

You will need a WIFI adapter, the ones mentioned before should work fine:

  • Edimax EW-7811Un 150Mbps 11n Wi-Fi USB Adapter
  • Lb-link 150mbps Mini USB 802.11n/g/b Wireless Adapter with Antenna

Some suggestions regarding the tutorial:

  • Use a simple password for the wireless network, since you will have to repeatedly type it into your EV3, which requires a lot of effort…
  • If a router is going to be used together with your Raspberry Pi, make sure that the IP-address of the router doesn’t clash with the IP-address of the Raspberry Pi!

*  Some information about Raspberry Pi 3 (i.e. why you skipped step 2 in the tutorial):

  • You need no additional WLAN-dongle, because the Raspberry Pi 3 has an integrated WLAN-chip
  • The program hostapd opens the wireless network and allows logging into it. The integrated WLAN-chip (of the Raspberry Pi 3) works with the regular version of this program (the dongles you have to use with Raspberry Pi 2 don’t).
  • Therefore, Raspberry Pi 2 requires you to manually install an adapted version of hostapd (described in step 2 of the tutorial). Raspberry Pi 3’s WLAN-chip is not compatible with this adapted version, which is why you need to skip step 2!

The Open Roberta Server

Requirements

There are a few requirements to install the Server on your Raspberry Pi. This is what you will need and how you can get it:

  • Git (a version control system, which is already preinstalled on the Raspbian operating system. Therefore, you need to do nothing here.)

  • JDK (the Java Development Kit)
    Type into your command line: sudo apt-get install openjdk-7-jdk

    This might take a while. You might need to confirm that you want to download the files by typing y and pressing enter.

    (The command “apt-get”, together with “install” installs the new package “openjdk-7-jdk”, which is the 7th version of the Java Development Kit. You will need version 7, because currently Open Roberta is not compatible with later versions of the JDK!)

  • Maven (a build-management-tool, which allows centrally administrating many stages of software development. Maven will help compiling and installing the OpenRoberta-server from the source code)

    In this case we will need a newer version than the one available in the official package sources of Raspbian. This means that we have to manually download and install it (and unfortunately cannot use “apt-get”, like before)!

    Type into your command line:

    • wget http://ftp.halifax.rwth-aachen.de/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz  
      (to download Maven from the server of the RWTH-Aachen. The file “apache-maven-3.3.9-bin.tar.gz” is now downloaded into your (user “pi”) home-directory.The file is a with gzip packed tarball-archive)

    • sudo tar -xzvf apache-maven-3.3.9-bin.tar.gz
      (Remember: “sudo” allows you to act as administrator, which is necessary to make changes on a system level.
      The command “tar” unpacks the tarball-archive. With “-xzvf”, you state four command options:
      - “x” means extract the tarball-archive
      - “z” says that it is a gzip packed archive
      - “v” stands for verbose and serves to display the progress of the tar-command on your command line
      - “f” means file, which indicates that the path to the archive follows. Since we are in the right archive already, we only need to write the file name.)

    • sudo mv apache-maven-3.3.9 /opt/
      (Here you want to move a file into another directory on system level, therefore you need the administrator rights again. With “mv” you move the folder “apache-maven-3.3.9”, containing your unpacked files, to the directory “/opt”, which is the standard directory for manually installed software.)

    • sudo nano /etc/profile.d/maven.sh
      (To tell your operating system about the maven-installation, you need to set some environmental variables. You want to create a script to set those variables, so that the changes don’t get lost with the next restart. This kind of script is usually saved in the system directory “/etc/profile.d”. Therefore, as administrator, you create the script “maven.sh” with “nano” in this directory.)

      The new script should now open in the editor, so that you can edit it. Add the following lines:

      export M2_HOME=/opt/apache-maven-3.3.9

      export PATH=$PATH:$M2_HOME/bin


      Now you can quit and save by pressing strg and x, confirm with y and press enter.

    • sudo logout
      Logging out is necessary to ensure that the script is executed with the next login and the changes actually take effect.

Downloading the server’s source code

First you should create a directory for the Open Roberta lab, by typing mkdir OpenRoberta into your command line. (“mkdir” stands for make directory and “Open Roberta” is now the name of the new directory.)

With cd OpenRoberta you can move into this directory (“cd” means change directory) and access it, create files etc.


Now you will need to download the needed files.
You can either use Git (As mentioned above, this is a version control system, which facilitates the collaboration of many programmers on one software project), or get the sources via download:

Get the Sources via Git

Type into the command line:

git clone https://github.com/OpenRoberta/robertalab.git
(to download the entire project from the indicated server. This might take a while.)

Now type cd robertalab to change into the downloaded directory “robertalab”.

Get the Sources via Download (faster)

Type into your command line:

wget https://github.com/OpenRoberta/robertalab/archive/master.zip
(this might take a while.)

unzip master.zip (unpack the zip file)

rm master.zip (remove this file. We won’t need it, since we now have its content separately.)

cd robertalab-master (move into the directory “robertalab-master”)

Compiling and installing the Open Roberta server with Maven

First change into the directory with information about the installation:
cd OpenRobertaParent

Next, start the installation with the following command:
mvn clean install –DskipTests

This might take up to 20 minutes, depending on the Raspberry Pi and your internet connection…
It will look a bit like this:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] RobertaParent ...................................... SUCCESS [ 10.845 s]
[INFO] Resources .......................................... SUCCESS [  0.176 s]
[INFO] OpenRobertaShared .................................. SUCCESS [ 19.516 s]
[INFO] OpenRobertaRuntime ................................. SUCCESS [  4.065 s]
[INFO] EV3Menu ............................................ SUCCESS [ 12.177 s]
[INFO] OpenRobertaRobot ................................... SUCCESS [01:35 min]
[INFO] OpenRobertaServer .................................. SUCCESS [02:54 min]
[INFO] OpenRobertaUSB ..................................... SUCCESS [ 10.804 s]
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:29 min
[INFO] Finished at: 2016-06-23T09:18:58+00:00
[INFO] Final Memory: 34M/95M
[INFO] ------------------------------------------------------------------------

 

Now type:
cd ..

(As you know, “cd” allows you to change directory.
The two dots are used instead of a specific target directory and only mean that you are moving up one level into the superior directory of the one you were in before.
“Moving up a level” is possible, because the directories are arranged in a tree structure!)

Start/Stop the Server

To start the server, we need to deactivate a line in the start script (“ora.sh”), which checks for a 64 bit Java version. Do this by typing into the command line:
sudo nano ora.sh

This will open the script. Inside, find the line with _checkJava;
Add a # in front of it to “comment it out”.
Now it should look like this: # _checkJava;

Now save and quit (strg and x, then y to confirm).


(If the Raspberry Pi was restarted or the terminal was closed, you will have to change to the directory that contains the start script beforehand. Just type: cd OpenRoberta/robertalab or cd OpenRoberta/robertalab-master, depending on how you got the sources.)


Now you can start the server.
(Usually the whole process is logged on the screen. Alternatively, you can save your logs to a file.)

To start the server, type                                             ./ora.sh --start-server
To start the server and save the logs, type            ./ora.sh --start-server > log.txt
(“>” redirects information to a file, in this case “log.txt”. This results in the process running in the background an all system messages being written in the specified text file.)

The server is ready, as soon as the line "XX Programs stored in the Database" becomes visible.

To access the server from a laptop, mobile phone or tablet, the device needs to be in the wireless network created by your Raspberry Pi.
The name of the network was determined in the configuration of the WLAN access point.


To access the OpenRoberta-server, you can type 10.11.12.1:1999 in the address bar in your internet browser. The numbers (10.11.12.1) are the IP-address of your Raspberry Pi, which was also determined in the configuration of the WLAN access point. If you chose a different IP-address, use that instead.


You should now be able to open the OpenRoberta lab in your browser.
Be aware that existing user accounts will only work inside the server, so if you previously created one, it won’t exist in this server.
To save programs you will have to create a new account in the server of your Raspberry Pi. Therefore, you will also only be able to share those programs with users that have an account on your Raspberry Pi!


If you want to stop your server, press ctrl and c.
(You might have to find the process ID first, if your server is running in the background. Do this by typing the command pidof java. With the given ID, for example 1385, type: kill 1385.

Creating a start script

Ideally, the Open Roberta server should directly be available after booting the Raspberry Pi without needing any further instructions.

For this purpose, you can create a start script, which will automatically start the server when you start your Raspberry Pi.
Then you won’t need to start the server manually every time, however, you should still shut down your Raspberry Pi properly, so that all NEPO-programs are saved and available the next time you start the server.

Step 2 will be much easier, if you can just copy and paste. This means that if you are not already accessing the Raspberry Pi through an SSH connection, you should try it out now. (You will need the IP address of your raspberry Pi)

Create such a start script by typing the following commands into your command line!

  1. cd /etc/init.d
    (to change into the system directory “/etc/init.d”, in which start scripts are usually created)

  2. sudo nano robertastart (create the script “robertastart” with the editor “nano”)

    The editor should now open, so that you can write the following code into the script:

    #!/bin/bash
    now=$(date +"%m_%d_%Y")
    dir="$PWD"
    cd /home/pi/OpenRoberta/robertalab/
    ./ora.sh --start-server>>log_$now.txt &
    cd $dir

  3. sudo chmod 755 /etc/init.d/robertastart

    (to make the script file executable)

  4. sudo update-rc.d robertastart defaults
    (to registrate the script for execution when the system is started)

    With the next time you restart your Raspberry Pi the script will go into effect and the Open Roberta server will be started automatically.
    Consider: The debug-output, which usually would appear on the screen, isn’t visible and will be redirected to a log file. The log files are saved and can be read later.

 

Should the server still not start automatically with every restart and you can't find the bug, be aware that you can still start it manuallly:

cd OpenRoberta/robertalab

./ora.sh --start-server

Shutting down the Raspberry Pi (properly)

If no button was built in for this purpose, the Raspberry Pi must be shut down manually to ensure that all created NEPO-programs are saved.
Shutting down the Raspberry Pi properly is always recommended, since otherwise the SD-card or the system could be damaged.


Shut down the Raspberry Pi with sudo shutdown -h now
(Since the Raspberry Pi is usually used without a monitor, we recommend to use the SSH connection with PuTTY.)


The Raspberry Pi has shut down completely when only the red LED glows and the green LED has stopped blinking. Now you can disconnect the power cable.

 


How to reformat an SD-card

Here you can learn, how you can delete your SD-card and reformat it.
This is especially useful, if it contains old files that you don't need anymore, the filesystem on the card is different, or if you want to reinstall the Open Roberta Firmware.

 

You will have to download a program for this purpose.

Installation with Windows:

  1. Download the freeware "Programm Partition Wizard FREE EDITION" here

  2. Find the installed file "pwfree9.exe" in your download directory (the directory, where files are automatically saved, is specified in your browser. If you didn't change it, it should be called "downloads")

  3. Doublecklick on the file to start the installation.
    (You will need to click "next" sometimes to proceed. Wait until the setup is finished.)

  4. Put the SD-card into your computer (for micro-SD-cards you will need a SDHC adapter to connect to the slot in your computer)

  5. After the installation, you will find a shortcut to "MiniTool Partition Wizard Free" on your desktop. Doubleclick to start the program.

  6. A window will open, click "launch application"

  7. Now you will see information about the memory on "Disk1", "Disk2".. You can usually recognize the SD-card from the USB-icon. You can also see, what has been installed beforehand. We want to delete all this for the SD-card.

  8. Select every line under the Disk with your SD-card (for example Disk2) and click "delete".
    Then click "apply" and confirm with "ok".

  9. Now we are going to create a new file system for the Open Roberta Firmware.
    To create a new partition on the SD-card, click "create".

  10. A new window will appear:
    1. Choose the file system "FAT" or "FAT32" (for headless and raspbian image)
    2. For the partition, select "primary". This is important, so that you can actually see the EV3 from the SD-card!
    3. (optional) Choose a label for the partition, for example "OpenRoberta"
    4. check, that everything is correct before clicking "ok"
    5. Now you need to click "apply" to create the partition. Wait until it is finished and click "ok" again

  11. Now you are done.
    You can close the program and you can use your SD card to install the Open Roberta operating system!
    Go back to the section Preparing the SD-Card.

 

 

 

 

 

 


 

  • No labels