Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Inerfacing RF 433 module with UART transmission in PIC

Status
Not open for further replies.

demetal

Full Member level 5
Joined
May 2, 2011
Messages
275
Helped
21
Reputation
42
Reaction score
21
Trophy points
1,298
Location
Kingdom Of Kochi
Activity points
3,173
Hi,

I like to transmit a data entered from a keypad via UART using RF 433 Module and receive it in another pic microcontroller.... I am using PIC 16f877A.... My doubt is that can i send data by using common codes used for UART communication ... i.e; just connecting the tx pin of uC to data pin of Module in transmitter section and in receiver data pin of module to rx pin of uc and usig the general code for UART communication...I referred other threads but not got a proper answer....


please help
 

I wonder if "RF 433" is a unique part number. There's however a number of cheap AM transmitter/receiver modules intended to work with Holtek HT12 remote control encoders/decoders. According to the datasheet specification, these modules don't work well with duty cycles (= ratio of 0 and 1 bits in an UART frame) below 1/3 or above 2/3. For cooperation with UART signals, you would want at least a kind of data recoding to fulfill this requirement. You'll find previous Edaboard threads that suggest a manchester alike recoding, coding one byte in two and replacing each original bit by a 01 or 10 sequence. That's not excatly manchester encoding due to the UART framing but similar in terms of bit balancing.

The other critical point is synchronization to the first data bit at the receiver side. There can be no doubt that it works best with a preamble and manchester encoded data.
 

Thanks for replying FvM...

So are there any type of such Rf using which UART signal can be directly transmitted....?

I would like to know how to change the UART transmission bit in Manchester code... as i am getting the character sequence from the keypad store it in an string and transmitting it while i press a button on keypad.... can you please tell at which stage and how to change it to such code and transmit via UART....?
 

There's a number of 433 MHz RF modules that is able to reliably transmit arbitrary data. These are either "intelligent" modules with an on-board microprocessor like this **broken link removed** or chips/modules with SPI interface, e.g. from TI or HopeRF.

I already sketched the method of coding one byte in two, by repeating each bit send to the UART with an inverted copy.

0x41 = 0b01000001 turns into 0b01100101 0b01010110 or 0x65 0x56

On the receiver side, the data is compressed again to a single byte.
 
Thanks for the help.... so we need to choose a pin other than UART for manchester code isnt it....?

On this occasion i would like to clear my doubt with the same project ..., but instead of rf module it uses LASER as transmitter .... As i saw difficulty in receiving the laser signals and degenerating data by using UART... i think this self clocked pulse will help to do it better in regenerating the signal from laser by a phototransister....If you have any experience about this LASER project Please share.....


Thank You.

---------- Post added at 02:25 ---------- Previous post was at 02:20 ----------

I would like to know about the BAUD RATE setting while using mancherster code.... i am using a 20 Mhz crystal for pIC 16F877A.... Is that ok....or we need to change....?
 

The above sketched manchester-like coding can be send out with a regular UART, the recoding of 4-Bit nibbles can be either performed with a table or by using bit operations. A previous Edaboard thread, that couldn't find now was suggesting to receive the data also with an UART. That can possibly work, but lacks of an optimal bit level synchronization. Suspecting bit errors particularly for the first bits, when the receiver detector is already settling to the correct threshold level, suggests to use a preamble and sync on the first different bit and possibly an additional sync character.

To achieve this with a PIC, you have to perform at least the reception with a software based deserializer. This isn't difficult to achieve for usual transmission baudrates of 9k6 or 19k2 maximum, but involves some coding effort.
 
I think the reference makes to 'Manchester' like encoding through a UART was from me but it looks like Edaboard has deleted messages more than about four months old. I have replied to the OP elsewhere.

Brian.
 

it looks like Edaboard has deleted messages more than about four months old.
Other old threads related to Manchester encoding are still present. Thus I think the said one will exist as well. There's only a limitation in displaying your own posts as such, all can be found in a search.

I have replied to the OP elsewhere.
I see. I didn't watch this thread, once I had identified as cross-posting.

P.S.: Your post is in this thread https://www.edaboard.com/threads/149646/

Reviewing this and other threads about Manchester coding and cheap RF modules suggests that everything has been already said. We should rather copy the threads to a tutorial than answering the same questions again and again.

Thanks for clarifying.
 
Last edited:

Hi, thanks for help in manchester coding... I got idea about it...
while choosing the 433 modude which type is best ASK or FSK... Can anyone tell me how they differ in there performance...like range, and method of transmission used and any preferred algorithm if any....?
 

Hi, thanks for help in manchester coding... I got idea about it...

Both FvM and Betwixt have done an excellent job discussing the concepts of Manchester Encoding. However, you may find the following resource group of value:

Embedded Wireless Networks - WiFi, ZigBee, MiWi, 802.15.4, Bluetooth & RF

I have posted numerous example projects using both ASK and FSK based RF modules and regularly post additional resources as I come across them.

There is also thread dedicated to Manchester Encoding, with various links concerning the topic.

