WebSockets, Raspis, and GPIO

socket

A while back, [Blaise] tried his hand at getting the WebSocket protocol working with PIC microcontrollers, WiFi adapters, and a few pots, knobs, and switches. It was an excellent project for its time, but now [Blaise] has a Raspberry Pi, and the associated GPIO pins and Ethernet connection. He decided it was time to upgrade his build to the Pi, this time with a project he calls PiIO.

The basic idea of [Blaise]‘s project requires a Pi, a server, and a computer running a browser for the end user. On the Pi side of the build, [Blaise] connected a Microchip MCP3008 eight input, 10-bit ADC via the SPI bus. The Pi takes the ADC sensor values from pots, buttons, or any other analog source and sends them to a server with the WebSocket protocol.

The server hosts a web site written with Django, Autobahn, and Python to communicate with the Pi and host the web page for the data received from the Pi. There’s support for multiple Pis in [Blaise]‘s build, making complicated projects we can’t even conceive very possible.

[Blaise] put up an awesome demo video of PiIO up; you can check that out after the break.

Comments

  1. the pic24-based microchip dev board with ethernet chip ($20) can replace “the server,” “pi,” and “ADC chip”. For a fraction of the cost, power, and effort. Comes with http stack already even

    • Pulsa Denura says:

      Then do it and post it.

    • This is true. In fact I did a project that hackaday hosted a while back that’s almost as you describe.

      http://hackaday.com/2011/11/03/using-websocket-with-pic-microcontrollers/

      Using the RPI allowed me to use Python and gave me access to the most up-to-date WebSocket libraries.

      It also allowed me to easily generalize the project. Allowing you to re-use the project for a variety of purposes without the need to write any code.

      Not to mention all the other advantages you get from using a device running a linux kernel, such as threading, and scheduling.

      If your intention is only to control one device for a single purpose in a more permanent setting a microcontroller solution is more ideal.

      The server can run on the RPI, but It’s not designed to. I designed this project to allow you to use any number of RPIs to provide scalability, thus it didn’t make any sense to put the server on the RPI.

  2. MORA says:

    Very well done, the idea of moving the configuration off the rpi makes it much less annoying when the SD dies, which sadly happens too often when power is lost while running.

    There is ofcause still some network setup, but if the network supports DHCP and config is saved with mac address, it should be plug’n’play from a “factory” sd card.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,784 other followers