Welcome back to the Part II of RF Communication tutorial. Here I will show you the basic working principal of RF modules and how to send and receive data through it. Please see the Part I of this tutorial for basic introduction.
How RF Module WorksWorking of RF Modules is simple but with a little trick. The working is shown in figure below :
Here what ever digital data we send on "Data In" of TX is available on "Data Out" of RX. Suppose if you set "data in" high, the "data out" will become high as well. But here lies the trick! The fact is that you cannot Keep Logic HIGH or LOW for a Long period of time, lets say for a few millisecond second. If you apply a logic low on "data in" the "data out" will also become low but only for few millisecond and it will start oscillating(become high/low repeatedly) after that. Same thing will also happen if you set "data in" to high state.
Let us assume that we have connected the RF modules with MCUs as shown below :
When the TX unit is switched off and not transmitting data, then as I said the "data out" of RX will be oscillating high and low and as this is connected to RX of MCU's USART, the MCU#2 will also be receiving garbage data which will create problem. And when TX unit will send some data, MCU#2 will also be receiving them. So MCU #2 is always receiving data either its garbage or some information,even when MCU#1 is not sending anything. So their must be a mechanism to differentiate real data with garbage data.
Sending and receiving data.For this I created a simple mechanism. The steps are shown below :
- We begin transmission by sending character 'A'
- We again send one more 'A'
- Then we send the actual data.
- Now we send the inverse of data. That is all 0's are converted to 1 and vice-versa.
- We end the packet by sending 'Z'
If we went to the end of algorithm successfully that means that we have got a valid data and we can use it in our project.
So in this way we saw how a byte of data is transmitted from MCU#1 to MCU#2 via RF. This simple algorithm filters real data from garbage data. In the next tutorial we will see the practical example of data transmission and reception. We will use the received data to control the IO ports of MCU, in this way we will create a simple multi channel wireless remote control.
If you don't want to get yourself into Serious Technical Trouble while doing your programming OR technical projects then just sit back and relax and let us do the Job for you at a fairly reasonable cost. Submit your project details by Clicking Here »