{"id":37,"date":"2017-03-01T22:24:49","date_gmt":"2017-03-01T20:24:49","guid":{"rendered":"https:\/\/dev.drun.net\/?p=37"},"modified":"2017-03-01T22:24:49","modified_gmt":"2017-03-01T20:24:49","slug":"playing-with-hc-12-wireless-transmitter-receiver","status":"publish","type":"post","link":"https:\/\/dev.krasi.net\/?p=37","title":{"rendered":"Playing with HC-12 wireless transmitter \/ receiver"},"content":{"rendered":"<p>HC-12 is an interesting device. It operates on 433 MHz and I think will be perfect for a sensor network. You can read very detailed info <a href=\"https:\/\/quadmeup.com\/hc-12-433mhz-wireless-serial-communication-module-configuration\/\">here<\/a>, I will not go deep into details.<\/p>\n<p>First, you need to configure\u00a0it. For that purpose, I use very simple <a href=\"http:\/\/www.ebay.com\/itm\/PL2303-USB-To-RS232-TTL-Converter-Adapter-Module-New-\/130682850512\">PL2303 USB to RS232<\/a> converter. If you use Mac OS X &#8211; you can use <a href=\"http:\/\/www.prolific.com.tw\/UserFiles\/files\/PL2303_MacOSX_1_6_1_20160309.zip\">these drivers<\/a>. Otherwise, you might not be able to see the device.<\/p>\n<p>You need to connect HC-12&#8217;s four pins. VCC goes to PL2303&#8217;s VCC ( you can safely use 3.3 or 5V, HC-12 can work with 3.2 &#8211; 5.5V ), GND goes to GND, RX goes to TX, TX goes to RX. That&#8217;s how serial comms work.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-43 size-large\" src=\"https:\/\/dev.krasi.net\/wp-content\/uploads\/2017\/03\/DSCF3127-1024x683.jpg\" width=\"960\" height=\"640\" \/><\/p>\n<p>Don&#8217;t forget to connect SET to GND in order to access it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-44 size-large\" src=\"https:\/\/dev.krasi.net\/wp-content\/uploads\/2017\/03\/DSCF3129-1024x683.jpg\" width=\"960\" height=\"640\" \/><\/p>\n<p>When you do this, connect to your computer ( I use Macbook Pro ) and find it:<\/p>\n<pre>ls \/dev\/tty.*\n\/dev\/tty.Bluetooth-Incoming-Port \/dev\/tty.KrasimirsBOSEQC35-SPPDev-1\n\/dev\/tty.KrasimirsBOSEQC35-SPPDev \/dev\/tty.usbserial<\/pre>\n<p>Mine is <strong>\/dev\/tty.usbserial<\/strong> , yours might be different. I connect to it like that:<\/p>\n<pre>screen \/dev\/tty.usbserial 9600<\/pre>\n<p>After which you can send commands to it. For detailed commands info, see the top link. Note that you might need to paste it, as it expects the speed to be very fast. For my purposes, I will use channel 7, so I do:<\/p>\n<pre>AT+C007<\/pre>\n<p>and the reply is:<\/p>\n<pre>OK+C007<\/pre>\n<p>Which is okay for me. I leave all other settings by default. You can check it with<\/p>\n<pre>AT+RX<\/pre>\n<p>Which produces:<\/p>\n<pre>OK+B9600\nOK+RC007\nOK+RP:+20dBm\nOK+FU3<\/pre>\n<p>You can now disconnect SET and your module is ready for connection \ud83d\ude42 In the next post, I will show you how to connect it to Arduino Mini Pro 8 Mhz ( or similar, it doesn&#8217;t matter that much ) and send sensor data ( temperature in my case, but really can be anything ).<\/p>\n<p>I hope you enjoy this as much as I do. If you have questions, let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>HC-12 is an interesting device. It operates on 433 MHz and I think will be perfect for a sensor network. You can read very detailed info here, I will not go deep into details. First, you need to configure\u00a0it. For that purpose, I use very simple PL2303 USB to RS232 converter. If you use Mac OS X &#8211; you can use these drivers. Otherwise, you might not be able to see the device. You need to connect HC-12&#8217;s four pins. VCC goes to PL2303&#8217;s VCC ( you can safely use 3.3 or 5V, HC-12 can work with 3.2 &#8211; 5.5V ), GND goes to GND, RX goes to TX, TX goes to RX. That&#8217;s how serial comms work. Don&#8217;t forget to connect SET to GND in order to access it. When you do this, connect to your computer ( I use Macbook Pro ) and find it: ls \/dev\/tty.* \/dev\/tty.Bluetooth-Incoming-Port \/dev\/tty.KrasimirsBOSEQC35-SPPDev-1 \/dev\/tty.KrasimirsBOSEQC35-SPPDev \/dev\/tty.usbserial Mine is \/dev\/tty.usbserial , yours might be different. I connect to it like that: screen \/dev\/tty.usbserial 9600 After which you can send commands to it. For detailed commands info, see the top link. Note that you might need to paste it, as it expects the speed to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":40,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hardware"],"_links":{"self":[{"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts\/37","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=37"}],"version-history":[{"count":0,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=\/wp\/v2\/posts\/37\/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=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.krasi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}