{"id":6103,"date":"2011-02-21T11:14:06","date_gmt":"2011-02-21T16:14:06","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=6103"},"modified":"2013-12-03T20:35:16","modified_gmt":"2013-12-04T01:35:16","slug":"on-the-trail-of-the-elusive-power-cost-monitor-signal","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2011\/02\/21\/on-the-trail-of-the-elusive-power-cost-monitor-signal\/","title":{"rendered":"on the trail of the elusive Power Cost Monitor signal"},"content":{"rendered":"<p><a href=\"http:\/\/c-raine.com\/\">Catherine<\/a> probably thought I was acting no more strangely than usual last night, when I was holding the <a href=\"http:\/\/www.bluelineinnovations.com\/Products\/PowerCost-Monitor\/\">Power Cost<\/a> display unit in one hand, <a href=\"http:\/\/www.catb.org\/jargon\/html\/F\/frobnicate.html\">frobbing<\/a> the electric stove control with the other, all the while watching a digital clock and cackling gently to myself.<\/p>\n<p>All this makes me think I&#8217;m a bit further on with getting <em>something<\/em> from the Power Cost Monitor. Previous attempts using <a href=\"http:\/\/www.sparkfun.com\/products\/8949\">cheap wireless units<\/a> (and cluelessness on my part \u00e2\u20ac\u201d never forget that) got nothing, so I caved and bought the rather expensive but nice <a href=\"http:\/\/www.parallax.com\/tabid\/768\/ProductID\/582\/Default.aspx\">Parallax 433 MHz RF Transceiver<\/a> from <a href=\"http:\/\/www.solarbotics.com\/\">Solarbotics<\/a>.<\/p>\n<p>The Parallax unit adds an analogue output that&#8217;s proportional to the instantaneous signal strength. I hooked up the output to the trusty <a href=\"https:\/\/code.google.com\/p\/sdfatlib\/\">sdfatlib<\/a> analogue logger, set the logger to sample every 50ms (figuring that, every now and again, it&#8217;s going to see part of a transmission) and this is what I saw:<\/p>\n<p><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength.pdf\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6106\" title=\"parallax 433MHz signal strength trace\" alt=\"\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength.png\" width=\"588\" height=\"413\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength.png 588w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength-160x112.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength-320x224.png 320w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><\/a>Pretty noisy, I know. But look, there are regular peaks:<\/p>\n<p><a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength-excerpt.pdf\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6104\" title=\"radio signal strength - excerpt\" alt=\"\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength-excerpt.png\" width=\"588\" height=\"413\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength-excerpt.png 588w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength-excerpt-160x112.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/signal_strength-excerpt-320x224.png 320w\" sizes=\"auto, (max-width: 588px) 100vw, 588px\" \/><\/a>Here I&#8217;ve highlighted all the peaks with signal strength \u00e2\u2030\u00a5 200 (in arbitrary units, where 1024 would be full scale). It&#8217;s pretty regular; the largest peaks come in a <em>shade<\/em> under every 32 seconds, or a multiple thereof. If you need additional decimal places to validate your worldview, I&#8217;m thinking the period&#8217;s around 31.86s.<\/p>\n<p>Observations made during last night&#8217;s frobbing and cackling episode seem to confirm that the display updates about every 32s. If you adjust the load mid-cycle, nothing changes until the update. If the display misses an update, it&#8217;ll refresh in 64 or 96 seconds.<\/p>\n<p>I don&#8217;t yet know what bitrate the data comes through at, or the protocol. I&#8217;ve logged some data recorded at various rates: <a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/433mhz_powercost.zip\">433mhz_powercost_data<\/a>. The file names give a hint at the data rate; L<span style=\"text-decoration: underline;\">1200<\/span>V04 was recorded at 1200bps, for example. I&#8217;m guessing that there&#8217;s some kind of sync header, then the total value and the current temperature (which was around\/below freezing at the time). I need to work on that.<\/p>\n<p><strong>Update<\/strong>: I rewrote the logger to use the Arduino&#8217;s internal UART, since \u00e2\u20ac\u201d lovely though <a href=\"http:\/\/arduiniana.org\/libraries\/newsoftserial\/\">NewSoftSerial<\/a> may be \u00e2\u20ac\u201d it causes millis() to report wildly inaccurate times at low bit rates. I recorded a bunch more data (<a href=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2011\/02\/powercost-arduino2.zip\">powercost-arduino2.zip<\/a>) in a slightly more useful text format. It has three columns:<\/p>\n<ul>\n<li>the time, in milliseconds, at which the record was recorded<\/li>\n<li>the time difference between this and the previous record, in milliseconds. Maybe not as useful as it could be. If adjacent records are <em>about<\/em> 31860ms apart, they&#8217;re transmissions from the meter.<\/li>\n<li>120 bytes of data recorded at the current bit rate (given in the file name) encoded in hex.<\/li>\n<\/ul>\n<p>I&#8217;ve also included the Arduino sketch, which could be better documented.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Catherine probably thought I was acting no more strangely than usual last night, when I was holding the Power Cost display unit in one hand, frobbing the electric stove control with the other, all the while watching a digital clock and cackling gently to myself. All this makes me think I&#8217;m a bit further on [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[2273,2207,2750,1471,959,276],"class_list":["post-6103","post","type-post","status-publish","format-standard","hentry","category-computers-suck","tag-433mhz","tag-arduino","tag-blueline","tag-nerdy","tag-smart_meter","tag-wireless"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-1Ar","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/6103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=6103"}],"version-history":[{"count":6,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/6103\/revisions"}],"predecessor-version":[{"id":10189,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/6103\/revisions\/10189"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=6103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=6103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=6103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}