Transmitter and Launcher doesn't work

I just programmed two 433MHz RF transmitters and a launcher on a single ESP32 for my project. However, it only prints the debug messages inside the setup() function. Once setup() finishes, it prints the following:

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4888
load:0x40078000,len:16516
load:0x40080400,len:4
load:0x40080404,len:3476
entry 0x400805b4

After that, it seems to restart and go through setup() again, never actually reaching the loop() function. Here's the code I have in the setup() function:

void setup() {
  Serial.begin(115200);
  delay(4000);
  Serial.println("ESP32 433MHz receiver");
  if (RH_PLATFORM == RH_PLATFORM_ESP32)
    Serial.println("RH_PLATFORM_ESP32");
  delay(5000);
  Serial.println("Receiver: rf_driver initialising");
  if (!rf_driver.init()) {
    Serial.println("init failed");
    while (1) delay(1000);
  }
  Serial.println("Receiver: rf_driver initialised");
  Serial.println("ESP8266 433MHz transmitter");
  if (!rf_driver.init()) {
    Serial.println("init failed");
    while (1) delay(10000);
  }
  Serial.println("Transmitter: rf_driver initialised");
}

Such rebooting is often due to an inadequate power supply.

But there could be other problems, usually found in the code you did not post.

this is my full code:

#include <RH_ASK.h>  // Include RadioHead Amplitude Shift Keying Library
#include <SPI.h>     // Include dependant SPI Library

RH_ASK rf_driver(2000, 21, 17);   // ESP32 Create Amplitude Shift Keying Object

void setup() {
  //Already have
}

void loop() {
  Serial.println("Transmitting packet");
  const char *msg = "Hello World";
  rf_driver.send((uint8_t *)msg, strlen(msg)+1);
  rf_driver.waitPacketSent();

  uint8_t buf[20]={0};  // Set buffer to size of expected message
  uint8_t buflen = sizeof(buf);
  // Check if received packet is correct size
  if (rf_driver.recv(buf, &buflen)) {
    // Message received with valid checksum
    Serial.print("Message Received: ");
    Serial.println((char*)buf);
  }
} 

Also, draw by hand and label all parts of how the project is ACTUALLY wired, do NOT draw from the thing you are copying. Take a picture and post.

What is the "launcher"?

Did you get the code working without the mystery add-on? If not, that is the first step.

Here ispicture

No, it isn't. Post complete code that compiles, runs and demonstrates the problem.

For a transmitter and a receiver, most people use two ESP32s, a TX and RX module, and two sets of code. I doubt that one ESP32 can transmit a radio message to itself.

Then there is the "launcher".

Sure!Here it's:

#include <RH_ASK.h>  // Include RadioHead Amplitude Shift Keying Library
#include <SPI.h>     // Include dependant SPI Library

RH_ASK rf_driver(2000, 21, 17);   // ESP32 Create Amplitude Shift Keying Object

void setup() {
  Serial.begin(115200);
  delay(4000);
  Serial.println("ESP32 433MHz receiver");
  if (RH_PLATFORM == RH_PLATFORM_ESP32)
    Serial.println("RH_PLATFORM_ESP32");
  delay(5000);
  Serial.println("Receiver: rf_driver initialising");
  if (!rf_driver.init()) {
    Serial.println("init failed");
    while (1) delay(1000);
  }
  Serial.println("Receiver: rf_driver initialised");
  Serial.println("ESP8266 433MHz transmitter");
  if (!rf_driver.init()) {
    Serial.println("init failed");  
    while (1) delay(10000);
  }
  Serial.println("Transmitter: rf_driver initialised");
}

void loop() {
  Serial.println("Transmitting packet");
  const char *msg = "Hello World";
  rf_driver.send((uint8_t *)msg, strlen(msg)+1);
  rf_driver.waitPacketSent();

  uint8_t buf[20]={0};  // Set buffer to size of expected message
  uint8_t buflen = sizeof(buf);
  // Check if received packet is correct size
  if (rf_driver.recv(buf, &buflen)) {
    // Message received with valid checksum
    Serial.print("Message Received: ");
    Serial.println((char*)buf);
  }
}                                                                                                                      

That is useless. We have to be able to see each wire from one end to the other. Draw it by hand and make sure we old guys can see it.

That is only one esp32, you need two. If they are wired identically then we only need to see one but if they are different we need to see both.

I don't think this will work on one ESP32.

The transmit function is blocking with .waitPacketSent();, and I don't think that the ESP32 is listening to the receiver while it is transmitting.

void loop() {
  Serial.println("Transmitting packet");
  const char *msg = "Hello World";
  rf_driver.send((uint8_t *)msg, strlen(msg)+1);
  rf_driver.waitPacketSent();

  uint8_t buf[20]={0};  // Set buffer to size of expected message
  uint8_t buflen = sizeof(buf);
  // Check if received packet is correct size
  if (rf_driver.recv(buf, &buflen)) {
    // Message received with valid checksum
    Serial.print("Message Received: ");
    Serial.println((char*)buf);
  }
} 

Oh,I see,that the reason why ESP32 reset?

I said I just code on 1,Thank you!

When starting with RadioHead, get the library examples (ask_transmitter.ino, ask_receiver.ino) working first with two ESP32s, one TX and one RX module. Then try other ideas.

1 Like

Then I can't help

1 Like