Skip to content

ailuropoda0/gateway-python-grovepi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
    

About

No description, website, or topics provided.

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE.md
Unknown
LICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages