Hi! I've recently switched from an IR receiver to a 433 MHz RF transmitter/receiver for my project and have a few questions. The product I'm using is this, which I understand to be fairly bog standard. I've got it working to transmit strings and other data types using a 17cm monopole antenna but would like to understand how it works, and optimise its use.
First, what should the receiver output look like for a continuous HIGH input on the transmitter? I'd have expected it to be continuous HIGH, but doing an analogRead on the signal doesn't suggest that. I also hooked up LEDs to the Tx input and Rx output pins and they were doing different things. I'm aware there's some adaptive gain function in there but I'm not sure what it's doing or how it works.
The reason I ask is that I'd like to do a really simple protocol whereby I send the main instruction by RadioHead library functions, and the system continues to operate while the transmitter is transmitting continuously. It takes ~0.07s to transmit even a byte at 2000bps and I'd like to consider improving response times. But if the output from that simple input isn't predictable I'd be stuck with using the library function.
Second, I understand that the RadioHead functions get in the way of PWM outputs. Ideally I'd be able to use them as my project involves motor control via MOSFET. If I was to implement a really basic/hacky homemade asynch protocol, using millis() or micros() or something, which only needed to transmit a byte of data, could I get around that? Are there any good guides for that sort of thing?
Third, I notice that there's a variable resistor on the board for frequency tuning. How would I ensure that it was optimally set? All the boards work OK at the moment - would it be completely inoperable if it was set wrong? Hypothetically, how would you tune to a different frequency?
Any "continuous transmission" on 433 mHz is illegal. Your device ONLY transmit "data" and only receive "data", not individual "signals".
Read the data sheets/specifications, they will clarify.
"First" - The data output pin on the receiver will oscillate semi-randomly if there is a continuous transmission or no transmission being received, as you've observed, typically a little below 100 Hz. The reason is the receiver circuit performs gain control such that the detected signal is on average at the threshold for declaring a "1" or "0" state on the output. For optimum performance the transmitted signal should have a 50% average duty cycle which is something the RadioHead and Manchester libraries do for you.
If you were to transmit a square wave (i.e. tone(pin#, 2000)), you would see that square wave reproduced on the receiver data pin. As noted in Paul_KD7HB's reply, continuous transmission on this frequency is not strictly legal in most jurisdictions and I would recommend against doing so for more then brief periods.
"Second" - If you have a small number of conditions that you want to send then there may be simple protocols to do so. Following on the above for example, you might use a 1000 Hz square wave to designate one of two states and a 2000 kHz tone to designate the other state. A potential issue with very simple protocols is that they may not be robust to interference and give false state changes. It would be unfortunate and perhaps dangerous if your motor started running every time the neighbor's 433 MHz wireless thermometer sent an update for instance.
"Third" - The screw head on the receiver module is a variable inductor that is used to tune the received frequency. Without involving laboratory test equipment, there is almost no chance messing with it will improve on the factory setting. Even well tuned these regenerative receivers aren't very good compared to the not much more expensive superheterdyne receivers (e.g. RXB12).
The 433 MHz receivers have an "automatic gain control" that adapts the receiver to the ambient signal level. So in a steady state situation, the receiver will output random noise, regardless of whether a nearby transmitter is ON or OFF.
For data transmission, the usual approach is: a period of radio transmit silence, then a preamble signal that allows the receiver to adjust its gain, then a start byte (or two), some data, possibly an error check code, and a stop byte (or two), followed by radio silence.
The VirtualWire and RadioHead libraries both use this general approach. I like VirtualWire, which takes up little code space, and works very well.
With the very cheapest 433 MHz modules, you can can get over 300 meters line of sight range, if you use a balanced dipole antenna, about 33 cm from tip to tip on both TX and RX, as shown in the photo below. The inner connection to one antenna leg is ANT, the other is the GND (yes, GND) on both TX and RX.
The receiver module shown is a superregenerative type - very simple but rather poor performance. Its design does not lend itself to resolving DC levels at all.
You are advised to use a superheterodyne module instead - for almost all purposes.
Aliexpress item
Dear all, thank you so much for your advice and in particular MrMark and jremington. The dipole antenna I've seen before on another post, I think by you; while as a physicist I enjoy antenna theory, I'm only communicating from the landing to the loft for a loft hatch remote control!
I think in conclusion that I will stick with the system as-is, using the library.
However if anybody can advise on the impact of choosing different data rates with the RadioHead library, it'd be really useful as it might mean that the system is more responsive to the 'stop' signals.
I'm getting flawless transmission at the moment with RH_ASK default of 2000 bps. I'm using a L/4 solid copper wire monopole antenna over a range of a couple of metres, from the landing through a ceiling to the receiver in the loft/attic.
There's a spectrum (pun intended) of sophistication in RF modules:
simple OOK modules like these,
fm transceiver modules with simple packetization and programmable settings (RFM12/nRF24L01 etc),
modules with transceiver and protocol support built in, like ZigBee, LoRa modules,
typically implementing their own modulation technique as well as lower-level
protocol layers.
SDR - software defined radio modules, where the host software does all the work
in the digital domain. These can emulate any of the above pretty much, but require
serious DSP capability in the host to do anything!
I'm getting flawless transmission at the moment with RH_ASK default of 2000 bps. I'm using a L/4 solid copper wire monopole antenna over a range of a couple of metres, from the landing through a ceiling to the receiver in the loft/attic.
But that suggests it might not go much higher!
Please understand that the 2000bps is the data rate you send to the transmitter and are receiving from the receiver. It is not the rate of data that is sent by RF from the transmitter to the receiver. You do not have control of that.
Paul