I need to send an event (one bit) wirelessly. I do not have much code space left in my microcontroller for encoding and serial transmission. I am thinking of using an encoder decoder (HT12-E , HT12D) with my 315mhz 2400 baud transmitter and receivers to solve this problem. This is how I understand it, please reply if I am mistaken:
The encoder will continuously transmit to transmitter the code set at D0-D3 if TE bit is set to low. The microcontroller in transmitter end will set TE low when the event happens. The receiver will output to the decoder which will output the code set in encoder out of pins D0-D3. My microcontroller at receiving end needs to compare D0-D3 out of decoder with the wanted code and if equal then the event has been aknowledged.
How does the encoder decoder know what baud rate I am using? Is it set by putting a resistor in the OSC1 and OSC2 pins? If so, what values of resistor do I use for what baud rate?
Hi,
It sounds to me like you are on the right direction with the encoder/decoder chips. As for the baud rate, you need to have correct values of resistence between the OSC1 and OSC2 pins of both the IC’s.
On the encoder chip put a 750k resistor between the OSC1 and OSC2 pins, and for the decoder put a 33k resistor on the OSC pins. Here is the actual datasheet where I got these values from: http://www.rentron.com/Files/TWSAKIT.pdf Those are the values I have used and they work great. The HT-12E and HT-12D are really cool chips!
Well, I hope this helps and let us know if it works. Later, Caleb
Thanks for your reply Caleb! I connected the encoder and decoder and am getting the output on the decoder. I can only get the signal up to 20 feet and sometimes only 10 feet. I have 6.7" wires as antenna on each end. Also tried connecting a 35 cm wire as antenna on receiver with same results. When I shut down the transmitter sometimes the decoder keeps on outputing the output even if I turn the transmitter on again sending 5V to it’s TE bit. Any suggestions? I am using 315Mhz. Could there be a problem with my transmitter/receiver modules? tuning?
Thanks!
Amir
Hmmm… might be interference. Do you live near a military base or an airport by chance?
I changed the receiver to a different one and now I have a good range - tried walking up the street about 100 feet and got a signal even with the 6" antenna. Maybe the first receiver I soldered in got too hot (begining soldering too!). Checked in the decoder data sheet and saw that it does keep it’s data until it receives a different transmission and the bit VT can be used as a momentary recognition of data in.
Hey Amir,
That’s good you got your emitter and receiver working well! I guess that receiver had some defect or something. I looked up whip antenna lengths for a 315 Mhz band and it said to try a wire length of 8.9". It seems like you got good enough range already with a 6" whip. I guess if you need more range you could expirement with the other length.
Okay, good luck with the rest of your project.
Later,
Caleb