{"id":11095,"date":"2016-04-05T22:22:10","date_gmt":"2016-04-06T02:22:10","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=11095"},"modified":"2016-10-01T21:56:22","modified_gmt":"2016-10-02T01:56:22","slug":"wireless-communication-between-two-arduinos-using-low-cost-433mhz-ask-rf-modules","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/wireless-communication-between-two-arduinos-using-low-cost-433mhz-ask-rf-modules\/","title":{"rendered":"Wireless communication between two Arduinos using inexpensive RF modules"},"content":{"rendered":"<p>This article explores an easy wireless communication setup between two Arduinos using low-cost ASK RF transmitter and receiver modules that are readily available in the market. They are found in different shapes, but functionally they are all same. Both Tx and Rx modules contain a single data line for input and output and support a low-speed Amplitude Shift Keying modulation for data communication. You can get them with 315MHz or 433MHz carrier frequency. In this tutorial, I am using a <strong><a href=\"https:\/\/www.tindie.com\/products\/rajbex\/433mhz-ask-rf-transmitterreceiver-kit\/\" target=\"_blank\">433MHz Tx\/Rx pair<\/a><\/strong> with two Arduino boards to illustrate how to construct a low-range wireless temperature and humidity monitor.<\/p>\n<div id=\"attachment_11273\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Title.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11273\" class=\"size-medium wp-image-11273\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Title-580x294.jpg\" alt=\"sdsds\" width=\"580\" height=\"294\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Title-580x294.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Title.jpg 595w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-11273\" class=\"wp-caption-text\">Wireless communication between two Arduinos using ASK RF modules<\/p><\/div>\n<p><!--more--><\/p>\n<h5>ASK Tx\/Rx modules<\/h5>\n<p>As I mentioned, you can buy varieties of ASK Tx\/Rx modules from both domestic and international markets (specially China). Some of them come with spring antennas, and some don&#8217;t. With the ones without antennas, you can connect ~20cm wire to their antenna pin on circuit board. The figure below shows some of the ASK RF modules you can buy on eBay and Amazon.<\/p>\n<div id=\"attachment_11117\" style=\"width: 605px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/txrx.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11117\" class=\"size-full wp-image-11117\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/txrx.png\" alt=\"Different types of ASK tx\/rx modules\" width=\"595\" height=\"472\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/txrx.png 595w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/txrx-580x460.png 580w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/a><p id=\"caption-attachment-11117\" class=\"wp-caption-text\">Different types of ASK tx\/rx modules<\/p><\/div>\n<p>The Tx\/Rx RF modules\u00a0I am using in this project are manufactured by <strong><a href=\"http:\/\/www.nicerf.com\/\">NiceRF<\/a><\/strong>, a China-based company. You can also buy these modules directly from our <strong><a href=\"https:\/\/www.tindie.com\/products\/rajbex\/433mhz-ask-rf-transmitterreceiver-kit\/\" target=\"_blank\">Tindie store<\/a><\/strong>.\u00a0The nice things about these modules are they are very <strong>compact<\/strong>, <strong>breadboard and PCB friendly<\/strong>, <strong>made of high-quality PCB<\/strong>, <strong>come with copper spring antennas<\/strong> and <strong>have a reasonably good coverage area<\/strong>. With the spring antennas installed on both ends, I was able to achieve reliable communication between any two corners within my 2-story, 2000 sq. ft. house. Below is a picture of these Tx\/Rx modules.<\/p>\n<div id=\"attachment_11269\" style=\"width: 569px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/ASKModules.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11269\" class=\"size-full wp-image-11269\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/ASKModules.jpg\" alt=\"ASK RF modules from NiceRF\" width=\"559\" height=\"455\" \/><\/a><p id=\"caption-attachment-11269\" class=\"wp-caption-text\">ASK RF modules from NiceRF<\/p><\/div>\n<h5>Things you will need<\/h5>\n<p>You will need the following items to build this project.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.tindie.com\/products\/rajbex\/433mhz-ask-rf-transmitterreceiver-kit\/\" target=\"_blank\"><strong>ASK transmitter\/receiver<\/strong><\/a> pair<\/li>\n<li>Two <strong><a href=\"https:\/\/www.tindie.com\/products\/rajbex\/arduino-development-board-with-on-board-sd-slot\/\" target=\"_blank\">Arduino boards<\/a><\/strong>. I am using an Arduino Nano on transmitting side and <strong><a href=\"https:\/\/www.tindie.com\/products\/rajbex\/arduino-development-board-with-on-board-sd-slot\/\" target=\"_blank\">Arduino Uno<\/a><\/strong> on receiving end.<\/li>\n<li>One Nokia 5110 LCD for receiving side<\/li>\n<li>One DHT22 sensor for measuring temperature and humidity at the remote site<\/li>\n<li>Two LEDs and two 330\u03a9 resistors<\/li>\n<li>Wires, breadboard, prototyping board, etc.<\/li>\n<\/ul>\n<h5>Circuit setup: Tx End<\/h5>\n<p>The ASK transmitter module has three pins: <strong>VCC<\/strong>, <strong>Data<\/strong>, and <strong>Gnd<\/strong>. They could be in different sequence depending upon the manufacturers. So, always read the pin labels carefully to identify the data and power supply pins on these modules. The <strong>VCC<\/strong> and <strong>Gnd<\/strong> pins are connected to <strong>+5V<\/strong> and <strong>Gnd<\/strong> pins of Arduino Nano, whereas the Data pin of the Tx module goes to digital I\/O pin 12 of Arduino. An LED is also connected to I\/O pin 11 along with a current limiting resistor in series. During data transmission, this LED is turned on.<\/p>\n<div id=\"attachment_11142\" style=\"width: 588px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/TxCircuit1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11142\" class=\"size-full wp-image-11142\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/TxCircuit1.jpg\" alt=\"Tx Circuit\" width=\"578\" height=\"541\" \/><\/a><p id=\"caption-attachment-11142\" class=\"wp-caption-text\">Tx Circuit (resistor in series with the LED is 330 Ohm)<\/p><\/div>\n<p>The above circuit is wired up on a breadboard as shown below.<\/p>\n<div id=\"attachment_11275\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/TxSetup.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11275\" class=\"size-medium wp-image-11275\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/TxSetup-580x417.jpg\" alt=\"ss\" width=\"580\" height=\"417\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/TxSetup-580x417.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/TxSetup.jpg 590w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-11275\" class=\"wp-caption-text\">Transmitter circuit setup on a breadboard<\/p><\/div>\n<h5>Circuit setup: Rx End<\/h5>\n<p>The Rx module also consists of <strong>VCC<\/strong>, <strong>Gnd<\/strong>, and <strong>Data<\/strong> pins. Some modules may have more than one Data pin. In such case, you can use any one of them as they are all connected together. On the receiving side, the <strong>Data<\/strong> pin of the Rx module output and is read by an\u00a0Arduino pin. In our case, it is connected to the D11 pin of Arduino. Similar to the Tx end, an LED connected to D3 pin is an indicator of receiving the data sent by the transmitter. A Nokia 5110 LCD is also connected to the receiving side Arduino to display the temperature and humidity at the remote station. For this experiment, I am using <strong><a href=\"https:\/\/www.tindie.com\/products\/rajbex\/arduino-development-board-with-on-board-sd-slot\/\" target=\"_blank\">Crowduino Uno<\/a><\/strong> (Arduino Uno clone) on the receiving side.<\/p>\n<p>Please note that Nokia 5110 LCD operates at 3.3V. I am running my Crowduino Uno board at 3.3V so it does not matter in this case. If your Arduino board operates at 5.0V, you would need a voltage shifter in between the Arduino and the LCD. The following diagram shows the connections at the receiving end in more detail.<\/p>\n<div id=\"attachment_11141\" style=\"width: 605px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/RxCircuit.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11141\" class=\"wp-image-11141 size-full\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/RxCircuit.jpg\" alt=\"Rx circuit\" width=\"595\" height=\"567\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/RxCircuit.jpg 595w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/RxCircuit-580x553.jpg 580w\" sizes=\"auto, (max-width: 595px) 100vw, 595px\" \/><\/a><p id=\"caption-attachment-11141\" class=\"wp-caption-text\">Rx circuit (resistor in series with the LED is 330 Ohm)<\/p><\/div>\n<p>I used\u00a0a general purpose Arduino proto-shield to build\u00a0the above circuit. Following figure shows the assembled receiver circuit soldered on the\u00a0Arduino proto-shield.<\/p>\n<div id=\"attachment_11145\" style=\"width: 589px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/P_20160215_140812.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11145\" class=\"size-full wp-image-11145\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/P_20160215_140812.jpg\" alt=\"Receiving module\" width=\"579\" height=\"404\" \/><\/a><p id=\"caption-attachment-11145\" class=\"wp-caption-text\">Receiving module soldered on a prototyping Arduino Uno shield<\/p><\/div>\n<div id=\"attachment_11272\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/RxSetup.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11272\" class=\"size-medium wp-image-11272\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/RxSetup-580x334.jpg\" alt=\"asas\" width=\"580\" height=\"334\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/RxSetup-580x334.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/RxSetup.jpg 590w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-11272\" class=\"wp-caption-text\">Receiving module with ASK receiver plugged in<\/p><\/div>\n<h5>Software<\/h5>\n<p>This project uses the <a href=\"http:\/\/www.airspayce.com\/mikem\/arduino\/VirtualWire\/index.html\" target=\"_blank\">VirtualWire library<\/a> for Arduino written by <em>Mike McCauley<\/em>. This library supports numerous low-cost RF transmitters and receivers available in the market and allows to send short messages through ASK modulation. In this project, the Arduino on Tx end reads temperature and humidity from the DHT22 sensor, combines the two readings into a character string, and send it over the RF link. On the receiving end, the Arduino extracts the two readings back from the received string and displays the data on the Nokia 5110 LCD. You can download the VirtualWire library and Arduino codes for Tx and Rx ends from the following links.<\/p>\n<p>Download <strong><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/VirtualWire.zip\">VirtualWire<\/a><\/strong>\u00a0library<\/p>\n<p>Download <strong><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/ASK_TX_DHT22.zip\">Arduino code for transmitting end<\/a><\/strong><\/p>\n<p>Download\u00a0<strong><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/02\/ASK_RX_DHT22.zip\">Arduino code for receiving end<\/a><\/strong><\/p>\n<h5>Output<\/h5>\n<p>After uploading the firmware to two Arduino boards, the project is ready for testing. You can place the Tx module to the place where you would like to monitor the temperature and humidity remotely and place the Rx module within a 100ft range.\u00a0You should\u00a0see the measured values on the LCD screen as shown below:<\/p>\n<div id=\"attachment_11270\" style=\"width: 400px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11270\" class=\"size-medium wp-image-11270\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output1-390x650.jpg\" alt=\"sdsds\" width=\"390\" height=\"650\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output1-390x650.jpg 390w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output1.jpg 585w\" sizes=\"auto, (max-width: 390px) 100vw, 390px\" \/><\/a><p id=\"caption-attachment-11270\" class=\"wp-caption-text\">Remote monitoring of temperature and humidity<\/p><\/div>\n<p><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-11280\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output2-580x410.jpg\" alt=\"\" width=\"580\" height=\"410\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output2-580x410.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/Output2.jpg 800w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p>This project can be further expanded by adding a buzzer to the Rx end and programming the Arduino to alarm when the temperature and\/or humidity falls outside preset limits.<\/p>\n<p>We sell these Tx and Rx modules as a kit at our Tindie store. If you are interested to get one, click the following link:<\/p>\n<p><strong><a href=\"https:\/\/www.tindie.com\/products\/rajbex\/433mhz-ask-rf-transmitterreceiver-kit\/\" target=\"_blank\">Buy ASK RF kit for $9.99<\/a><\/strong><\/p>\n<div id=\"attachment_11282\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/kit.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-11282\" class=\"size-medium wp-image-11282\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/kit-580x397.jpg\" alt=\"433MHz ASK RF kit\" width=\"580\" height=\"397\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/kit-580x397.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2016\/04\/kit.jpg 800w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-11282\" class=\"wp-caption-text\">433MHz ASK RF kit<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article explores an easy wireless communication setup between two Arduinos using low-cost ASK RF transmitter and receiver modules that are readily available in the market. They are found in different shapes, but functionally they are all same. Both Tx and Rx modules contain a single data line for input and output and support a low-speed Amplitude Shift Keying modulation for data communication. You can get them with 315MHz or 433MHz carrier frequency. In this tutorial, I am using a 433MHz Tx\/Rx pair with two Arduino boards to illustrate how to construct a low-range wireless temperature and humidity monitor.<\/p>\n","protected":false},"author":1,"featured_media":11280,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[150,29,1467,163],"tags":[1365,1366,1364,1369],"class_list":["post-11095","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino-2","category-embedded-lessons","category-projects","category-wireless","tag-433mhz-ask","tag-arduino-rf-communication","tag-rf-communication","tag-wireless-communication-between-two-arduinos"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/11095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=11095"}],"version-history":[{"count":31,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/11095\/revisions"}],"predecessor-version":[{"id":11287,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/11095\/revisions\/11287"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/11280"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=11095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=11095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=11095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}