Warning: Table './lockneyn_dorkbotpdx/cache_page' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache_page WHERE cid = 'http://dorkbotpdx.org/blog/wardcunningham/feed' in /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc on line 172

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 488

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 489

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 490

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 491
WardCunningham's blog http://dorkbotpdx.org/blog/wardcunningham en Yow Revisited (in Txtzyme) http://dorkbotpdx.org/blog/wardcunningham/yow_revisited_in_txtzyme <p>The HDLx-2416 is a neat little four-character ASCII display that just happens to fit, pin-for-pin, on top of a Teensy as if the Teensy were made for it. I snagged one from the DorkbotPDX spare parts bin after Dave showed me now neatly his <a href="http://dorkbotpdx.org/blog/spacewrench/cool_thing_with_broken_teensy">Yow!</a> project fit together. Of course, while testing the limits of <a href="http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme">Txtzyme</a>, I had to put a Yow clone together.</p> <p><center><object width="400" height="225"><br /> <param name="allowfullscreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13776442&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=13776442&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object> <p><a href="http://vimeo.com/13776442">Yow Revisited</a> from <a href="http://vimeo.com/user4249751">Ward Cunningham</a> on <a href="http://vimeo.com">Vimeo</a>.</p> <p></p> <p></center></p> <p><!--break--></p> <p>I wrote the driver for this part in four steps corresponding to four distinct levels of abstraction required of such an application. These are:</p> <ul> <li>Signals on pins</li> <li>Registers within the part</li> <li>Methods, like flashing or scrolling</li> <li>Specific messages to be scrolled</li> <p>I wrote perl functions for each pin, each register, each method and each application of those methods that make up the demo in the movie. Here are some sample functions pulled from each section of the code:</p> <blockquote> <pre> # HDLx-2416 Pins sub wr_ { tz "4f 0o 1o"; } # HDLx-2416 Registers sub ch { my ($a, $ch) = @_; a $a; cue 0; cu_ 1; d ord($ch); wr_; } # Application Helpers sub txt { my ($t) = @_; for my $i (0..60) { msg (substr $t, $i, 4); tz "_wait_100m" }} # Scroll Application txt "Now is the time for all good men to come to Dorkbot."; </pre></p></blockquote> <p>With the rest of the pins, registers, helpers and applications, the program runs a full page. As always, you can find it in the <a href="http://github.com/WardCunningham/Txtzyme/blob/master/projects/yow/yowz.pl">Yow Project</a> page on GitHub. </p> http://dorkbotpdx.org/blog/wardcunningham/yow_revisited_in_txtzyme#comments Fri, 30 Jul 2010 23:58:58 -0500 WardCunningham 574 at http://dorkbotpdx.org Atmospheric Tides Wiggle My Barometer http://dorkbotpdx.org/blog/wardcunningham/atmospheric_tides_wiggle_my_barometer <p>My friend Karl gave me an <a href="http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MPX4250">mpx4250</a> absolute pressure sensor that never got built into his DIY automotive super-charger. I hooked it up to <a href="http://dorkbotpdx.org/blog/wardcunningham/sensorserver_aproaching_1_0">SensorServer</a> and started recording data that looks like this:</p> <p><a href="http://dorkbotpdx.org/node/572"><img src="http://dorkbotpdx.org/files/images/Screen shot 2010-07-27 at 6.53.05 PM.png" width="408" height="247" title="" alt="Barometer on SensorServer" style="display: block; margin-left: auto; margin-right: auto;" /></a></p> <p>The sensor's four-atmosphere dynamic range leaves weather fluctuations mostly in the noise. But that doesn't mean some interesting things haven't shown up. For example, the above chart shows a diurnal variation that I now know is caused by <a href="http://en.wikipedia.org/wiki/Atmospheric_tide">Atmospheric Tides</a>.</p> <p>I'm pleased to be logging this data with Txtzyme which I have integrated into my SensorServer network. I've described my Sinatra based <a href="http://dorkbotpdx.org/blog/wardcunningham/remote_control_with_txtzyme">Txtzyme Remote</a> project in a previous post. I added this code to that server:</p> <dl> <dd>get '/ss' do</dd> <dd><dl> <dd>{ :mpx4250 =&gt; avg(&quot;100{6sp150u}&quot;) }.to_json</dd> </dl> </dd> <dd>end</dd> </dl> <p>This says, take 100 samples from channel 6 sampling every 150 microseconds or so. Average these and report the answer in a SensorServer-ready JSON key-value pair. (See <a href="http://github.com/WardCunningham/Txtzyme/blob/master/projects/remote/server.rb">code</a>, <a href="http://c2.com/ward/arduino/SensorServer/recent.cgi?code=mpx4250&amp;hours=96&amp;smooth=0.9">graph</a>)</p> <p>Unlike ocean tides, atmospheric tides are caused by solar heating stirring the sparse air at 100 km altitude. I see this as pressure that falls all day and recovers each night. Both Newton and Leibnitz reported similar observations over 100 years ago.</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/atmospheric_tides_wiggle_my_barometer#comments Tue, 27 Jul 2010 22:14:09 -0500 WardCunningham 573 at http://dorkbotpdx.org Pre-Built Txtzyme Hex Files and More http://dorkbotpdx.org/blog/wardcunningham/pre_built_txtzyme_hex_files_and_more <p>I've pre-built hex files for the standard <a href="http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme">Txtzyme</a> interpreter. In this post I show you where to find them and where to find a longish but still simple Txtzyme program to run on it.</p> <p>Choose the download for your Teensy:</p> <ul> <li> <a href="http://github.com/WardCunningham/Txtzyme/raw/master/hex/at90usb162.hex">Teensy 1.0</a></li> <li> <a href="http://github.com/WardCunningham/Txtzyme/raw/master/hex/at90usb646.hex">Teensy++ 1.0</a></li> <li> <a href="http://github.com/WardCunningham/Txtzyme/raw/master/hex/atmega32u4.hex">Teensy 2.0</a></li> <li> <a href="http://github.com/WardCunningham/Txtzyme/raw/master/hex/at90usb1286.hex">Teensy++ 2.0</a></li> </ul> <p>&lt;!--break--&gt; Load this file with the <a href="http://pjrc.com/teensy/loader.html">Teensy Loader</a>. When you're done, try blinking the Teensy's LED with a command like:</p> <dl> <dd>echo &quot;<strong>5{1o 100m 0o 100m}</strong>&quot; &gt;/dev/cu.usbmodem12341</dd> </dl> <p>This works from OS X's Terminal program.</p> <h2 id="toc0">Morse Code</h2> <p>You'll want to try something with your new Txtzyme interpreter. I've worked up a half-dozen sample projects and shared them on GitHub. The first ever project used simple programs like these to blink Morse code (o for output, m for millisecond delay):</p> <ul> <li> <strong>1o 50m 0o 50m</strong> for dot</li> <li> <strong>1o 150m 0o 50m</strong> for dash</li> </ul> <p>I've refined this a little so that Txtzyme also generates a tone while it blinks. The attached file (morse.txt) contains generated commands you can send straight to your Teensy. Here is a shell one-liner to do it:</p> <dl> <dd>curl <a href="http://dorkbotpdx.org/files/morse.txt">http://dorkbotpdx.org/files/morse.txt</a> &gt;/dev/cu.usbmodem12341</dd> </dl> <p>Of course you will want to try different messages. Here is the <a href="http://github.com/WardCunningham/Txtzyme/raw/master/projects/morse/morse.pl">perl program</a> I used to generate the attachment. Read more about the translation logic on the <a href="http://github.com/WardCunningham/Txtzyme/tree/master/projects/morse/">Txtzyme Morse</a> project page.</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/pre_built_txtzyme_hex_files_and_more#comments Sun, 25 Jul 2010 15:26:05 -0500 WardCunningham 571 at http://dorkbotpdx.org These Lights Were Made for Blinkin' http://dorkbotpdx.org/blog/wardcunningham/these_lights_were_made_for_blinkin <p>Paul has built some nifty demo boards for Teensy and Teensy++ computers that have an LED and push button for every available pin. After struggling through an obscure USB bug, I'm proud to say that I've got these lights a blinkin'.</p> <p><object width="400" height="300"><br /> <param name="allowfullscreen" value="true" /> <param name="allowscriptaccess" value="always" /> <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13269669&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=13269669&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object> <p><a href="http://vimeo.com/13269669">Txtzyme Teensy Demo</a> from <a href="http://vimeo.com/user4249751">Ward Cunningham</a> on <a href="http://vimeo.com">Vimeo</a>.</p> <p>My laptop orchestrates this performance. I launch the sequencer script with this open-ended shell command which forks as many processes as I have demo boards:</p> <dl> <dd>for i in /dev/cu.usbmodem*; do (perl sequence.pl $i &amp;); done</dd> </dl> <p>The sequence.pl script uses a new Txtzyme command, <em>v</em> for version, to sense which flavor of Teensy its talking to and then sets up appropriate arrays of pin numbers for the various effects.</p> <p>Here is an effect I call <em>Twinkle</em>:</p> <dl> <dd>putz shuffle(map("$_ 1o 8m",@all), map("$_ 0o 8m",@all));</dd> </dl> <p>This uses map to create Txtzyme code to turn on and turn off all of the pins. Each operation is in a short string, something like "6d 1o 8m", which outputs 1 to one pin and then pauses 8 milliseconds. Before I send the mapped collections to the Teensy, I shuffle them together with the handy perl library shuffle routine.</p> <p>As always, I've pushed this up to a Txtzyme <a href="http://github.com/WardCunningham/Txtzyme/tree/master/projects/demo/">project page</a> on GitHub.</p> http://dorkbotpdx.org/blog/wardcunningham/these_lights_were_made_for_blinkin#comments Mon, 12 Jul 2010 09:33:26 -0500 WardCunningham 567 at http://dorkbotpdx.org Txtzyme Remote Signals http://dorkbotpdx.org/blog/wardcunningham/txtzyme_remote_signals <p>The Txtzyme <a href="http://dorkbotpdx.org/blog/wardcunningham/remote_control_with_txtzyme">Remote Server</a> 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:</p> <p><a href="http://www.dorkbotpdx.org/node/561"><img src="http://www.dorkbotpdx.org/files/images/Screen shot 2010-06-21 at 5.58.11 AM.png" width="367" height="295" title="" alt="Remote Waveform" style="display: block; margin-left: auto; margin-right: auto;" /></a></p> <p>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.)</p> <p>This is what the Ruby (Sinatra) request handler looks like:</p> <dl> <dd>get %r{/ch/([0-9])} do |ch|</dd> <dd><dl> <dd>vect &quot;101{#{ch}sp50u}&quot;, (0..100).map{|i|i*50}</dd> </dl> </dd> <dd>end</dd> </dl> <p>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:</p> <dl> <dd>$('[name=channel]').click(function(obj){</dd> <dd><dl> <dd>var ch = obj.currentTarget.value;</dd> <dd>$.getJSON('ch/'+ch, function (data) {</dd> <dd><dl> <dd>$.plot($(&quot;.plot&quot;), [data], {});</dd> </dl> </dd> <dd>});</dd> </dl> </dd> <dd>});</dd> </dl> <p>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.</p> <p>The signal above is my favorite source, the 60Hz hum floating around my house. Here is what it looks like in the frequency domain:</p> <p><a href="http://www.dorkbotpdx.org/node/562"><img src="http://www.dorkbotpdx.org/files/images/Screen shot 2010-06-21 at 5.58.31 AM.png" width="364" height="295" title="" alt="Remote Specturm" style="display: block; margin-left: auto; margin-right: auto;" /></a></p> <p>The two large low peaks are 60Hz and 120Hz respectively. (I don't have the horizontal axis right here yet.)</p> <p>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 <a href="http://dorkbotpdx.org/blog/wardcunningham/txtzyme_javascope_feeds_javas_2d_graphics">Javascope</a>.</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/txtzyme_remote_signals#comments Mon, 21 Jun 2010 08:33:56 -0500 WardCunningham 563 at http://dorkbotpdx.org Remote Control with Txtzyme http://dorkbotpdx.org/blog/wardcunningham/remote_control_with_txtzyme <p>I've put together a small server to relay web requests to a Teensy running <a href="http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme">Txtzyme</a>. The Sinatra framework brings together assorted technologies to offer secure, reliable, convenient and even friendly remote control.</p> <p><a href="http://www.dorkbotpdx.org/node/551"><img src="http://www.dorkbotpdx.org/files/images/TxtzymeRemote.jpg" width="360" height="240" title="" alt="Txtzyme Remote interface" style="display: block; margin-left: auto; margin-right: auto;" /></a></p> <p>This simple screen illustrates how more functional programs can be constructed. jQuery manages AJAX requests for both input and output. GET and PUT requests map to Txtzyme i and o commands: &lt;!--break--&gt; <dl> <dd>get %r{/([b-f])/([0-7])} do |port, pin|</dd> <dd><dl> <dd>tz &quot;#{pin}#{port}ip&quot;</dd> </dl> </dd> <dd>end</dd> </dl> </p> <dl> <dd>put %r{/([b-f])/([0-7])} do |port, pin|</dd> <dd><dl> <dd>tz &quot;#{pin}#{port}#{params(:state)}op&quot;</dd> </dl> </dd> <dd>end</dd> </dl> <p>Sinatra uses regex patterns (%r strings in Ruby) to recognize and extract parameters (port and pin) from Restful requests. The <em>tz</em> helper <em>puts</em> its argument to the Teensy USB devise and <em>gets</em> a single response which is returned back to the client AJAX callback.</p> <p>How many frameworks does it take to turn on an LED? A half dozen it appears. Find all of them in the <a href="http://github.com/WardCunningham/Txtzyme/tree/master/projects/remote/">demo project</a> on GitHub</p> <p>Read more Remote related posts here:</p> <ul> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/txtzyme_remote_signals">Txtzyme Remote Signals</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/atmospheric_tides_wiggle_my_barometer">Atmospheric Tides Wiggle My Barometer</a></li> </ul> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/remote_control_with_txtzyme#comments Fri, 18 Jun 2010 00:33:19 -0500 WardCunningham 552 at http://dorkbotpdx.org Visual Perception Study with Txtzyme http://dorkbotpdx.org/blog/wardcunningham/visual_perception_study_with_txtzyme <p>I thought I found a bug testing blinking <a href="http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme">Txtzyme</a> examples. Although I could see the Teensy LED blinks uniformly and distinctly, I saw the wrong number of blinks. It turns out the bug is in my brain, not my program, as this data shows:</p> <p><a href="http://www.dorkbotpdx.org/node/549"><img src="http://www.dorkbotpdx.org/files/images/Screen shot 2010-06-15 at 11.29.22 AM.png" width="397" height="413" title="" alt="Visual Perception Study Results" style="display: block; margin-left: auto; margin-right: auto;" /></a></p> <p>The data shows how many times I saw a particular number of blinks (the columns) when the blinks had a half-cycle period of a particular millisecond duration (the rows). &lt;!--break--&gt;</p> <p>Here is the loop I used to acquire this data:</p> <dl> <dd>`say ready`;</dd> <dd>while() {</dd> <dd><dl> <dd>`echo 300m5{1o${period}m0o${period}m} &gt;$teensy`;</dd> <dd>$result = getc;</dd> <dd>last if $result =~ /[1-9]/;</dd> <dd>`say again`;</dd> </dl> </dd> <dd>}</dd> <dd>`say good`;</dd> </dl> <p>I'm using the mac's voice synthesis so that I can focus on the blinking. Any invalid response repeats the stimulus. This way I could watch the blink over and over until I was sure.</p> <p>My <em>brain bug</em> is that although I perceive each light pulse clearly, distinctly and uniformly, my number perception <em>drops pulses</em> when they come too fast. I've measured my speed threshold to be around 200ms. I've tested others and found that this number varies.</p> <p>I'll expect Dorkbot regulars to give this test a try at next Monday's meeting. I've also posted code and more results as another <a href="http://github.com/WardCunningham/Txtzyme/tree/master/projects/blink/">Txtzyme project</a> on GitHub.</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/visual_perception_study_with_txtzyme#comments Tue, 15 Jun 2010 14:18:51 -0500 WardCunningham 550 at http://dorkbotpdx.org Txtzyme Javascope Feeds Java's 2D Graphics http://dorkbotpdx.org/blog/wardcunningham/txtzyme_javascope_feeds_javas_2d_graphics <p>In my last post I described plotting <a href="http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme">Txtzyme</a> output with a <a href="http://dorkbotpdx.org/blog/wardcunningham/plotting_signals_with_txtzyme">perl one-liner</a>. I wondered, can I do better with a real graphics library? I was looking for something portable, like GD, but chose the already installed Graphics2D in Java 5 for convenience.</p> <p><a href="http://www.dorkbotpdx.org/node/541"><img src="http://www.dorkbotpdx.org/files/images/TxtzymeJavascope.png" width="420" height="306" title="Screen Shot of Javascope" alt="Txtzyme Javascope" style="display: block; margin-left: auto; margin-right: auto;" /></a></p> <p>As a once Tektronix engineer I have strong opinions about what a waveform should look like. I'm pleased with the look I get with Graphics2D. I would have never thought that the joint and end-cap choices would matter, but they do, and anti-aliasing is a must also.</p> <p>Once Scope.java is running and listening to a Teensy, one has only to send data-generating Txtzyme nano-programs down the other way to light the screen with waveforms.</p> <p>Here is an included script called Timebase.sh that does exactly this, alternating between real-time and equivalent-time acquisition of my favorite source, 60Hz hum.</p> <dl> <dd>while true</dd> <dd><dl> <dd>do echo _slow_6d1o500{5sp16m600u}0o &gt;/dev/cu.usbmodem</dd> <dd>sleep 10</dd> <dd>for i in 1 2 3 4 5 6 7 8 9 10</dd> <dd><dl> <dd>do echo _fast_1o500{5sp}0o &gt;/dev/cu.usbmodem</dd> <dd>sleep .348</dd> </dl> </dd> <dd>done</dd> </dl> </dd> <dd>done</dd> </dl> <p>Scope.java is organized as three separate threads. One reads Txtzyme data, another displays it, and a third handles user-input. Refreshing at 30Hz, Scope.java takes 15% to 25% of my MacBook Pro cpu resources.</p> <p>The Javascope <a href="http://github.com/WardCunningham/Txtzyme/tree/master/projects/javascope/">demo project</a> joins several others in the Txtzyme repo on GitHub.</p> <p>Evolved from other projects, <a href="http://github.com/WardCunningham/Txtzyme/blob/master/projects/javascope/Scope.java">Scope.java</a> is a mixture of about three different coding styles each from a different era. I would love for someone to help me with a code review so I can bring this up-to-date.</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/txtzyme_javascope_feeds_javas_2d_graphics#comments Sun, 13 Jun 2010 11:28:02 -0500 WardCunningham 543 at http://dorkbotpdx.org Plotting Signals with Txtzyme http://dorkbotpdx.org/blog/wardcunningham/plotting_signals_with_txtzyme <p><a href=http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme>Txtzyme</a> now supports analog input using Paul's <a href=http://pjrc.com/teensy/adc.html>Simple ADC</a> code. The command 5s samples analog channel 5. Here is a program that takes 50 samples:</p> <pre> 50{5sp} </pre><p>I read the samples directly from the USB device and convert them into bar charts with a perl one-liner that I leave running in the background. When the Teensy spits out data, it looks like this:</p> <pre> 72 ||||||| 68 |||||| 82 |||||||| 82 |||||||| 67 |||||| 141 |||||||||||||| 221 |||||||||||||||||||||| 298 ||||||||||||||||||||||||||||| 359 ||||||||||||||||||||||||||||||||||| 448 |||||||||||||||||||||||||||||||||||||||||||| 519 ||||||||||||||||||||||||||||||||||||||||||||||||||| 530 ||||||||||||||||||||||||||||||||||||||||||||||||||||| 527 |||||||||||||||||||||||||||||||||||||||||||||||||||| 531 ||||||||||||||||||||||||||||||||||||||||||||||||||||| 513 ||||||||||||||||||||||||||||||||||||||||||||||||||| 492 ||||||||||||||||||||||||||||||||||||||||||||||||| 439 ||||||||||||||||||||||||||||||||||||||||||| 395 ||||||||||||||||||||||||||||||||||||||| 324 |||||||||||||||||||||||||||||||| 254 ||||||||||||||||||||||||| 234 ||||||||||||||||||||||| </pre><p><!--break--><br /> The perl script uses a single regex substitution. I use perl's "x" operator to make bars by replicating a single character. For example, "|"x10 would produce "||||||||||". I scale the Txtzyme output by .2 so that the bars fit nicely on the screen. Here is the whole script launched as a background task:</p> <pre> perl -pe 's/(\d+)/$1."\t"."|"x($1*.2)/e' < /dev/cu.usbmodem & </pre><p>I can make the Txtzyme program run repeatedly by wrapping a while loop around the shell command that sends my program to the Teensy:</p> <pre> while sleep .144; do clear; echo 50{5sp} > /dev/cu.usbmodem; done </pre><p>The carefully chosen sleep and screen clear makes my completed setup refresh continuously at a rate good for examining the 60Hz hum present when I touch the Teensy's input pins.</p> <p>Want to try this? Find both lines in the <a href=http://github.com/WardCunningham/Txtzyme/tree/master/projects/perlscope/</a> sample script on GitHub.</p> http://dorkbotpdx.org/blog/wardcunningham/plotting_signals_with_txtzyme#comments Fri, 11 Jun 2010 09:21:50 -0500 WardCunningham 537 at http://dorkbotpdx.org Shell Programming with Txtzyme http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme <p>An interpreter need not be more than a case statement with a loop around it. I've written just such an interpreter for Teensy starting with a variation of Paul's <a href="http://www.pjrc.com/teensy/usb_serial.html">USB Serial example</a>. I'm finding it very handy. If I need a 1.5 millisecond pulse I would type:</p> <dl> <dd>echo 1o1500u0o &gt;/dev/cu.usbmodem</dd> </dl> <p>This example uses three single letter commands, each proceeded by a sequence of digits that loads data that any command can use or modify. Here is what the commands above mean:</p> <dl> <dd>1o -- output high on the selected pin (LED pin by default)</dd> <dd>1500u -- delay for 1500 microseconds</dd> <dd>0o -- output low to finish the pulse</dd> </dl> <p>&lt;!--break--&gt;</p> <p>Other commands include:</p> <dl> <dd>200m -- delay 200 milliseconds</dd> <dd>4a -- select pin 4 of port A</dd> <dd>i -- input from the selected pin</dd> <dd>p -- print data that the host can read</dd> <dd>100{} -- repeat commands within braces 100 times</dd> </dl> <p>Putting these all together we get a program that samples pin A4 at 5 Hz and writes what it finds to standard out:</p> <dl> <dd>echo 4a100{ip200m} &gt;/dev/cu.usbmodem</dd> <dd>cat /dev/cu.usbmodem</dd> </dl> <p>I've put the project up on <a href="http://github.com/WardCunningham">GitHub</a>. Look for Txtzyme which means &quot;text that catalyzes action&quot;. My fork there will be accumulating operations I find handy in my sensor network and, of course, as a utility device on my workbench.</p> <h2 id="toc0">Followup Posts</h2> <ul> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/plotting_signals_with_txtzyme">Plotting Signals with Txtzyme</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/txtzyme_javascope_feeds_javas_2d_graphics">Txtzyme Javascope Feeds Java's 2D Graphics</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/visual_perception_study_with_txtzyme">Visual Perception Study with Txtzyme</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/remote_control_with_txtzyme">Remote Control with Txtzyme</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/txtzyme_remote_signals">Txtzyme Remote Signals</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/these_lights_were_made_for_blinkin">These Lights Were Made for Blinkin'</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/pre_built_txtzyme_hex_files_and_more">Pre-Built Txtzyme Hex Files and More</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/atmospheric_tides_wiggle_my_barometer">Atmospheric Tides Wiggle My Barometer</a></li> <li> <a href="http://dorkbotpdx.org/blog/wardcunningham/yow_revisited_in_txtzyme">Yow Revisited (in Txtzyme)</a></li> </ul> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/shell_programming_with_txtzyme#comments Mon, 07 Jun 2010 16:02:40 -0500 WardCunningham 530 at http://dorkbotpdx.org WikiPod for Repeatable Panoramic Captures http://dorkbotpdx.org/blog/wardcunningham/wikipod_for_repeatable_panoramic_captures <p>As part of my studies at the Wiki Creek field station, I've become interested in longitudinal photographic surveys. I've now created a device to facilitate consistent panoramic captures based on permanent mounting of a monopod base. I describe the work on the Wiki Creek site:</p> <ul> <li> <a href="http://c2.com/wikicreek/wiki.cgi?FixpointPanorama">http://c2.com/wikicreek/wiki.cgi?FixpointPanorama</a></li> </ul> <p>I will bring the engineering prototype to the DorkBot meeting tonight. I'm calling it the &quot;WikiPod&quot;. (The name has worked well for me before.)</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/wikipod_for_repeatable_panoramic_captures#comments Mon, 12 Apr 2010 10:33:08 -0500 WardCunningham 497 at http://dorkbotpdx.org SensorServer aproaching 1.0 http://dorkbotpdx.org/blog/wardcunningham/sensorserver_aproaching_1_0 <p>After a year of occasional fiddling I am finally happy with the stability and convenience of my sensor network. Some features include:</p> <ul> <li> Arduino only configuration with off-premise data recording</li> <li> Analog, digital, bynase and 1-wire support with scaling and calibration</li> <li> Device discovery, labels, documentation and tag-based grouping</li> <li> Interactive graphs at time scales from hours to years with decimation and missing-data support</li> </ul> <p>For your browsing pleasure I offer my latest sensor addition, simple ac line voltage monitoring, or browse my whole network.</p> <ul> <li> <a href="http://c2.com/cybords/wiki.cgi?PowerAnalysis">http://c2.com/cybords/wiki.cgi?PowerAnalysis</a></li> <li> <a href="http://c2.com/~ward/arduino/SensorServer/">http://c2.com/~ward/arduino/SensorServer/</a></li> </ul> <p>&lt;!--break--&gt;</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/sensorserver_aproaching_1_0#comments Sat, 27 Feb 2010 20:25:36 -0600 WardCunningham 478 at http://dorkbotpdx.org Twilight Sensor http://dorkbotpdx.org/blog/wardcunningham/twilight_sensor <p>I've added a CdS photocell to my network of home temperature sensors. I'm reading it as an analog input using the WebServer Arduino code that goes with the Ethernet shield.</p> <p>I'm calling this a Twilight Sensor because the sensor range I happened to choose covers that half-light of mornings and evenings. I've cooked up a special FLOT graph that traces equi-temporal contours from day to day.</p> <p><a href="http://c2.com/~ward/arduino/twilight.cgi?hours=360">http://c2.com/~ward/arduino/twilight.cgi?hours=360</a></p> <p>If you study this long enough you will see that, yes, the days are getting longer.</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/twilight_sensor#comments Fri, 13 Mar 2009 09:55:18 -0500 WardCunningham 323 at http://dorkbotpdx.org 1-Wire Digial Thermometers http://dorkbotpdx.org/blog/wardcunningham/1_wire_digial_thermometers <p>My friend Wayne Downer gave me a couple of 1-Wire digital thermometers which I've now hooked up and supplemented with a few more of my own. You and I can both watch the temperatures drop at my house this week using the cool graphics I cooked up with jquery.</p> <p>You'll find the live data here:</p> <ul> <li> <a href="http://c2.com/~ward/arduino/recent.cgi">http://c2.com/~ward/arduino/recent.cgi</a></li> </ul> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/1_wire_digial_thermometers#comments Sat, 13 Dec 2008 16:54:55 -0600 WardCunningham 278 at http://dorkbotpdx.org Dial-a-Door http://dorkbotpdx.org/blog/wardcunningham/dial_a_door <p>I found the SECODER that I spoke about last meeting. It was in the bottom of the wrong junk box with old antenna equipment, not old telephone equipment. My mechanically inclined friends helped me get it working again. I've written a web page describing my original application, Dial-a-Door.</p> <ul> <li> <a href="http://c2.com/~ward/Dial-a-Door">http://c2.com/~ward/Dial-a-Door</a></li> </ul> <p>I got out the x-acto knife and built a display stand just for tonight's meeting. This got featured on the AboutUs blog.</p> <ul> <li> <a href="http://blog.aboutus.org/2008/10/27/dial-a-door-technology-to-appear-at-dorkbotpdx-tonight/">http://blog.aboutus.org/2008/10/27/dial-a-door-technology-to-appear-at-dorkbotpdx-tonight/</a></li> </ul> <p>I thought about including an Arduino in the setup to provide an automated demo. I'm glad I didn't. I've been told that the computer would destroy the <em>steam punk</em> style of the whole setup.</p> <br class="clear" /> http://dorkbotpdx.org/blog/wardcunningham/dial_a_door#comments Tue, 28 Oct 2008 00:23:58 -0500 WardCunningham 251 at http://dorkbotpdx.org