Skip to content

KiiPlatform/ebisu-PiSample

Repository files navigation

This is a sample application for IoT SDK: ebisu running on Raspberry Pi. This sample updates temperature from sensor to kii cloud, and waiting command to turn on/off led.

Used Hardware

Setup Pi

Note: You should be already installed linux OS image to SD card of your Raspberry Pi. It is not the scope of this README about how to prepare a SD card.

prerequirement

connect to Pi via serial console

Note that you can connect to Pi with other ways, like usb keyboard and monitor. Use serial console is convenient. Please check the manual about how to do it, Using A Console Cable to Troubleshoot Additionaly, you need to add the following line to Raspbian boot image /boot/config.txt

enable_uart=1

The connected Pins is like the following 2 images: Image 1: connected serial cable Image 2: connected serial cable

In your ternimal console of PC:

# In mac with 115200 communication bit rate
screen /dev/cu.SLAB_USBtoUART 115200

install the necessary development package to compile source code

  • install build-essential

    sudo apt-get install build-essential
    
  • install libssl

    sudo apt-get install libssl-dev
    
  • install cmake

    sudo apt-get install cmake
    

    the version of cmake is required to be at least 3.5. So if the version of cmake in your OS is lower than it. You should consider to build cmake from source. You can try the following script to build cmake from source:

      sudo apt-get remove cmake
      wget https://cmake.org/files/v3.10/cmake-3.10.2-Linux-x86_64.sh
      sudo bash cmake-3.10.2-Linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/local
    
    
  • install wiringpi, library for gpio control

    sudo apt-get purge wiringpi
    

Pin numbering described in this README

GPIO BCM Pi number is used. Please check this official document about gpio of Raspberry Pi

You can simply refer the GPIO number from the following image: Image about GPIO pin of Pi

setup and connect 1-wire digital temperature sensor

Please check this tutorial to setup Pi.

  • Make sure signal pin of sensor connect to GPIO BCM 4 pin of Pi
  • Make sure GROUND pin of sensor connect to any GROUND pins of Pi
  • Make sure VCC pin of sensor connect to any 5V pins of Pi

update pin number in source code to connected sensor

Once 1-wire temperature sensor detected by Pi, there is a directory created to present this sensor. You can check by

ls /sys/bus/w1/devices

results like:

28-0416925607ff  w1_bus_master1

As above output, there is 28-***. It is connceted DS18B20 sensor. Change W1_FILE_NAME in pi_control.h with the actual value in your Pi. Please note that, if there are more than one DS18B20 sensors connected to Pi. There are more than one that kind of folder existing.

connect full color led

  • Connect GROUND pin of led to any GROUND pin of Pi.
  • Connect RED/GREEN/BLUE pins to any GPIO BCM pin of pi. In the sample, BLUE pin connect to GPIO BCM 13, RED pin connect to 19, and GREEN pin connect to 26

If you connect RED/GREEN/BLUE to different pins, you need to change the following defines in pi_control.h.

  • BLUE_LED
  • RED_LED
  • GREEN_LED

Build sample

make exampleap

How to use

Configure Environment

This requires tio already generated by last step.

  • setup LD_LIBRARY_PATH to find tio
    export LD_LIBRARY_PATH=./build-sdk/usr/local/lib
    

onboard a new thing in Developer Portal

Onboard with the following values:

  • thing-type: AirConditioner
  • firmware-version: 1.0

start up thing

./exampleapp onboard --vendor-thing-id={vendor-thing-id} --password={password}

About

Remote control sample with Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors