{"id":7336,"date":"2014-02-13T09:19:33","date_gmt":"2014-02-13T07:19:33","guid":{"rendered":"http:\/\/lukse.lt\/uzrasai\/?p=7336"},"modified":"2014-02-13T12:29:58","modified_gmt":"2014-02-13T10:29:58","slug":"building-smart-wifi-enabled-bathroom-scale","status":"publish","type":"post","link":"https:\/\/lukse.lt\/uzrasai\/2014-02-building-smart-wifi-enabled-bathroom-scale\/","title":{"rendered":"Building smart WiFi enabled bathroom scale"},"content":{"rendered":"<p style=\"text-align: justify;\"><a href=\"http:\/\/lukse.lt\/uzrasai\/2014-02-building-smart-wifi-enabled-bathroom-scale\/\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7361 alignleft\" alt=\"wifi_scale_t\" src=\"http:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/wifi_scale_t.png\" width=\"200\" height=\"143\" \/><\/a>There are several wireless scales on the market but none of them implements functions I like (or overpriced). This scale logger is attempt to build wireless scale from existing components like <a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/8devices.com\/carambola-2');\"  href=\"http:\/\/8devices.com\/carambola-2\">Carambola 2<\/a> and USB IR Toy and, of course, scale with remote indicator. Implemented purely on Python this project enables gathering, sending and displaying weight data to any service you like or even build one yourself.<\/p>\n<div align=\"center\"><!--more--><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>About<\/h2>\n<p style=\"text-align: justify;\">This is only framework and final solution is &#8220;to be done&#8221;. This project is based on Maxim 29-66SH bathroom scale. Data is captured from scale via <a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/dangerousprototypes.com\/docs\/USB_Infrared_Toy');\"  href=\"http:\/\/dangerousprototypes.com\/docs\/USB_Infrared_Toy\">USB IR Toy.v2<\/a> with no invasion to scale itself. Testing was done on regular PC and project can be easily copied to Carambola 2 (install python and couple of libraries, setup connectivity and you are ready to go).<\/p>\n<div id=\"attachment_7367\" style=\"width: 410px\" class=\"wp-caption aligncenter\"><a onclick=\"javascript:pageTracker._trackPageview('\/downloads\/uzrasai\/wp-content\/uploads\/2014\/02\/Maxim-29-66SH.jpg');\"  href=\"http:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/Maxim-29-66SH.jpg\" rel=\"lightbox[7336]\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7367\" class=\"size-medium wp-image-7367 \" alt=\"Maxim 29-66SH\" src=\"http:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/Maxim-29-66SH-400x351.jpg\" width=\"400\" height=\"351\" srcset=\"https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/Maxim-29-66SH-400x351.jpg 400w, https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/Maxim-29-66SH.jpg 490w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><p id=\"caption-attachment-7367\" class=\"wp-caption-text\">Maxim 29-66SH bathroom scale<\/p><\/div>\n<p style=\"text-align: center;\">\n<p style=\"text-align: center;\">\n<div id=\"attachment_7369\" style=\"width: 600px\" class=\"wp-caption aligncenter\"><a onclick=\"javascript:pageTracker._trackPageview('\/downloads\/uzrasai\/wp-content\/uploads\/2014\/02\/2.png');\"  href=\"http:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/2.png\" rel=\"lightbox[7336]\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7369\" class=\" wp-image-7369  \" alt=\"2\" src=\"http:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/2-1024x293.png\" width=\"590\" height=\"168\" srcset=\"https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/2-1024x293.png 1024w, https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/2-400x114.png 400w, https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/2.png 1500w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><p id=\"caption-attachment-7369\" class=\"wp-caption-text\">Tools involved to make standalone wireless scale<\/p><\/div>\n<p style=\"text-align: left;\">Features I&#8217;d like to implement are:<\/p>\n<ul>\n<li>Auto individual recognition<\/li>\n<li>Data uploading to database for future analysis<\/li>\n<li>Graphing<\/li>\n<li>Weekly\/Monthly analysis<\/li>\n<li>Email\/SMS reminder if individual has not weighted for several days<\/li>\n<li>Means to set and seek goal<\/li>\n<\/ul>\n<h2>Protocol hints<\/h2>\n<div id=\"attachment_7377\" style=\"width: 544px\" class=\"wp-caption aligncenter\"><a onclick=\"javascript:pageTracker._trackPageview('\/downloads\/uzrasai\/wp-content\/uploads\/2014\/02\/logic.png');\"  href=\"http:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/logic.png\" rel=\"lightbox[7336]\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-7377\" class=\" wp-image-7377  \" alt=\"logic\" src=\"http:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/logic.png\" width=\"534\" height=\"361\" srcset=\"https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/logic.png 1588w, https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/logic-400x270.png 400w, https:\/\/lukse.lt\/uzrasai\/wp-content\/uploads\/2014\/02\/logic-1024x693.png 1024w\" sizes=\"auto, (max-width: 534px) 100vw, 534px\" \/><\/a><p id=\"caption-attachment-7377\" class=\"wp-caption-text\">Waveforms from logic analyzer<\/p><\/div>\n<p style=\"text-align: center;\">\n<p>&nbsp;<\/p>\n<pre class=\"lang:default decode:true\" title=\"Biststream\">bitstream                                weight status\r\n0111111110000000011111111111111111111111          0    - Syncro (43 packets)\r\n0101010111000000000000011101100011110000 94.5     0    - Measuring\r\n0101010111000010000000011101100111110011 94.7     1    - Measuring\r\n0101010111000110000000011101100111110111 94.7     3    - Weight is stable. Data valid.\r\n.............ssddddddddddddddddddccccccc<\/pre>\n<ul>\n<li>Data range is [15:33] encoded as integer data in 100*grams<\/li>\n<li>Status [13:15].<\/li>\n<li>At the beginning it looks like packet synchro bits<\/li>\n<li>At the end looks like 7 bit checksum<\/li>\n<\/ul>\n<h2>Code<\/h2>\n<p>Code is hosted on <a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/github.com\/Lukse\/infrared_scale');\"  href=\"https:\/\/github.com\/Lukse\/infrared_scale\">Github.<\/a> There are several files in the project.<\/p>\n<ul>\n<li><strong>save_timing.py<\/strong> &#8211; reads raw values from USB IR Toy and saves to text file<\/li>\n<li><strong>analyze.py<\/strong> &#8211; analyses txt files saved earlier<\/li>\n<li><strong>ir_scale_utils.py<\/strong> &#8211; data conversion routines<\/li>\n<li><strong>weight.py<\/strong> &#8211; reads data from scale and presents value on the screen.<\/li>\n<\/ul>\n<ul>\n<li><strong>app.py<\/strong> &#8211; Python tornado server application<\/li>\n<li><strong>index.html<\/strong> &#8211; internal html file tornado serves. (replace websocket ip address inside)<\/li>\n<\/ul>\n<p>In order to read weight data only few lines of code are necessary:<\/p>\n<pre class=\"lang:python decode:true\" title=\"Reading scale data\">import ir_scale_utils\r\n\r\nlines = ir_scale_utils.get_data_serial('COM43')\r\n\r\nweight = ir_scale_utils.get_real_weight(lines)\r\nprint 'Your weight is: %3.1f kg' % weight<\/pre>\n<h2>Demo video<\/h2>\n<p><iframe loading=\"lazy\" width=\"640\" height=\"360\" src=\"\/\/www.youtube.com\/embed\/vdAChaM0KSI\" allowfullscreen=\"\" frameborder=\"0\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are several wireless scales on the market but none of them implements functions I like (or overpriced). This scale logger is attempt to build wireless scale from existing components like Carambola 2 and USB IR Toy and, of course, scale with remote indicator. Implemented purely on Python this project enables gathering, sending and displaying [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[38,21,5],"tags":[],"class_list":["post-7336","post","type-post","status-publish","format-standard","hentry","category-in-english","category-projektai","category-uzrasai"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2rU5c-1Uk","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/posts\/7336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/comments?post=7336"}],"version-history":[{"count":47,"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/posts\/7336\/revisions"}],"predecessor-version":[{"id":7387,"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/posts\/7336\/revisions\/7387"}],"wp:attachment":[{"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/media?parent=7336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/categories?post=7336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lukse.lt\/uzrasai\/wp-json\/wp\/v2\/tags?post=7336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}