{"id":3505,"date":"2017-04-23T18:34:21","date_gmt":"2017-04-23T18:34:21","guid":{"rendered":"http:\/\/dalelane.co.uk\/blog\/?p=3505"},"modified":"2017-04-23T18:46:47","modified_gmt":"2017-04-23T18:46:47","slug":"weatherbot","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=3505","title":{"rendered":"weatherbot"},"content":{"rendered":"<p><a href=\"https:\/\/ibmtjbot.github.io\/\">TJBot<\/a> is an open-source do-it-yourself kit for building a small Raspberry-Pi-powered robot. <\/p>\n<h3>Building<\/h3>\n<p>In the Easter holidays, we spent an afternoon building it&#8230; <\/p>\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"en\" dir=\"ltr\">Making a start on our TJBot (thanks to <a href=\"https:\/\/twitter.com\/jtonline\">@jtonline<\/a> and <a href=\"https:\/\/twitter.com\/andysc\">@andysc<\/a>!) <a href=\"https:\/\/t.co\/yNfjcW4GXp\">pic.twitter.com\/yNfjcW4GXp<\/a><\/p>\n<p>&mdash; Dale Lane (@dalelane) <a href=\"https:\/\/twitter.com\/dalelane\/status\/852897310598205440\">April 14, 2017<\/a><\/p><\/blockquote>\n<p>&#8230;and wiring it&#8230;<\/p>\n<blockquote class=\"twitter-tweet\" data-lang=\"en\">\n<p lang=\"en\" dir=\"ltr\">Wiring. <a href=\"https:\/\/twitter.com\/hashtag\/TJBot?src=hash\">#TJBot<\/a> <a href=\"https:\/\/t.co\/PnirOojTvW\">pic.twitter.com\/PnirOojTvW<\/a><\/p>\n<p>&mdash; Dale Lane (@dalelane) <a href=\"https:\/\/twitter.com\/dalelane\/status\/852942709698560000\">April 14, 2017<\/a><\/p><\/blockquote>\n<p>This gave us a tiny plastic robot with a light in his head, and an arm that can rotate back and forth. He sits on the kitchen shelf next to the Alexa. <\/p>\n<p><iframe loading=\"lazy\" width=\"480\" height=\"270\" src=\"https:\/\/www.youtube.com\/embed\/pMc5xt31w0k?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>This weekend, we tried doing something with it. <\/p>\n<p><!--more--><\/p>\n<h3>weatherbot<\/h3>\n<p>Our first project was <a href=\"https:\/\/github.com\/dalelane\/weatherbot\">weatherbot<\/a> &#8211; using the TJBot as an ambient weather device. <\/p>\n<p>It gives us an at-a-glance weather forecast using it&#8217;s head LED and the position of it&#8217;s arm. We&#8217;re using <a href=\"https:\/\/darksky.net\/\">DarkSky&#8217;s API<\/a> to get a weather forecast. <\/p>\n<h3>Will it rain?<\/h3>\n<p><a data-flickr-embed=\"true\"  href=\"https:\/\/www.flickr.com\/photos\/dalelane\/34066175122\" title=\"tjbot-rain\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/c1.staticflickr.com\/5\/4171\/34066175122_10e664f99a.jpg\" width=\"450\" height=\"338\" alt=\"tjbot-rain\"\/><\/a><\/p>\n<p>If the chance of rain is 50% or higher, the LED on weatherbot&#8217;s head will light up. <\/p>\n<p>So a glance at weatherbot means we know to take an umbrella with us if we&#8217;re going out.<\/p>\n<h3>How warm will it be?<\/h3>\n<p><a data-flickr-embed=\"true\"  href=\"https:\/\/www.flickr.com\/photos\/dalelane\/33412503893\" title=\"tjbot-temperature\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/c1.staticflickr.com\/3\/2849\/33412503893_662d30fbea.jpg\" width=\"450\" height=\"313\" alt=\"tjbot-temperature\"\/><\/a><\/p>\n<p>The arm will rotate to show a predicted temperature. <\/p>\n<p>Rotating to the left means cold, with the arm horizontal and all the way to the front meaning 0 degrees C or colder. <\/p>\n<p>Rotating to the right means hot, with the arm horizontal and all the way to the back meaning 30 degrees C or hotter. <\/p>\n<p>And the arm pointing straight up is half-way between the two: 15 degrees C. <\/p>\n<p>So a glance at weatherbot means we know if we should take a coat. <\/p>\n<h3>Our first project<\/h3>\n<p>I&#8217;m not sure how long we&#8217;ll keep TJ in weatherbot-mode. But it&#8217;s a fun place to start. Faith came up with the weatherbot idea and Grace wrote <a href=\"https:\/\/github.com\/dalelane\/weatherbot\/blob\/master\/bot.js\">bot.js<\/a> with a few suggestions and additional commenting from me. The idea was to let them use the bot to build something they could understand and make themselves, without me interfering too much.<\/p>\n<p>For our next project, we might try something a little more advanced! \ud83d\ude42<\/p>\n<p><em>For now, I&#8217;ve put the code at <a href=\"https:\/\/github.com\/dalelane\/weatherbot\">github.com\/dalelane\/weatherbot<\/a> but it&#8217;ll need a little work if you want to reuse it as the config is scattered through the code. Sorry. You&#8217;ll need to sort yourself out with a <a href=\"https:\/\/darksky.net\/dev\/\">DarkSky API key<\/a> and put it in <a href=\"https:\/\/github.com\/dalelane\/weatherbot\/blob\/ea6d482cdc629531a87ab0a36e0c07464248b2b2\/weather.js#L25\">an environment variable<\/a>. You&#8217;ll also need to modify the script to <a href=\"https:\/\/github.com\/dalelane\/weatherbot\/blob\/ea6d482cdc629531a87ab0a36e0c07464248b2b2\/bot.js#L39-L41\">specify the location you want forecasts for<\/a>.<\/em> <\/p>\n<p><script async src=\"\/\/embedr.flickr.com\/assets\/client-code.js\" charset=\"utf-8\"><\/script><br \/>\n<script async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>TJBot is an open-source do-it-yourself kit for building a small Raspberry-Pi-powered robot. Building In the Easter holidays, we spent an afternoon building it&#8230; Making a start on our TJBot (thanks to @jtonline and @andysc!) pic.twitter.com\/yNfjcW4GXp &mdash; Dale Lane (@dalelane) April 14, 2017 &#8230;and wiring it&#8230; Wiring. #TJBot pic.twitter.com\/PnirOojTvW &mdash; Dale Lane (@dalelane) April 14, 2017 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,4,328],"tags":[576],"class_list":["post-3505","post","type-post","status-publish","format-standard","hentry","category-code","category-ibm","category-kids","tag-tjbot"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3505"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3505\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}