Although I have posted the link to the following document in previous threads concerning Manchester Encoding, I'm reposting it again in this thread for your convenience:

**broken link removed**

The PDF above has C code examples implementing Manchester Encoding while utilizing a microcontroller's UART.


while choosing the 433 modude which type is best ASK or FSK... Can anyone tell me how they differ in there performance...like range, and method of transmission used and any preferred algorithm if any....?

Just two of the major differences between ASK and FSK modulation techniques are as follows:

1. ASK makes more efficient use of bandwidth than FSK, which typically requires double the bandwidth to achieve the same data rate.

2. ASK is significantly more susceptible to noise than FSK.

The ASK and FSK modulation techniques and their advantages and disadvantages are outlined in the following PDF:

**broken link removed**
Hope the info helps in your endeavors,

BigDog
 
Last edited by a moderator:
Thanks bigdog for linking the excellent article about UART manchester encoding, I wasn't aware of it yet. It particularly suggests a convincing UART compatible solution for the start sync problem. I personally prefer second generation RF chips like CC1100 that perform the manchester coding and decoding in hardware, but if you want to utilize one of the more basic modules, the article can be read as a detailed how-to instruction.

Frank
 

hi,

While transmitting data by using RF module i found that it is showing error symbols when single power supply is not used or in other words when i used separate power supply for the transmitting and receiving circuit it is showing error... please help...
 

Have you implemented an encoding scheme, like the Manchester Encoding discussed above?

BigDog
 

Hi.,
i implemended the manchester coding by mikroc library function for manchester code... But it gave more error... As i connected the module without encoding in uart pins its working in a single power supply without error... But not in a seperate power supply....

Please help...
 

Posting the schematics of both the TX and RX circuits, along with your code would help us advise you further.

Are these TX/RX pairs you have incorporated in your design, ASK? Can you post the datasheet for these modules?

BigDog
 

Hi,
sorry for the late reply, .... I am using a cheap ask type rf module... I think it doesnt support manchester coding.... When i use direct uart the rate of error is low... When i used manchester code (which is a library function example for manchester code library in mikroc... Even it is not working... )error rate is high... I have to get out put in anyway this wheek... Please help.. Can i use fsk type to rectify this problem its urgent...

Please help...
 

I think it doesnt support manchester coding....
That's hardly possible. But manchester coding may be incorrectly implemented in the mikro-C library.
 

I think it doesnt support manchester coding....

Highly unlikely.


Can i use fsk type to rectify this problem its urgent...

FSK is less susceptible to many of the factors which can generate high error rates in ASK TX/RX pairs.

However, I believe you are too quick to admit defeat. There are other alternatives, writing your own Manchester Encoding routines for example.


But manchester coding may be incorrectly implemented in the mikro-C library.

No...Really? :shock: :lol:

We could submit a trouble ticket with MikroE, of course we may not receive a response before the end of the year. :roll:

And we cannot troubleshoot the issue with the source code, because it's not available. Ah yes, the perils of the MikroC Libraries.



Have you attempted or considered writing your own Manchester Encoding routines?

The document in my previous post, Manchester encoding using RS-232, is quite detailed with example code.


BigDog
 
  • Like
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Thank you bigdogguru for your guidance....

I read the document and it was great... but i was not able to understand some command lines in the codes please help to make it understand as i am using mikroC and i need to translate these codes to mikroC....

FOR TRANSMITTER


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void SendData(BYTE txbyte)
{
   int i,j,b,me;
   b = txbyte;
   for (i=0; i<2; i++) {
    me = 0; // manchester encoded txbyte
    for (j=0 ; j<4; j++) {
     me >>=2;                                   //                             "what does these command means ,Is it assigns the value 2 to me ?"
   if (bit_test(b,0) )
   me |= 0b01000000; // 1->0              //                     "What does the term " |= " means, is it an NOT operation...? or some implicit form like a+=c for a=a+c...?"
   else
   me |= 0b10000000; // 0->1
   b >>=1;
   }
  putc(me);                                        //                   " Can we send the data bit "me" via UART SEND command in this line by replacing "putc(me)" ?"
  }
}



I am sending data from a keyboard using PS/2 connection (working good).... Can i send these data get from ps/2... i.e; i dont know whether its a 8 bit or 4 bit.... do we need to add extra codes...?

RECEIVER CODE


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
BYTE DecodeData(BYTE encoded)
{
   BYTE i,dec,enc,pattern;
   enc = encoded;
   if (enc == 0xf0) // start/end condition encountered
   return 0xf0;
   dec = 0;
   for (i=0; i<4; i++) {
   dec >>=1;
   pattern = enc & 0b11;
   if (pattern == 0b01) // 1
   bit_set(dec,3);                          // " what does these command means... why is the parameter "(dec, 3)" means..? "
   else if (pattern == 0b10)
   bit_clear(dec,3); // 0
   else
   return 0xff; // illegal code
   enc >>=2;                                  //" what is enc ?"
  }
return dec;                                     //                   " Can we receive the data bit "dec" via UART RECEIVE command in this line by replacing this line ?"
}




please reply... thank you...
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top