1

I have two Arduino Uno and a few sets of transmitters and receivers. I followed some guide on the internet to make them work and that's what I did so far but I still get random values of 0 or 1 or 2, no matter what signals I am trasmitting.

I connected the receiver's VCC to 5v on Arduino; the receiver's data to A0 on the Arduino; the receiver's GND to the Arduino's GND.

I connected the transmitter's VCC to 5v on Arduino; the transmitter's data to on Arduino; the transmitter's GND to the Arduino's GND.

This is the transmitter code:

#define dataout 12
#define ledPin 13
unsigned int temp = 0;

void setup() {
  pinMode(dataout, OUTPUT);     
  pinMode(ledPin, OUTPUT); 
}

void loop() {

  digitalWrite(dataout, HIGH);
  digitalWrite(ledPin, HIGH);
  delay(5000);
  digitalWrite(dataout,LOW);
  digitalWrite(ledPin, LOW);
  delay(5000);
}

This is the recriver code:

const int datain=A0;
#define ledPin 13

int temp = 0;
const unsigned int upperThreshold = 500;
const unsigned int lowerThreshold = 100;

void setup() {
  pinMode(datain, INPUT);
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  temp=analogRead(datain);
  Serial.println(temp);
  delay(300);
  if(temp<lowerThreshold) {
    digitalWrite(ledPin, HIGH);
  }

  if(temp>upperThreshold) {
    digitalWrite(ledPin, LOW);
  }
}

I tried to change the transmitter and receivers. I tried to change Arduino boards. I tried to change analog to digital, nothing worked...

Suggestions?

Update:

Here are some pictures of my gear:

Transmitter

Receiver

This is the output of the receiver when both Arduinos work near each other, there no sync between the signals transmitting and receiving.

0 1 0 0 0 0 1 1 0 2 1 2 1 0 1 362 0 1 1 1 1 1 0 2 0 314 2 2 1 0 0 2 1 0 1 2 1 1 2 0 1 1 0 1 1 2 1 0 0 0 0 2 1 0 1 0 0 1 0 1 0 1 1 1 2 2 1 1 2 1 1 1 1 1 0 211 2 0 2 0 0 1 2 0 0 759 1 2 1 1 2 1 2 0 1 16 0 0 1 1 0 0 2 1 1 0 1 2 1 2 0 2 1 0 2 0 1 2 1 1 2 2 1 2 0 0 1 0 1 1 2

This is the output when I tried to disconnect the GND and VCC from the receiver:

433 426 431 422 379 367 362 394 405 412 406 394 399 388 356 258 193 438 507 507 499 486 478 473 449 442 431 428 427 424 425 423 422 419 417 414 413 413 409 410

3
  • I thought the typical 433 device used a modulation of the carrier signal to transmit the data. You end up using it like a Morse code system. Your code needs to be a lot more complex than that, or use a library. Of course I might be wrong, because I don't know what gear you are using (post a picture/part number/data sheet). Jul 12 '17 at 11:52
  • The receivers probably don't receive a DC voltage, only a stream of bits. You probably need a library and digital pins and interrupts. Please tell which transmitter and receivers you have, and give a link to that guide,
    – Jot
    Jul 12 '17 at 13:55
  • I updated my post, Code Gorilla - how can i use a library? i tried to use virtual wire but failed... Jot - the receiver do receive DC voltage as you can see in the outputs i got
    – user35399
    Jul 15 '17 at 12:45
1

Those cheap 433 MHz RF modules require a (good) library to work. The VirtualWire/RadioHead library is the best.

The VirtualWire library it outdated, but still used.

The RadioHead library has a few bugs fixed, but uses more memory.
Use it in RH_ASK mode, see the included 'ask' examples.

[Update: better quality]
Most cheap 433 MHz ASK transmitters work with 3.5 to 12V. They have the longest range at 12V. About 20 meters is no problem with 5V, but if longer range is needed then transmitters that are only made for 5V are better.
The cheap 433 MHz receivers use a coil to tune the frequency. They are very sensitive and they do work well. However, when such a module is placed near metal or close to the Arduino, the frequency might change. Modules that use a crystal for the frequency are better. Sometimes a sensitivity is mentioned (for example -112dBm) but I don't know how reliable that is. When an antenna of 16 cm does not work well, try an antenna of more than a meter.

The transceivers are better for wireless data transfer, but that depends on the use.
Sparkfun has Wireless Buying Guide.
RadioHead has a list of supported transceivers.

The nRF24L01+ are very cheap. I read that every one of them on Ebay or Aliexpress is counterfeit, but the counterfeit chips do work. They work at 3.3V, and are 5V tolerant.

The CC1101, CC2500 and so on are good, but not often used with an Arduino. The same for Si4432, Si4436 and so on. If you know a good library, they are very good transceiver chips.

Adafruit is using the RFM69 a lot. For example the Feather Packet Radio board.

Last but not least: don't forget Wifi and Bluetooth.

2
  • can you please recommend me on some good transmitters and recievers?
    – user35399
    Jul 16 '17 at 12:01
  • @user35399, I have added a "Update: better quality" section.
    – Jot
    Jul 16 '17 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.