Remote Sensing with Federated Wiki

By: WardCunningham

2011-08-27 16:48:27

A good architectural test for any protocol is to squeeze it into an under powered computer like an Arduino. For this and a few more reasons I've latched on to a project to publish field data from the Nike Community Garden as part of my work on the "Smallest Federated Wiki" (project videos).

Russell Senior helped by rummaging together enough radio gear to provide WiFi. Here's his install on the roof of a friendly neighbor with the garden in the distance.

img

Coding the server proved extra challenging due to limited literal text space. I solved that by including several custom DSL's, one for HTML and another for JSON. With them I can assemble full pages from short text fragments that are reused in numerous places (See code). Here is the loop that reports discovered one-wire thermometers:

for (int ch=0; ch<num(temp); ch++) {

 if (temp[ch].code == 0) {break;} sh();   k("type"); v("chart");   k("id"); v((long)temp[ch].code);   k("caption"); v("Fahrenheit");   k("data");     sa();       v(1314306006L);       v(temp[ch].data * (9.0F/5/16) + 32);     ea(); eh();

}

This DSL uses K for keys, V for values, SH and EH to start and end a hash, and, SA and EA to do the same for arrays. You can spot the centigrade to Fahrenheit conversion where an extra divide by 16 shows up because the DS18B20 reports in 1/16ths of a degree C.

See also Wikiduino Deployed.

Back to archive index