본문 바로가기

라즈베리파이(RPI)

[추천][LIB] WebIOPi - Raspberry Pi Internet of Things framework


간단히 웹 서버 올리고 작업 할 생각이었는데 이미 웹으로 라즈베리 파이를 제어하기 위한 괜찮은 프레임워크가 있군요.^^

 

 

 

 

WebIOPi is a fully integrated Internet of Things framework for the Raspberry Pi.

  • Control, debug, and use your Pi's GPIO locally or remotely, from a browser or any app.
  • WebIOPi is the perfect Swiss-knife to make connected things with the Raspberry Pi.
  • Developed and provided by Eric PTAK (aka trouch).

Features

  • REST API over HTTP and CoAP (draft-14) with multicast support
  • Server written in Python with zero dependency
  • Supports GPIO, Serial, I2C, SPI, 1-Wire with zero dependency
  • Supports more than 30 devices including DAC, ADC, sensors...
  • Full Python library for the Server, GPIO, Serial, I2C, SPI and devices drivers
  • Compatible with both Python 2 and 3
  • Extensible and highly customizable
  • Login/Password protection
  • Mobile devices compatible
  • Includes debug web apps
    • GPIO Header
    • GPIO List
    • Serial Monitor
    • Devices Monitor
  • Javascript client library built on top of jQuery
  • Python client library with HTTP and CoAP support

What for

  • Use webiopi.GPIO library to control GPIO in your Python scripts
  • Use devices drivers to interact with DAC, ADC, sensors and more in your Python scripts
  • Use Serial, I2C and SPI webiopi classes in your Python scripts
  • Use the GPIO Header web-app to play with GPIO and debug circuits
  • Use the Serial Monitor web-app to debug Serial devices
  • Use the Devices Monitor web-app to debug devices like DAC, ADC, sensors and more
  • Create a web-app with the Javascript library to remote controls things connected on GPIO
  • Add webiopi in your existing Python script to simply add all WebIOPi features
  • Extends webiopi with your own macro
  • Extends webiopi with scripts loading facilities in a Arduino fashion way (setup, loop, destroy)
  • Use the Python Client to make Pi-2-Pi communication through the REST API
  • Use the Python Multicast Client to control multiple Pis with a single REST call
  • Use the Java Client to use the REST API from a Java application, including Android
  • Use the REST API from any technology/language

Where to start

 

 









 

 

 

설치방법

 

https://code.google.com/p/webiopi/wiki/INSTALL

WebIOPi is developed and tested on Raspbian.

You only need Python, either 2.7 or 3.2. Download, then extract and install WebIOPi. The setup script will automatically download and install required dependencies using apt-get. You may have to manually install GCC and Python development headers if you are not using Raspbian.

$ wget http://webiopi.googlecode.com/files/WebIOPi-0.6.0.tar.gz
$ tar xvzf
WebIOPi-0.6.0.tar.gz
$ cd
WebIOPi-0.6.0
$ sudo
./setup.sh

Finally, run Python using webiopi command :

$ sudo webiopi [-h] [-c config] [-l log] [-s script] [-d] [port]

   
Options:
     
-h, --help           Display this help
     
-c, --config  file   Load config from file
     
-l, --log     file   Log to file
     
-s, --script  file   Load script from file
     
-d, --debug          Enable DEBUG

   
Arguments:
      port                
Port to bind the HTTP Server

You're done, and ready to enjoy WebIOPi ! But the server and GPIO state will be lost when you'll stop the script (CTRL-C) or close the terminal.

You can also start/stop the background service :

$ sudo /etc/init.d/webiopi start
and
$ sudo
/etc/init.d/webiopi stop

You can even setup your system to start webiopi at startup :

$ sudo update-rc.d webiopi defaults

Usage

If your are directly using your Raspberry Pi with keyboard/mouse/display plugged, open a browser to http://localhost:8000/

If your Raspberry Pi is connected to your network, you can open a browser to http://raspberrypi:8000/ with any device of your network. Replace raspberrypi by its IP.

You can even add a port redirection on your router (and/or use IPv6) to control your GPIOs over Internet !

Default user is "webiopi" and password is "raspberry"

By choosing the GPIO Header link on the main page, you will be able to control GPIO using a web UI which looks like the board header.

  • Click/Tap the OUT/IN button to change GPIO direction.
  • Click/Tap pins to change the GPIO output state.