Greg Klein's Blog

Posts Tagged ‘ubiquiti

Ubiquiti and Spots

leave a comment »

A significant part of sensor networks, is, well, the network. The radio on the SunSPOT is designed for low power consumption, and works well in relatively short ranges, something like 50-100 meters at the very most. When a stronger radio is required, you’ve got to do something else.

Spot_and_ubnt

The black PCB in the picture is an Ubiquiti NanoStation2, with a range of several miles over Wifi. Below, of course, is a SunSpot. They’re talking to each other over serial, which is provided on the Ubiquiti (actually, as it would turn out, most routers seem to have serial on the board). To make it a bit easier to use, I put OpenWRT on it so that I could take advantage of their package management (I can run Perl!), and other niceties.

Anyhow, the whole thing was remarkably easy to do once I disabled the existing output on the serial. Apparently OpenWRT, by default, has a console running on the included serial.

I had to edit /etc/inittab and remove the line:

ttyS0::askfirst:/bin/ash –login

Once the serial was free, I just set the parameters using stty, and can now write to the serial using the command

cat > /dev/ttyS0

And read from it with

cat /dev/ttyS0

Writing to serial is easy with a Spot:

StreamConnection serialStream = (StreamConnection) Connector.open("edemoserial://usart?baudrate=9600&databits=8&stopbits=1&parity=none");
InputStream in = serialStream.openInputStream();
OutputStream out = serialStream.openOutputStream();

Pins D0 and D1 are Rx and Tx, respectively.

I think I’ll tie it up with some Perl to report values back to sensor.network.

Written by gregklein

July 30, 2009 at 5:18 pm

Posted in java, spaughts, sun

Tagged with , , , ,