Tuesday, April 09, 2013

Remote Controlling a Car over the Web. Ingredients: Smartphone, WebSocket, and Raspberry Pi.

Inline image 2

At Kaazing, we have been experimenting with using a smartphone as a remote control for quite some time now. Those familiar with our demos may have seen our Zing-Pong demo (which is a “Pong”-style game using smartphones to control the paddles over WebSocket) or our Racer demo (which is a 3D Formula One car rendered in WebGL as a Chrome Experiment, and remotely controlled with a smartphone). These demos, along with the other demos we’ve created with Kaazing’s platform, use no plug-ins. You simply point a browser on your computer to the address of the object you want to control (for example, the gorgeous Formula One car rendered in WebGL) and a browser from your smartphone to the address of the remote control (an ID we generate for you). Once connected, you just…go!

A couple of our Visionary Zingers, Prashant Khanal and David Witherspoon, then experimented with communicating with a Raspberry Pi using WebSocket–or, more specifically, using Kaazing’s JMS-over-WebSocket Gateway to tell Raspberry Pi to turn on and off a lightbulb. When the lightbulb turned on in this experiment, another lightbulb turned on: could we in fact turn a remote, radio-controlled car into a remote, WebSocket-controlled car? By controlling the car over the Web, could we control the car from another room? From another continent?

The Racer Demo

Let’s first take a closer look at the Racer demo. The Racer demo uses the reflector pattern: where we connect devices through a WebSocket server, thus simulating peer-to-peer connectivity, a very easy-to-achieve task using pub/sub. When we developed the Racer demo, we walked through the steps to build it in The Simplest Way to Use Your Smartphone as a Game Controller: A WebSocket Race Car Demo. By examining how to use pub/sub concepts to control a virtual car, it’s not so farfetched to consider doing the same with a radio-controlled car.

Read more: The Zinger
QR: Inline image 1

Posted via email from Jasper-Net