{"id":80,"date":"2017-03-22T10:08:13","date_gmt":"2017-03-22T08:08:13","guid":{"rendered":"https:\/\/dev.drun.net\/?p=80"},"modified":"2017-03-22T10:08:13","modified_gmt":"2017-03-22T08:08:13","slug":"receiving-the-data-from-the-sensor-and-displaying-it","status":"publish","type":"post","link":"https:\/\/dev.krasi.net\/?p=80","title":{"rendered":"Receiving the data from the sensor and displaying it"},"content":{"rendered":"<p>In my <a href=\"\/2017\/03\/19\/reading-temperature-with-arduino-and-sending-it-via-hc-12\/\">previous post<\/a>, I&#8217;ve read temperature reading with BMP180 on Arduino mini cheap clone and sent it over air with HC-12 serial module. Now we&#8217;re going to receive it and display it on the OLED screen, that I&#8217;ve made a <a href=\"\/2017\/03\/19\/showing-some-data-with-cheap-oled-screens\/\">simple test<\/a> with.<\/p>\n<p>To the same Arduino, that we have connected the OLED screen to, we need to connect an HC-12. Wiring is extremely simple (same as on the sender side):<\/p>\n<ul>\n<li>VCC \u2013 to Arduino 3.3v<\/li>\n<li>GND \u2013 to Arduino GND<\/li>\n<li>TX \u2013 to Arduino pin 2 ( RX )<\/li>\n<li>RX \u2013 to Arduino pin 3 ( TX )<\/li>\n<\/ul>\n<p>We will be using again SoftwareSerial on pins 2 and 3. Connect it, and then use a <a href=\"https:\/\/dev.drun.net\/wp-content\/uploads\/2017\/03\/receiver1.ino\">sketch file like this.<\/a>\u00a0What it does is: we simply wait for data and if it&#8217;s available, parse it, split on <strong>|<\/strong>\u00a0and display it on the OLED screen. I show on it the Sensor ID, Sensor Type and the Sensor Value.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-78 size-large\" src=\"https:\/\/dev.krasi.net\/wp-content\/uploads\/2017\/03\/DSCF3316-1024x683.jpg\" alt=\"\" width=\"960\" height=\"640\" \/><\/p>\n<p>That&#8217;s it, very simple but it works \ud83d\ude42 It should work on much bigger distance, but it really depends on things like your antenna, HC-12 configuration ( you can configure them for much lower speed and much stronger signal ). I found that defaults work pretty good for what I actually need ( around 100 meters max, no concrete walls ).<\/p>\n<p>In my next post, I will be adding encryption and\/or message authentication to the simple protocol I&#8217;ve\u00a0<em>created<\/em> \ud83d\ude42 . I don&#8217;t know yet what will work, but I have to make it compatible with both the small and limited (ATmega168, 8Mhz) Arduino and Raspberry PI 3. My goal is to have Raspberry PI actually read the values from HC-12 and process them. I haven&#8217;t yet decided, though &#8211; whether I will use an Arduino Mini connected to RPI&#8217;s USB port or connect HC-12 directly as Software Serial to the RPI.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post, I&#8217;ve read temperature reading with BMP180 on Arduino mini cheap clone and sent it over air with HC-12 serial module. Now we&#8217;re going to receive it and display it on the OLED screen, that I&#8217;ve made a simple test with. To the same Arduino, that we have connected the OLED screen to, we need to connect an HC-12. Wiring is extremely simple (same as on the sender side): VCC \u2013 to Arduino 3.3v GND \u2013 to Arduino GND TX \u2013 to Arduino pin 2 ( RX ) RX \u2013 to Arduino pin 3 ( TX ) We will be using again SoftwareSerial on pins 2 and 3. Connect it, and then use a sketch file like this.\u00a0What it does is: we simply wait for data and if it&#8217;s available, parse it, split on |\u00a0and display it on the OLED screen. I show on it the Sensor ID, Sensor Type and the Sensor Value. That&#8217;s it, very simple but it works \ud83d\ude42 It should work on much bigger distance, but it really depends on things like your antenna, HC-12 configuration ( you can configure them for much lower speed and much stronger signal ). I found that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":78,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[],"class_list":["post-80","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hardware","category-software"],"_links":{"self":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts\/80","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=80"}],"version-history":[{"count":0,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts\/80\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=80"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=80"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}