Raspberry Pi + Arduino User Guide


Thing+ Guide for Raspberry Pi & Arduino

  1. Arduino Firmware install
  2. Environment Setting for Devices
  3. Environment Setting for Raspberry Pi
  4. Install ThingPlus Embedded package
  5. Gatway Registration



It needs connect internetwork to transfer got sensor data from Arduino. but Arduion, itself, can not connect Internet. so arduino is needed Gateway to connect internetwork as PC. This guide will be explained how to integrate arduino using raspberry pi as Gateway



1. Arduino Firmware install

1) connect Arduino with PC


2) Install Arduino IDE upon PC OS environment.


3) Run Arduino IDE.


4) Select USB for Arduino Port in IDE. (for windows, COMxx)

  • Tools -> Port -> Arduino/Genuino Uno Arduino Select Port


5) Select Firmware to download into Arduino.

  • File -> Examples -> Firmata -> StandardFirmata Arduino Select Firmware


6) Build Firmware.

Arduino Verify


7) upload Firmware to Arduino.

Arduino upload


8) Check if the below message shown at IDE.

Arduino upload Success




2. Environment Setting for Devices

1) Grove Starter Kit for Arduino


2) Connect Arduino and Grove Sensor Board. Arduino + Grove Starter kit


3) Connect sensors to the Grove Sensor Board.

Reference : LED polarity

LED polarity

Arduino + Grove Sensor Board + Sensors


4) Connect cables.

  1. Power off (detach power cable).
  2. Connect Raspberry Pi with sensors of arduino through USB calble.
  3. Connect USB powser cable and Ethernet(Lan cable) on Raspberry Pi board.

Raspberry Pi + arduino Raspberry Pi + arduino



3. Environment Setting for Raspberry Pi

ThingPlus Embeded will be installed on Raspberry pi. This guide will be explain about preparation for install


1) Micro SD card(8GB+ storage) is required.


2) Download Raspbian image from below link.

  • In case of RaspberryPi 2
    • Raspbian Image Download Link - Raspbian Image
    • We recommend 2015-09-24-RASPBIAN JESSIE version one.
  • In case of RaspberryPi 3
    • Raspbian Image Download Link - Raspbian Image
    • We recommend 2016-05-27-RASPBIAN JESSIE version one.


3) Intall OS on the micro SD card with the donwloaded image. Please refer the below link for more deails about the OS installation.

  • It can take few minutes to install the Raspbian image to the Micro SD card
  • Reference


4) Telnet/SSH Client is required for controlling the Raspberry Pi from your PC.

  • If you are a Mac or Linux user, please use the default terminal utility.
  • If you are a Windows user, we recommend that you use the “Putty” client to access your Raspberry Pi.
  • Putty Download link - http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe


5) Insert the Micro SD card into the Micro SD card slot of the back panel of your Raspberry Pi. Raspberry Pi + Micro SD card


6) Connect Ethernet(LAN cable), and Power Cable to Raspberry Pi.

For stable Power supply, we recommend that you connect the power cable not USB hub.If the power supply is unstable, the file resource can be broken.


7) Please wait your Raspberry Pi is booted up completely, and then Connect to it by using SSH Client(for Windows, the Putty)

  • When you can NOT get the IP Address of your device, please refer the Troubleshooting section.

  • ID: pi
  • Password: raspberry

    $ ssh pi@<IP Address>
    pi@<IP Address>'s password: raspberry
    
  • Example for Mac & Linux

    $ ssh pi@192.168.1.XXX
    pi@<IP Address>'s password: raspberry
    
  • Example for Windows

    • Run the putty, and Insert your IP Address, and then, Click the button Open and Enter a password. Raspberry Pi putty login Raspberry Pi putty login

Notice: In case of Windows, you have to re-launch putty, when Raspberry Pi is rebooted.


8) Update time of Raspberry Pi.

  • While installing an application, please Enter y for installation questions.

    @Pi:$ sudo su
    @Pi:$ apt-get update
    @Pi:$ apt-get install -y --force-yes ntp ntpdate
    @Pi:$ ntpdate -u ntp.ubuntu.com
    
  • If you failed to update the time, Update it directly.

    • UTC Time zone (Link): ex) 2015/01/01 00:00:00 => 2015-01-01 00:00:00

      @Pi:$ date --set '20XX-XX-XX XX:XX:XX'
      


9) To distinguish your Raspberry Pi, you need to modify the hostname of it.

Notice: You MUST use arrow buttons on your keyboard, when you want to move a cursor

  • Modify /etc/hostname.

    @Pi:$ sudo nano /etc/hostname
    
  • Change the raspberrypi in the file to your own name(letter, number and hyphen(-) allowed only) like the below image. Raspberry Pi Modify hostname

    • Press CTRL-O and press ENTER to save the changes and press CTRL-X to close the current file you opened and modified.
  • Modify /etc/hosts.

    @Pi:$ sudo nano /etc/hosts
    
  • Change the raspberrypi in the file to the same name you changed at before step. Raspberry Pi Modify hosts

  • Press CTRL-O and press ENTER to save the changes and press CTRL-X to close the current file you opened and modified.

  • To apply your modification, please reboot your Raspberry Pi.

    @Pi:$ sudo reboot
    


10) Re-connect to your Raspberry Pi. (Refer #7 step)


11) To use micro SD card which has storage bigger than 4GB, Run raspi-config.

@Pi:$ sudo su
@Pi:$ raspi-config


  • To use micro SD card which has storage bigger than 4GB, Choose 1. Expand Filesystem. Raspberry Pi + Grove Pi

  • Press Tab key on your keyboard and choose Finish, and then please Select Yes for the question about Rebooting the device. Raspberry Pi Choose Finish Raspberry Pi Choose Finish2





4. Install ThingPlus Embedded package

1) Run the Terminal to Raspberry Pi

2) Download the install script file.

@Pi:$ wget http://support.thingplus.net/download/install/thingplus_embedded_sdk_pi_arduino_install.sh

3) Grant a run permission to the script you downloaded and Install the Thing+ Embedded Package.

  • It can take few minutes to install the Thing+ Embedded Package.

    @Pi:$ sudo su
    @Pi:$ chmod 755 thingplus_embedded_sdk_pi_arduino_install.sh
    @Pi:$ ./thingplus_embedded_sdk_pi_arduino_install.sh
    

4) reboot raspberry pi

@Pi:$ sudo rebooted



5. Gateway Registration

Follow the Guide to register a gateway