In this project we send and receive digital data by using a 433MHz transmitter and receiver modules TXM-433 and RXM-433 manufactured by LINX. We also use LINX helical whip-style antennas. The following images show the first part of the project - assembling the modules on a PCB and establishing RF connection between them.
PCB layout | Ready PCB | Assembled PCB |
---|---|---|
The LINX modules are not single chips. They are hybrid circuits mounted on small boards intended for on-surface mounting on a bigger PCB. According to the LINX specifications, the receiver and transmitter modules have to be put on a PCB with a lot of ground space and satisfying some other requirements. Once the RF-part is assembled, the rest of the circuit can be placed on any prototyping board.
The transmitting part consists of a multivibrator based on the 555 timer IC. It generates impulses with a period of approx. 1sec, which are transmitted. The transmitter is powered from a single AA battery and uses MAX756 DC/DC converter working in the step-up mode and converting the battery's 1.5V voltage into 3.3V needed for the transmitter. The receiver is simply powered from two 1.5V batteries. It receives the pulses send out by the transmitter and flashes the LED accordingly. This is our first simple test of the RF channel.
Transmitter | Receiver | Assembled PCB |
---|---|---|
The hardware provides a stable receiving of signals on a 360 feet distance with a transmitter located in a house basement.
The problem we faced with in the above experiments is that the RF channel is filled with other signals, so the TX module receives something even if the TX module is off. Therefore, we need a way to distinguish between our signals and the foreign ones. It is absolutely inappropriate to encode sending of 0 by the absence of carrier, since the TX module always receives some signals and it is difficult to distinguish between 1 and noise this way.
We distinguish between the transmission of 0 and 1 by sending carrier tones of different durations. After numerous experiments we chose a 250μsec period for a serial data transmission. The length of the 0 and 1 signals are set as 150μsec and 200μsec, respectively. We assume that only 1 byte is sent by the TX module and this byte is preceeded by a longer 400μsec synch impulse. The picture below shows the waveform by sending a byte 00110100.
Sending 00110100 |
---|
The PIC program for the TX module is straightforward. In this application we send the ASCII code of 4 (00110100 in binary) over and over. Thus, we send a synch impulse first followed by a pause of 120μsec and then 8 bits of a byte starting with the MSB. Here is the code for this. The program starts with about 2sec delay which is needed to prevent the TX sending a random byte right after its power is on. The TX module is powered form a single AA battery, whose voltage is raised up to 3.3V by MAX756 DC/DC converter.
TX Schematic | TX Layout |
---|---|
The receiver is more complicated. To distinguish between receiving data and channel noise the LINX RX module has the Received Signal Strength Indicator (RSSI) pin. This is an analog output which voltage is proportional to the receiving signal strength. In our conditions with the TX module shut down that voltage at the RSSI pin is fluctuating about 0.85V. Once the TX is on this voltage rises up to approx. 1.6 - 1.8V depending on the distance between the TX and RX. One could use a comparator built into modern PICs to figure out when the date is sent. That is what we did and set up the comparator threshold about 1.5V. The next pictures show the RX module schematics and a test layout on the solderless breadboard. The receiver is also powered by MAX756 that converts 1.5V from the AA battery into 5V. The 330 Ohm resistor drops this voltage down to 3V. One could, of course, put MAX756 into the 3.3V output mode, but we need 5V for other devices attached to the receiver module in our applications.
RX Schematic | RX Layout |
---|---|
The receiver program is implemented as a finite state machine (FSM) with two states. State0 is the starting one. In this state we wait for the synch pulse. First, we loop between two code lines until the comparator attached to the RSSI pin indicates the transmission. After that we measure the length of the received pulse. If it is well below the synch length, we ignore it and stay in the same state waiting for another pulse. The threshold is set up experimentally and is nearly optimal.
Once a qualified synch pulse is received, we move to state1. In this state we receive 8 bits and compose them in a byte. We assume that moving to this state is only possible if the transmitter sends a long enough synch signal and do not check for the signal strength any more. This works fine in our conditions. After measuring the length of the received pulse we compare it against the first threshold. If the pulse is too short we drop it and return back to state0. Otherwise, we check the pulse length against another threshold to distinguish it between 0 and 1. The resulting received bit is stored as the C-bit in the PIC's STATUS register and we use the left shift operation to incorporate it into a byte bt. After receiving 8 bits we go back to state0 and the process repeats.
Another problem we faced with working with the Lynx RX module is a necessity to use a cap for accumulating the RSSI signal. The RX module charges this cap pretty fast, but one also needs to discharge it after a pulse of data is received. Otherwise one gets a lot of noise from the channel. To discharge the cap we turn the PIC's input into an output and send 0 to it for a certain time figured out experimentally. This time has to be long enough to discharge the cap and at the same time short enough in order not to miss the next bit.
To check that we indeed received the byte which was sent, we flash the LED the corresponding number of times (4 times in the current setting). After that we wait for about 2sec and return back to state0 to receive another byte. Experiments show that the code never returned from state1 to state0 because of receiving a too short pulse after the synch. On the other hand, it loops several times (about 3-4 times in average) from state0 back to the same state waiting for a synch signal.
The communication is reliable in the range at least 100 feet needed for the weather station application. The hardware never received a wrong byte. We did not check it for larger distances.
Recently we have discovered a very useful communication protocol which significantly reduces the power consumption of the transmitter. This is the Ten Pulse Data Encoding, which uses the intervals between short pulses to encode the zeros and ones in a byte. This way the transmitter only needs to radiate the carrier during the pulses, which significantly increases the battery life-time. In addition to that, the protocol assumes sending a reference gap before the data, so the receiver can automatically adjust itself to the transmission rate. We took as a prototype the programs developed for a similar project from the Mondo Technology web site. The schematics is pretty much the same as in our previous experiments and use a two-wire interface to an LCD module for debugging. The transmitter sends a text string upon pressing the button and this string is displayed on the LCD at the receiver side.
TX Schematic | RX Schematic |
---|---|
An important question is which pulse width to use. After numerous experiments we came up to the value of 100 μsec, which corresponds to about 5Kbit/sec speed out of the maximum 10Kbps supported by the transmitter module. It turns out that reducing the pulse duration in a factor of 2 leads to a less reliable reception. Also, in our area the 433MHz band has a lot of noise in the form of multiple short chaotic impulses at the receiver output. Further reducing the impulse width makes it difficult to distinguish between the signal and the noise. Note that the receiver uses the analog output RSSI for sending the information to the PIC. The TXM-433 module also provides a digital output, which is implemented by attaching a Schmidt trigger to the analog output. The threshold of the Schmidt trigger is not adjustable and turned out to be inappropriate for our purposes. Instead, the PIC's comparator is used whose threshold of 1.46V is set up by the on-board voltage reference (by powering it from 5V). This way we achieved a good balance between the sensitivity of the receiver and filtering out the noise.
Transmitter | Receiver in action |
---|---|
The transmitter program starts with debouncing the button in the main loop. Upon pressing the button the transmitter is recalled from the sleeping state and put back into sleep after sending the data. This significantly reduces the power consumption of the module. The current settings provide the gaps between the pulses for sending 0 and 1 of length 810μsec and 1890μsec, respectively, while the reference gap width is 1350μsec. The code mimics the prototype citied above and uses a slightly different method for forming the timing delays. This way transmission of one byte varies between 7.8msec and 15.1msec resulting in the transmission rate between 66 and 128 bytes/sec. This is more than sufficient for our applications, where just a few bytes are transmitted in a session.
The receiver program is more noticeably modified from the prototype. The main difference is timing not just the gaps between the pulses, but the pulse durations as well. This way we can ignore short (noise) pulses by timing the gaps. Such short pulses unavoidably appear during the reception and we accept only those gap separation pulses, whose length exceeds a certain threshold determined experimentally. The optimal threshold turns out to be 10μsec for a 100μsec transmitted pulses. This is because the code uses the 50 μsec unit length for timing the gap durations. It might be the case that this unit length interval overlaps with the pulse, which leads to a smaller measured pulse length. This way, we actually filter out short (noise) pulses of length 60μsec or less, which eliminates virtually all noise. Note that the receiving pulses are somewhat shorter than the transmitting ones.
Transmitting 00110100 | Receiving 00110100 |
---|---|
The transmitting and receiving hardware was tested by placing the units in rooms located on different floors of a private house with wooden walls at the distance about 50'. There are 5 vertical/horizontal separating surfaces in between (floor, ceiling, and walls) and a decent number of wide metallic air heating and water pipes running between the floors. The reception of the test string was stable and with no errors. Without ignoring the short pulses the reception was unstable even from the neighboring room.
I was recently asked to implement a 1-channel control under the presence of various distortions. The schematic should allow an operative adjustment of all parameters with pots. To implement this we set the transmitter to generate symmetric square pulses whose period is adjusted by the pot. The pot is connected to the PIC's ADC input and the converted voltage is used as a delay parameter. The period of the modulating waveform can be set up in 100μsec increments starting from 500μsec and up to 255·100+500 = 26msec, which corresponds to the modulating frequencies between 2000Hz and approx. 31Hz, respectively. Here is the code.
Transmitter | Layout |
---|---|
The receiver allows to adjust the signal sensitivity and select and tune to a specific modulating frequency. It uses the receiver's analog output. The voltage at this output is proportional to the signal level. When no signal is transmitted, the DC voltage at this output is about 1.1V. This voltage comes to the non-inverting input of the PIC's built-in comparator. The inverting input of that comparator is connected to the right (on schematic) pot. The voltage at this input must be a bit larger than on the non-inverting one and it determines the system sensitivity. The output of the comparator is monitored by the code and the duration of pulses at its output is measured in the units, whose numeric value is setup by the left (on schematic) pot. This pot is connected to the PIC's ADC. This way the entire system can be tuned to respond to the modulating frequency of the receiver and to no other frequencies. Hence, it works as a frequency selective filter tuned by a pot.
To set up the system one first selects the modulating frequency in the transmitter. After that tune the receiver by slowly rotating its left pot. Both pots should be in approximately the same position, since the same delay units are used in transmitter and receiver for timing.
Receiver | Layout |
---|---|
Last modified:Mon, Jan 23, 2023.