
World Domination Using Arduinos and Websockets - craigkerstiens
http://kevinrohling.wordpress.com/2011/09/14/world-domination-using-arduinos-and-websockets/
======
slug
I've done a lot of microchip pic programming but for equally simple(read
beginners) and cheaper avr development I would recommend a teensy. Besides
using a standard pinout spacing you can also program it with the arduino ide
if you feel so inclined. Of course if you want to use the arduino shields,
it's more convoluted, but if you just want to light a few leds, read some
sensors, it should be enough.

Anyway, it's quite nice to have all these possibilities; some years ago the
barrier to entry was much higher, now with 10 minutes of tutorial reading you
can light a led or control a servo through your browser from the other side of
the world, which is fantastic.

~~~
jevinskie
Another great thing about the Teensy++ is that it has a AT90USB1286 which
offers 128 KB of flash and 8 KB of RAM. That is a big improvement over the
Arduino Uno's ATmega328 that offers 32 KB of flash and 2 KB of RAM.

~~~
simcop2387
This is one of the two things that got me to order one last night. Being able
to build with it on a breadboard makes a huge difference compared to the
arduino. I've got a number of fun projects to do that the breadboard makes
more fun to start. (Particularly things with model trains and monitoring
window sensors).

------
pingswept
Anyone know the current status of browser support for websockets? My
understanding is that FF 6 has them, but no other stable browsers do.

I've seen this Wikipedia chart:
<http://en.wikipedia.org/wiki/WebSockets#Browser_support> but it's not clear
to me what the different protocol versions mean in actual functionality.

~~~
zaphoyd
Current story on WebSockets

There are two components to web sockets. The WebSocket API under development
by the W3C/HTML5 groups (<http://dev.w3.org/html5/websockets/>) which defines
the javascript/browser API and the WebSocket Protocol under development by the
HyBi working group at the IETF
(<http://datatracker.ietf.org/wg/hybi/charter/>) which defines the actual wire
protocol.

The WebSocket API has been relatively stable for awhile, most of the changes
recently have been hashing out how to handle binary messages in javascript.

The WebSocket wire protocol has been undergoing more substantial development
in the past year and is presently in the Last Call phase of IETF
standardization. The final wire protocol has _not_ been fixed yet.

Protocol version numbers were added sometime last year and each version stands
for which draft version of the protocol the user agent is implementing. Not
all drafts change the wire protocol so some version numbers aren't used. The
purpose of the version numbers was to help folks who were writing test
implementations of websocket to keep track of which implementations should
work together for interoperability testing.

The draft/version number primarily indicates that the client can only talk to
servers that speak the same version. Clients typically support only one draft,
servers often support multiple drafts. The current draft
([http://tools.ietf.org/html/draft-ietf-hybi-
thewebsocketproto...](http://tools.ietf.org/html/draft-ietf-hybi-
thewebsocketprotocol-14)) uses protocol version 13. FireFox 6 ships with a
prefixed (MozWebSocket) websocket object that implements draft 7. FireFox 7
and 8 and Chrome 14 and 15 (beta and dev channels respectively) currently
implement draft 8, though this may change before they are shipped. Safari
5.0.1+ and Chrome 7-13 implement draft 0, an obsolete version from 2010.

Draft 7,8, and 13 are nearly identical, a server supporting one will likely
support all three. Draft 0 is significantly different. There is a list on
wikipedia of the major websocket implementations and which protocol versions
they presently support
([http://en.wikipedia.org/wiki/Comparison_of_WebSocket_impleme...](http://en.wikipedia.org/wiki/Comparison_of_WebSocket_implementations)).

The OP appears to be using a simplified version of a pre-draft 0 that Pusher
implemented. I am not actually sure why it is using websocket at all since it
doesn't appear to actually use the browser as the source of the connection. It
just happens to be using an early draft of the websocket protocol as it's
message framing mechanism.

~~~
pingswept
Thanks for taking the time to write up the details. I appreciate it.

------
Rinum
Arduino? Pshhh... just wait until the raspberry pies are done!

~~~
JonnieCache
In some senses this will be _harder_ on the raspberry pi. Certainly more
complex. You'd have to worry about the whole stack from the kernel upwards. On
arduino, you handcraft your protocol right on top of the TCP/IP lib and just
squirt it straight into the bootloader. Done.

------
chopsueyar
No talk about the network shields?

~~~
krohling
The subject of the post was more the software not the hardware. The Arduino in
the post is using the WiFly shield: <http://www.sparkfun.com/products/9954>

~~~
chopsueyar
Yeah, I know, however the author made it seem like all you need is an Arduino
(no mention of shields) and you can connect to a network.

