I have a pair of the cheapo green RF modules (XY-FST transmitter and the XY-MK-5V receiver), and got them working with demo code. The "Hello World" message gets sent and then displayed on the Serial Monitor.
But comments I read here mentioned that there are better receivers, so I got a couple of RXB-12s. These are supposed to be pin-compatible with the green receivers.
I unplugged the green receiver, plugged in the new yellow RXB-12 and turned the receiver back on. Nothing! No results. I have the LED on the receiver Arduino blink when it gets a message...it doesn't.
The Radiohead library docs seem to say that all ASK modules use the same drivers.
What do you suggest I look at? Code below.
Transmitter:
/*
433 MHz RF Module Transmitter Demonstration 1
RF-Xmit-Demo-1.ino
Demonstrates 433 MHz RF Transmitter Module
DroneBot Workshop 2018
https://dronebotworkshop.com
*/
// JC Button setup
#include <JC_Button.h>
const byte
BUTTON_PIN(7), // connect a button switch from this pin to ground
LED_PIN(13);
Button myBtn(BUTTON_PIN); // define the button
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
{
myBtn.begin(); // initialize the button object
pinMode(LED_PIN, OUTPUT);
// Initialize ASK Object
rf_driver.init();
}
void loop()
{
const char *msg = "Welcome to the Workshop!";
myBtn.read(); // read the button
if (myBtn.wasReleased()) // if the button was released, change the LED state
{
digitalWrite(LED_PIN, HIGH);
rf_driver.send((uint8_t *)msg, strlen(msg));
rf_driver.waitPacketSent();
delay(100);
digitalWrite(LED_PIN, LOW);
}
}
Receiver:
/*
433 MHz RF Module Receiver Demonstration 1
RF-Rcv-Demo-1.ino
Demonstrates 433 MHz RF Receiver Module
DroneBot Workshop 2018
https://dronebotworkshop.com
*/
// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library
#include <SPI.h>
const byte LED_PIN(13);
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
void setup()
{
pinMode(LED_PIN, OUTPUT);
// Initialize ASK Object
rf_driver.init();
// Setup Serial Monitor
Serial.begin(9600);
}
void loop()
{
const uint8_t bufSize = 24;
uint8_t buf[bufSize+1]; // one extra space for a trailing null char
uint8_t buflen = bufSize;
// Check if received packet is correct size
if (rf_driver.recv(buf, &buflen)) {
buf[buflen] = '\0'; // will not overflow since we added the +1
Serial.print("Message Received: "); Serial.println((char*)buf);
digitalWrite(LED_PIN, HIGH);
delay(500);
digitalWrite(LED_PIN, LOW);
}
}
I have never used those modules. If they use the same driver, are they also using the same frequency and protocol between modules? Maybe these modules only work in pairs. Kinda like men can talk to men and women can talk to women but often, men cant talk with women. Ok, maybe thats being sexist. Maybe I should have said French and Germans...
There's some discussion on this forum about the range and reliability of the usual green receivers. After going through all of it, I ordered the RXB-12s.
A couple of examples from earlier threads:
The standard green receivers have poor range, and are also prone to lock up - which I have seen. the receiver suddenly stops working for no reason, from only a couple of feet away.
So this is not a working setup, it's flawed and I can't figure out how to get one of the RXB-12s running.
I have a bunch of real cheap units and they are all marked carefully in pairs that work together… can't just use a transmitter and a receiver reliably.
So I ask if there is a transmitter with the same good press more likely to work with the receiver you prefer.
I would only buy 433 units as pairs, TX and RX coming out of the same factory at more or less the same time.
I was mixing and matching 433 MHz transmitters and receivers with no problems. SYN115-based, cheap green (the cheap transmitters - they were actually fine), and STX882's (won by a narrow margin) on TX, and RXB-12, the dirt cheap yellow ones on RX blew the cheap receivers out of the water and were a drop-in pin compatible replacement. And the RXB module with the little shield on it, a bulkier RXB module with a TSSOP chip visible, the SRX882. All of them could talk to eachother, it was just a matter of whether the range was 30-40 feet or ~1000 feet (line of sight outdoors) STX to RXB12 was the second best performer, behind a $50 US-made receiver (the $8 US made transmitters were the only transmitter than performed really poorl)
Update on this...I got some other RXB12s from a different supplier. No luck getting them to work either.
So I tried a STX882 and SRX882 pair - they worked right, once I understood that the CS pin on the receiver needs to go to 5V (or a pin that you set to HIGH). I can swap the green transmitter and receiver with the STX/SRX in any combination and they work fine. I even found the datasheets for both the chips on the RXB and the SRX...no luck there.
I've got a working solution but it's really weird that all four RXB modules don't work, and I can't find anything in the datasheets to give me a hint.
The concept of "pairing" a transmitter and receiver applies only to 2.4 GHz systems using spread spectrum technology - and they are usually transceivers.
433 MHz devices are far more basic - these are using "OOK" - "On Off Keying" - not even FM and will be entirely interchangeable. The poorer receivers are superregenerative with absolutely no frequency selectivity at all. The better receivers are superheterodyne and the receiver is crystal controlled so must match the transmitter frequency exactly.
This may well be the problem, that you have transmitter and receiver for slightly different frequencies. The transmitter resonator and receiver crystal should be marked although the receiver crystal differs by the IF frequency and may be difficult to figure.
According to the data sheet linked in the previous post, that would be a ~ 433 MHz receiver module, and it should work with any of the "433" MHz TX modules,
It no doubt should, but even in "sweep" mode which we do not really know whether it is being used, it has a fairly strict bandwidth, completely unlike the superregenerative.
They work goddamnmed fiine. I was getting 1km range line of gight from basic transmitters, like a little more from SRX882 s transmitter. Just quarter wave whip antenna from chopped up network cable as anenna.
I wonder if all the libraries people use just really dont play well with the hardware like they try to default trying to send too fast or too slow (such that AGCsrews evertything up. Do the have a training butst? Etc.
. I wrote OOK transceiver code de novo as one of my first arduino projects, and it works fantastically.... It even worked before I knew about direct port writes,, much less input capture.
The bits and piece (never turned into a library) are in my AzzyRF repo on github.
BTW, if anyone wants to help me librarify it, that'd be awesome.DM me
They re's some verion there even ported to modern AVR.
I am also having problems with the RXB-12 433MHz receiver module. Did you find a solution in the end? I have initially changed the default settings in the RH_ASK instance, using -
which reduces the data rate from 2000bps to 300bps.
Data packet size may also make a difference, although I've yet to investigate that variable.
I also found a data sheet, which has been translated from Chinese and is difficult to fully understand, but maybe gives a clue about a shortfall in its hardware "driver" capability. I'll try adding a single transistor buffer stage to the data output to see if that helps. I'll let you know how I get on.
I never got the RXB-12s to work. I got some other modules that run fine but gave up on those. Did the changes you make actually get them to receive anything?