Raspberry Pi Getting Started

Prerequisites

  • You’ve already have Raspberry Pi 2B/2B+
  • Raspbian has been installed on your Raspberry Pi
  • Make sure your Raspberry Pi has Internet access

Step 1: Downloading and Configuring Ruff SDK

  1. Download Ruff SDK and extract the contents。
  2. Configure the environment variables RUFF_HOME and PATH.
    Note: The methods below will apply only to your current session. Please refer to Environment Variables Configuration for instructions on making the configuration permanent.

    • Linux / OS X

      Open the terminal and execute the following commands one by one, replacing /path/to/ruff-sdk with the path of your extracted SDK:

      export RUFF_HOME=/path/to/ruff-sdk
      export PATH=”$PATH:$RUFF_HOME/bin”

    • Windows

      Open cmd and execute the following commands one by one, replacing X:\path\to\ruff-sdk with the path of your extracted SDK:

      set RUFF_HOME=X:\path\to\ruff-sdk
      setx PATH “%PATH%;%RUFF_HOME%\bin”

  3. Now execute rap --version in the command line. If the version of rap is printed as expected, PATH has been successfully configured.

    Note: Ruff SDK contains two executable files: rap and ruff. rap is the development toolkit with features like device pairing, application initialization, and driver and module managing. ruff is the runtime of Ruff. The PC version of ruff targets testing and simulation.

Step 2: Downloading and Configuring Ruff for Raspberry Pi

  1. Download Ruff for Raspberry Pi. Take 1.2.0 as example.
  2. Transmit ruffos-rpi-1.2.0.zip to your Raspberry Pi

    scp /path/to/ruffos-rpi-1.2.0.zip your_pi_user@your_pi_ip:/tmp
  3. Login your Raspberry Pi

    ssh your_pi_user@your_pi_ip
  4. Extract the package

    cd /tmp/
    unzip ruffos-rpi-1.2.0.zip
  5. Run installation script

    cd ruffos-rpi-1.2.0
    chmod +x install.sh
    ./install.sh
  6. Enable I2C on Raspberry Pi

Edit /boot/config.txt as follows and restart your Raspberry Pi.

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on

Step 3: Creating a Project

  1. Create a new project folder (e.g., hello-ruff). Change the directory to the created folder and use rap to initialize the application. Note: Create your new project folder outside of the Ruff SDK directory.

    mkdir hello-ruff
    cd hello-ruff

    rap init -b rpi-2b

    Raspberry Pi 2B is specified here as board argument for init task.

  2. Fill in information as prompted. You can use default values for all fields. rap will initialize the project, download configuration for the development board, and generate the hardware configuration file (ruff_box.json).

Step 4: Connecting a Device

  1. Execute the command rap scan in the application directory to scan your Ruff development board:

    rap scan

If everything goes well, you should see your Ruff device in the list, as follows:

Scanning (this will take 10 seconds)...
* [unnamed] - 192.168.31.123

Scan completed.

? select a device to interact: (Use arrow keys)
> [unnamed] - 192.168.31.114
  1. Press enter to select your device, and rap will remember it for future operations. This only takes effect in the application folder. Follow the rap prompts to set for the development board. You may also set up a password to avoid (to some degree) unauthorized operations.

Step 4: Getting Started

Refer to Getting Started, it’s time write your own Ruff application.