Giter Site home page Giter Site logo

gateway-python-grovepi's Introduction

gateway-python-grovepi

Python-based gateway service for GrovePi.

This code is based on gateway-python-SDK. You need to install SDK before using this repo. The way to install SDK is explained

Prerequisite

Hardware

Software

  • Python 2.7: This SDK is based on the Python 2.7.3  

Run code on GrovePi (Raspberry Pi)

Build the hardware

1. Prepare your Raspberry Pi os environment in your SD card

  • Download the OS for Raspberry Pi form RASPBIAN JESSIE
  • Format you SD card
  • Use window install the OS image to the SD card. you can use Win32 Disk Manager. I strongly recommend you do this using Windows, I have met many issues when i installed it by mac OS
  • Attach the SD card to the Raspberry Pi

You also can follow this instructions

2. Connect the GrovePi to the Raspberry Pi

3. Connect sensors to GrovePi

4. Connect Raspberry Pi with the power and network

5. Connect Raspberry Pi with Display using HDMI cable

 

Build the software environment

6. Install the Python 2.7.

  • Check the version of python that Raspberry Pi has. This sample code is based on python 2.7.3 or later. in most time, the Raspberry Pi os have installed the python 2.7.3 or later, if not, you can install the python follow here.

7. Install GrovePi SDK.

  • Make sure your Raspberry Pi is connected to the Internet.

  • Open Terminal.

  • Type the following commands in terminal window.

      sudo apt-get update
      sudo apt-get install rpi.gpio
    
  • Follow the tutorial for setting up the GrovePi.

  • Reboot your Raspberry Pi board.

Your SD card now has what it needs to start using the GrovePi. More information about installing GrovePi SDK  

Run GrovePi gateway service on Raspberry Pi

8. Install SDK and GrovePi gateway (on Raspberry Pi)

  • Download and install DevIoT python SDK.

      git clone https://wwwin-github.cisco.com/DevIoT/gateway-python-sdk.git
      cd gateway-pythohn-sdk
      python setup.py install
    
  • Download the gateway service for GrovePi.

      cd ../
      git clone https://wwwin-github.cisco.com/DevIoT/gateway-python-grovepi.git
      cd gateway-python-grovepi
    

9. Configure sensors.json and run the gateway service

  • Configure sensors.json according to types and pin of connected sensors.

    You can use Text Editor in Raspberry Pi, or Vim editor in the terminal window.

      vim sensors.json
    

    In Vim editor, you can only change the file in insert mode. Press 'i' and change the content. After modifying, press 'Esc' button and save the file and exit Vim editor by type ':wq' and press 'Enter'.

In sensors.json, there is the information of each sensor inside the parenthesis {}.

{
    "type": "light",
    "pin": "A2",
    "name": "GroveLight",
    "options": {}
}
  1. type: The name of a sensor class file. The python file having this name should be in cisco_grovepi.
  2. pin: The pin which the sensor is connected to. It should be string like "A1" or "D4", or pin number. You can check the details about it in here.
  3. name: The display name of sensor on DevIoT.
  • Run gateway service on Raspberry Pi.

      python main.py
    

gateway-python-grovepi's People

Contributors

changjun-cisco avatar haihxiao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.