{"id":110,"date":"2018-12-28T22:31:56","date_gmt":"2018-12-28T13:01:56","guid":{"rendered":"https:\/\/sighmon.com\/says\/?p=110"},"modified":"2019-01-02T16:45:32","modified_gmt":"2019-01-02T07:15:32","slug":"atlas-conductivity-k-1-0-to-ttn-uno","status":"publish","type":"post","link":"https:\/\/sighmon.com\/says\/atlas-conductivity-k-1-0-to-ttn-uno\/","title":{"rendered":"Atlas Conductivity K 1.0 to TTN Uno"},"content":{"rendered":"\n<p>Now that I know the sensor works with a standard Arduino Mega, it&#8217;s time to try and get it running on <a href=\"https:\/\/www.thethingsnetwork.org\/docs\/devices\/uno\/\">The Things Uno<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-1024x768.jpg\" alt=\"\" class=\"wp-image-113\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-1024x768.jpg 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-300x225.jpg 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-768x576.jpg 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-1568x1176.jpg 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>An Atlas Scientific Conductivity K 1.0 sensor hooked up to The Things Uno<\/figcaption><\/figure>\n\n\n\n<p>My first attempts getting the <a href=\"https:\/\/www.atlas-scientific.com\/_files\/code\/Arduino-Uno-EC-sample-code.pdf\">Atlas Scientific Uno code<\/a> running on The Things Uno didn&#8217;t get very far. It seemed to be a problem running SoftwareSerial on the default pins 2 &amp; 3.<\/p>\n\n\n\n<p>But when I moved those to pins 10 &amp; 11, I started getting output on the serial monitor! Success.<\/p>\n\n\n\n<p>Next step was to merge that sample code with The Things sample code and see if it all still compiled and ran. More success!<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"626\" src=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-1024x626.png\" alt=\"\" class=\"wp-image-114\" srcset=\"https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-1024x626.png 1024w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-300x183.png 300w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-768x469.png 768w, https:\/\/sighmon.com\/says\/wp-content\/uploads\/2018\/12\/atlas-scientific-conductivity-to-the-things-uno-1568x958.png 1568w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>The output from the serial monitor of the Arduino IDE.<\/figcaption><\/figure>\n\n\n\n<p>The final step is to convert the <em>sensorstring<\/em> to a byte array so that we can send it to The Things Network.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Convert sensorstring to a byte array\nbyte data[sensorstring.length()];\nsensorstring.getBytes(data, sizeof(data));<\/code><\/pre>\n\n\n\n<p>From the TTN docs, the send command to their network is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Send the data\nttn.sendBytes(data, sizeof(data));<\/code><\/pre>\n\n\n\n<p>The complete code is now all up in this GitHub repo: <br><a href=\"https:\/\/github.com\/sighmon\/water-quality-sensors\">github.com\/sighmon\/water-quality-sensors<\/a><\/p>\n\n\n\n<p>Exciting!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that I know the sensor works with a standard Arduino Mega, it&#8217;s time to try and get it running on The Things Uno. My first attempts getting the Atlas Scientific Uno code running on The Things Uno didn&#8217;t get very far. It seemed to be a problem running SoftwareSerial on the default pins 2 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sighmon.com\/says\/atlas-conductivity-k-1-0-to-ttn-uno\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Atlas Conductivity K 1.0 to TTN Uno&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":113,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9],"tags":[11,13,14,25,18,12],"class_list":["post-110","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-sensors","tag-arduino","tag-quality","tag-sensors","tag-the-things-uno","tag-ttn","tag-water","entry"],"_links":{"self":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":4,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"predecessor-version":[{"id":120,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/posts\/110\/revisions\/120"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/media\/113"}],"wp:attachment":[{"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sighmon.com\/says\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}