Skip to content

Raspberry Pi 2 3 4 and the Open Roberta Lab

Beate Jost edited this page Nov 16, 2020 · 4 revisions

It is highly recommended to check the raspberry's websites, especially https://www.raspberrypi.org/help/, where you will find all information about the necessary steps to get started.

You want to work with the Open Roberta Lab locally, e.g. in a classroom, with a raspberry pi? Here we explain all necessary steps to have a full working Open Roberta Server on a raspberry pi.


If you don't want to do it on your own (there are reasons for this) please use our ready to use image. It can be downloaded from here.


What you need

In addition to your Raspberry Pi 2 / 3 and a micro SD card for the system you will need:

  • micro USB-cable (power cable)
  • ethernet cable

you may also need

  • USB keyboard and mouse
  • monitor with HDMI cable
  • USB wifi adaper

you can get more information here

Preparing the SD-Card

Getting started with the Raspberry Pi provides you all necessary information how to download, extract and install the image to an SD card:

Currently there are three different downloads for a raspian image

  • Raspbian Stretch with desktop and recommended software
  • Raspbian Stretch with desktop
  • Raspbian Stretch Lite

We have tried all of them, they work without any issues. For the next steps, we have used the second option Raspbian Stretch with desktop:
Version: November 2018
Release date: 2018-11-13
Kernel version: 4.14

Headless Installation - If you don't have a monitor and/or mouse and keyboard by hand, copy an empty file with the name ssh (no file type) into the boot partition, see here.

Now slot in the SD card into your Raspberry Pi 2, connect a USB-Keyboard and Ethernet cable as well as a monitor and finally your micro usb power supply. Your Raspberry Pi 2 will turn on and boot from the SD card. Now login or connect to your Raspberry Pi via ssh (headless only) and login.

Default login information is:

User: pi
Password: raspberry

Configuring the Raspberry Pi

It is a good idea to configure the Raspberry Pi to your needs. The first basic configuration can be done via the Raspberry Pi configuration tool, for detailed information have a look here. In the following section you will find all configuration that has been done for the ready to use image from our website.

Raspberry Pi Configuration

Open a terminal or log in via ssh.
$ sudo raspi-config starts the configuration tool.
You can easily jump between the menu items with the up and down arrow keys. To select, finish or ok press the right or left arrow keys or use the Tab key.

  1. Change User Password, recommended but not changed for our image
  2. Network Options
    Change the hostname from raspberry to orlab
  3. Boot Options, nothing to do
  4. Localisation Options
    Change Locale, set up language and regional settings, for Germany e.g. choose "de_DE.UTF-8 UTF-8" (type a space to get a star there)
    Change Timezone, set up timezone to match your location
    Change Keyboard Layout, set the keyboard layout to match to your own, for Querz find a generic keyboard with 105 keys and choose German
  5. Interfacing Options
    P2 SSH, enable recommended
    P3 VNC, enable recommended
  6. Overclock, not recommended
  7. Advanced Options
    A3 Memory Split. Set to 16.
  8. Update recommended

Back at the raspi-config home screen click “finish” (2x Tab).
If you will be asked for rebooting the raspi, agree, otherwise reboot your Raspberry Pi with $ sudo reboot.

Installing the Open Roberta Server

Requirements

Requirements to install and run the lab server on your raspi:

JDK for EV3

seems to be already installed, please check with

$ javac -version
javac 1.8.0_65

Arduino based robots

$ sudo apt-get install libusb-0.1-4
$ sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc avrdude

NXT

$ sudo apt-get install nbc

Calliope

$ sudo apt-get install gcc-arm-none-eabi srecord libssl-dev

micro:bit

$ pip install uflash

Edison

seems to be already installed, please check with (Python 2 is needed)

$ python --version
Python 2.7.17

C4EV3

wget https://github.com/OpenRoberta/openroberta-lab/releases/download/ORA-3.6.0/C4EV3.Toolchain-2019.08.0-rpi.tar.gz
tar -xzvf C4EV3.Toolchain-2019.08.0-rpi.tar.gz
sudo mv C4EV3.Toolchain-2019.08.0 /opt/C4EV3.Toolchain-2019.08.0
rm C4EV3.Toolchain-2019.08.0-rpi.tar.gz
sudo ln -s /opt/C4EV3.Toolchain-2019.08.0/arm-c4ev3-linux-uclibceabi/gcc-8.2.1-uclibc-ng-1.0.31-binutils-2.31.1-kernel-2.6.33-rc4-sanitized/bin/arm-c4ev3-linux-uclibceabi-g++ /usr/bin/arm-c4ev3-linux-uclibceabi-g++

Bionics4Education

Follow the "Alternative Step 1" described here to build the compiler for Raspberry Pi, or run the following (takes about an hour on a Raspberry Pi 4):

sudo apt-get install gawk gperf grep gettext libncurses-dev python python-dev automake bison flex texinfo help2man libtool libtool-bin
mkdir ~/esp-tmp-build && cd ~/esp-tmp-build
git clone -b xtensa-1.22.x https://github.com/espressif/crosstool-NG.git
cd crosstool-NG
./bootstrap && ./configure --prefix=$PWD && make install
./ct-ng xtensa-esp32-elf
./ct-ng build
chmod -R u+w builds/xtensa-esp32-elf
cd ~
sudo mv ~/esp-tmp-build/crosstool-NG/builds/xtensa-esp32-elf /opt/xtensa-esp32-elf
rm -rf ~/esp-tmp-build
echo "export PATH=\$PATH:/opt/xtensa-esp32-elf/bin" >> ~/.profile

Open Roberta Lab server

Copy the server from the released versions on GitHub, just execute the following commands:

$ wget https://github.com/OpenRoberta/openroberta-lab/releases/download/ORA-3.4.1/robertalab-binaries.zip
$ unzip robertalab-binaries.zip
$ mv robertalab-binaries OpenRoberta 
$ rm robertalab-binaries.zip 
$ cd OpenRoberta

If you have a previously used database available you should copy it now into the OpenRoberta folder. For this documented version it might be something like db-3.4.1 or a lower version. If you don't have a database an empty one will be created with the first start of the server.

check if the server is running:

$ ./admin.sh start-embedded-server

open a browser window and type
localhost:1999 when logged in to the raspi
<ip>:1999 when accessed via ssh
If the Open Roberta Lab is available after some time (not more than 2 min) everything is fine, you can stop the server with Ctrl + c in command line.
If the Open Roberta Lab is not available try to execute the last command in the console again and check it again. Maybe a new start of the server is necessary because of an update of the database.

Start/Stop the Server

Please use the following script openrobertalab.sh. Copy it into the /etc/init.d/ folder, make it executable with

sudo chmod 755 /etc/init.d/openrobertalab.sh

and test it with the following command

sudo /etc/init.d/openrobertalab.sh start

you should now be able to access the Open Roberta Lab via
<ip> in your browser address field where ip is the ip of the raspberry pi. The script starts the Open Roberta Lab server with port 80 which is not needed to type in anymore.

With

sudo /etc/init.d/openrobertalab.sh stop

you will stop the server

This command makes sure that the script is executed each time the raspi boots:

sudo update-rc.d openrobertalab.sh defaults

You can test this with

sudo reboot

After some minutes your raspi has rebooted and automatically started the Open Roberta Lab server.

The script is also installed on our ready to use image.

Wireless connectivity

You can either set up wireless networking to connect your raspi pi to the internet or you can set up your raspi pi as an access point. For both versions please follow the instructions here. Our ready to use image has none of this installed.

Clone this wiki locally