whipped-cream

HTTP topping for Raspberry Pi


License
MIT
Install
gem install whipped-cream -v 0.2.0.beta1

Documentation

Whipped Cream

HTTP topping for Raspberry Pi Gem Version Build Status Code Climate

Whipped Cream logo

Whipped Cream is a tool which does a couple of things:

  • Parses a simple plugin DSL to create web servers for Raspberry Pi I/O (input and output).
  • Creates and tests plugins on your computer.
  • Deploys plugins to your Rapsberry Pis.

It has a CLI (command line interface) command which parses a plugin:

name "Garage"

button "Open/Close", pin: 18

...and can start a web server:

$ whipped-cream start garage.rb

Whipped Cream screenshot

...which can be deployed to your Pi:

$ whipped-cream deploy garage.rb 192.168.1.123
...

Getting Started

Get a Pi

You'll need:

  • Raspberry Pi
  • Power adapter
  • 4GB+ SD Card

You might also want:

  • Solderless breadboard & jumper cables, for prototyping
  • GPIO breakout cable (Adafruit), for easily extending the GPIO pins to your breadboard
  • Mini USB wifi adapter, for placing the Pi anywhere in your house when you're done
  • A case for your Raspberry Pi

Install Ruby on your computer

Whipped Cream runs on Ruby 1.9.3 and above.

Mac

We recommend ruby-install for installing Ruby versions, and chruby for switching between them. RVM will also work fine.

You can also install Ruby 2.0 with Homebrew.

Windows

RubyInstaller for Windows

Linux

Most package managers have recent Ruby versions available. Try sudo apt-get install ruby1.9.3 or sudo yum install ruby1.9.3. You can also use ruby-install and chruby.

Install the whipped-cream CLI to your computer

That's right, we're still on your computer, not your Raspberry Pi.

gem install whipped-cream

Check to make sure everything works

$ whipped-cream demo
[2013-10-11 07:59:19] INFO  WEBrick 1.3.1
[2013-10-11 07:59:19] INFO  ruby 1.9.3 (2013-06-27) [x86_64-darwin12.4.0]
[2013-10-11 07:59:19] INFO  WEBrick::HTTPServer#start: pid=5351 port=35511

You should now be able to point your browser to http://127.0.0.1:35511 and see the demo running.

Creating Plugins

Whipped Cream creates a web page which maps HTML controls to GPIO pins.

Pins

You'll want to use the pin numbering from the BCM chip (not the actual pin number, and not the WiringPi numbers).

Raspberry Pi Rev1 Raspberry Pi Rev2
Raspberry Pi Rev1 Raspberry Pi Rev2
Images from HobbyTronics

Controls

Name

Gets shown at the top of the page.

name "Garage"

Switches

Toggle a pin on or off.

switch "Light", pin: 24

Buttons

Momentarily turn a pin on for 0.25 seconds.

button "Open/Close", pin: 18

Sensors

Display something on the web page based on a pin's value.

sensor "Door", high: "Closed", low: "Open", pin: 23

Sensors can also be created with a block to show non-pin data.

sensor "Pi Uptime" do
  system 'uptime'
end

Testing

  • Run the tests with rake
  • Deploy to a Vagrant box with rake vagrant:deploy

Thanks

Web UI designed by Ashton Harris.

Logo designed by Jeff Bloch.