Txtzyme Remote Signals

By: WardCunningham

2010-06-21 06:33:56

The Txtzyme Remote Server offers a Web 2.0 style interface through simple scripts written in Ruby and JavaScript. I've tested this by adding smart phone friendly signal processing. It looks like this:

img

Once you have selected a channel, you can refresh the waveform by tapping the display. (I've experimented with higher bandwidth communication but find it to be sporadic on the phone.)

This is what the Ruby (Sinatra) request handler looks like:

get %r{/ch/([0-9])} do |ch|
vect "101{#{ch}sp50u}", (0..100).map{|i|i*50}
end

This says, when someone asks for /ch/5, give them back 101 xy pairs sampled from channel 5 in a JSON document. This is ready made for jQuery/FLOT display with this Javascript:

$('[name=channel]').click(function(obj){
var ch = obj.currentTarget.value;
$.getJSON('ch/'+ch, function (data) {
$.plot($(".plot"), [data], {});
});
});

The punctuation here is a little hard to defend except to say that it is idiomatic jQuery. The third line is where the client hits the server to get samples from channel ch. And remember, this works on the phone.

The signal above is my favorite source, the 60Hz hum floating around my house. Here is what it looks like in the frequency domain:

img

The two large low peaks are 60Hz and 120Hz respectively. (I don't have the horizontal axis right here yet.)

This web server approach adds some installation complexity that can be avoided by working on the desktop. I've explored that option with a system I've called Javascope.

Back to archive index