What's that sparkle? 433Mhz Modules

Hello everyone

today I would like to present to you the last contribution of the series "What is sparking?" for the time being. We start with a primitive radio link between two Unos. For this purpose, we use a 433Mhz Set from our online shop together with two controllers. The e-book for the radio modules can be found Here.First, we simply put the modules on the Unos, as shown in the picture:

In general, it is not advisable to operate the 433Mhz modules on a breadboard as the metal contained in it scatters or disturbs the signal, but we still come to the topic of interference.

The idea behind the following sketches is to transmit a simple high signal via the 433Mhz modules from the sending to the receiving UNO. We start with the code for the sender:

Int Data = 7;

Void Setup(){
 Serial.Begin(9600);
 pinMode(LED_BUILTIN, Output);
 pinMode(5, Output); 
 digitalWrite(5, Low); Let's use as GND
 pinMode(6, Output);
 digitalWrite(6, High); Let's use as VCC
 pinMode(Data, Output); 
 digitalWrite(Data, Low);  For the data
}

Void Loop() {            digitalWrite(Data, Low);   digitalWrite(LED_BUILTIN, Low);   Delay(1000);   digitalWrite(Data, High);   digitalWrite(LED_BUILTIN, High);   Delay(1000);
}

In our previous posts, we showed how to set up a DVB-T Stick as sDR on the Raspberry and install GQRX. Well, we've grown up a bit of this solution now, and in this example we're using SDR' on Windows.

As we see, our sketch works quite well and does what it is supposed to do. Now we take care of the code for the recipient:

Int Data = 5;

Void Setup(){
 Serial.Begin(9600);
 pinMode(LED_BUILTIN, Output);
 pinMode(4, Output); 
 digitalWrite(4, Low); Let's use as GND
 pinMode(Data, Input); 
 digitalWrite(Data, Low);  For the data
 pinMode(7, Output);
 digitalWrite(7, High); Let's use as VCC
}

Void Loop() {     sets the LED to High at signal input   digitalWrite(LED_BUILTIN,digitalRead(Data));   Delay(50);
}

Once the code is transmitted, we should register a light-up of the internal LED of the receiver at each high signal of the transmitter. Unfortunately, this does not work at all, as you might see when rebuilding this project.

There are many reasons for this, but I do not want to go into this in order not to go beyond the scope of this contribution. That's why we're looking for a libary that contains bug fixes and we can reliably transmit more complex data than a primitive high low signal. The solution to this problem is to succeed the VirtualWire Libary: Radiohead

You can use this library after the Download "*.zip Library" function included in the IDE

We use a slightly modified version of ask_receiver and ask_transmitter for our example.

In order not to have to change the pins in the RH_Ask.h, we quickly rewire our Unos. The pins predefined in the libary are documented as follows:

433 module UNO Receiver UNO Transmitter
Vcc 5v 5v
Gnd Gnd Gnd
Data 11 12

 

The code for the sender:

#include <RH_ASK.H>
#include <Spi.H> Not actually used but needed to compile

RH_ASK Driver;

Void Setup()
{     Serial.Begin(9600);     If (!Driver.Init())          Serial.println("init failed");
}

Void Loop()
{     Const Char *Msg = "Measurement data"; message to be sent.     Driver.send((uint8_t *)Msg, Strlen(Msg));     Driver.waitPacketSent();     Delay(200);
}

 

The code for the recipient:

#include <RH_ASK.H>
#include <Spi.H> Not actualy used but needed to compile

RH_ASK Driver;

Void Setup()
{     Serial.Begin(9600); Debugging only     If (!Driver.Init())          Serial.println("init failed");
}

Void Loop()
{     uint8_t Buf[9]; Format of the message to be received     uint8_t buflen = sizeof(buf);     if (driver.recv(buf, &buflen)) // Non-blocking     {       int i;       // Message with a good checksum received, dump it.       Serial.print("Message: ");       Serial.println((char*)buf);              }
} Im seriellen Monitor des Empfängers sehen wir die Ausgabe:

Viel Spass beim Basteln & bis zum nächsten Mal :)

AmateurfunkFor arduinoProjects for beginners

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN