wiguna149

Blog For Sharing Knowledge

Tag Archives: rf module

USING WIRELESS RF MODULE WITH HT12 ENCODER AND DECODER

Here is my latest project: the wireless RF module. I have not explore all the RF module feature, but i want to share what i got for you, so here it is.

THe RF module I used is like TLP433(transmitter, on the left) and RLP433(receiver, on the right). This module works a frequency 433 MHz, but mine works on 315 MHz. I don’t know exactly why but mine costs Rp 100.000 , much cheaper than the 433MHz version which costs Rp 300.000. There are some ther type called tws for the treansmitter and rws for the receiver. Here are the links for datasheet:

transmitter:   http://digi-ware.com/img/d/TLPRLP434ASAW.pdf

receiver:         http://www.wenshing.com.tw/Data_Sheet/RWS-434N-6_433.92MHz_ASK_RF_Receiver_Module_Data_Sheet_E.pdf

RF MODULE

Here are one links with good tutorial on the module usage. In the tutorial, this module is used as a connection for USART serial communication between two microcontrollers. It is done by directly connect the tx pin to the transmitter module data pin and the rx pin to the receiver module data pin. The schematic is drawn very clearly and you can duplicate it easily. There is an example protocol in using USART to make sure that your data is valid by using synchronization byte, address byte and data byte.

http://winavr.scienceprog.com/example-avr-projects/running-tx433-and-rx433-rf-modules-with-avr-microcontrollers.html

I found it useful eventhough i didn’t succesfully do all the step. I can’t manage to make a succesful USART communication continuously.I have tried baudrate 1200 and 600,and it was still not working. The data received is only read when power on transmitter is just turned on. after that, the data will be mostly zero or 255 in integer. with this condition i can’t proceed to the protocol steps. My guess is that the transmitter signal is too weak and is jammed by other signal.

I need to find another way to make the wireless connection. In fact, i only need a few bits on the communication, so i am looking for the other way. And it goes to the HT12 encoder and decoder. Before i continue,here are the links for datasheet:

Encoder: http://www.holtek.com/pdf/consumer/2_12ev120.pdf

Decoder: http://www.holtek.com/pdf/consumer/2_12dv120.pdf

HT12e and HT12D are encoder and decoder which can transfer four bit data of the same eight bit address only with only one channel. The medium can be wire, light, IR, radio frequency and so on. with this ICs, you can transfer data into a specific address of 256 possibility using only one channel.

ENCODER

DECODER

DECODER

here are the schematic i got from googling. In this schematic you can see the connection from the IC and RF module. it is simple enough for it only uses 5 V power supply and one additional resistor for each IC. If you use HT12A rather than HT12E, you need to connect a crystal oscillator to make it work,so i recommended using HT12E. the control pin in HT12 is usually high by default and active low. Transmission from HT12E is only occured when transmission enable(TE) pin logic is 0. Valid transmission is in logic 1 by default and will be 0 when a valid transmission is occured.

I only need the connection between two pair of RF module because the communication must be two sided. In my case, address bit is not rally important, so i set all the address into 0. By default, the input pin of HT12E is read as logic 1 when not connected. even then, the open connection voltage is not 5 V or 3V but only measured on about 0,35V. eventhough the voltage is nearly zero, the logic is read as 1.  Logic is 0 when the pin is connected to ground or the voltage is 0,00 V. I’ve spent a day thinking that the IC might be broken by showing nearly zero voltage and figured out this fact on the next day.

The system i made is divided into the remote module and the control module. Remote module contains only switches and LED. Transmission is only occured when the switch is hit, so i connected a diode from the transmission enabe(TE) pin into data pin. Anode is in the TE pin, while Cathode is in data pin. With this connection, when the switch is hit, the data will be connected to ground and TE pin will be pulled down along with data pin.

DIODE CONNECTION

DIODE CONNECTION

The control part is connected into computer which will give the control signal for turning LED on and read data input from remote module. The control module is also used to make sure thera are no more than one transmission occured at one time. The signal will be jammed by each other because both works with same frequency and power. The control module can only transmit data when it is not receiving data for a while. I assumed that by not receiveng data for a while, there are no transmission occured from remote module. data transmitted is sensed by the VT pin in HT12D of  control module. Because it needs to be connected to computer, i use ATTINY 2313 which is small enough and has the USART capability. I also use max232 to make connection to PC via DB9 serial port. ATTINY2313 is the main executor which control the input and output data based on input from computer.

Here are the photo of my final system:

FINAL SYSTEM

FINAL SYSTEM

This project has not been working very well. I can’t make a good two way connection. i got problem with the usage of VT pin. I used it as signal for external interrupt but it only manage to make comunication after the switch is off.

i still got some question:

– why can’t i use the TX and RX pin of USART directly into the RF module and make a stabilized connection?

– What is the difference on data transfer between microcontroller’s USART and the HT12E serial output?

– is there any other easy and cheap way to make two way wireless communication?

I hope this writing will be helpful to all the reader.Enjoy..