Project is complex; will be used to control a remote switch using two Ebyte e900T30D modules, two esp32 devkit v1, KY002S MOSFET Switch, and INA226 Battery Monitor. Eveything is wired and working; however, both the Sender and the receiver sketches are producing only a few lines of the expected serial output lines.
Wiring has been traced with DMM and confirmed to be correct.
I just flew low but very rapidly over your ~900 lines of code.
When you say this
void loop() {
if (e220ttl.available() > 1) {
//Do not see this returned
Serial.println("Message arrived!");
are you meaning to point out an example of lines that are not produced? Do you mean never, or just not each time you expect?
Also, this jumped up
if (data == 1) {
int data = 1;
Serial.println("\nBattery Switch is ON");
Serial.println("ESP32 waking from Deep Sleep\n");
}
and in a few other places you declare a new variable data and either don't use it or use it merely to pass the value you assign to it to another function.
This may be leftover, intentional or wrong, in any case it slows this reader down, are there others like it?
I won't be able to look closer until I am in the lab. Just now I'd say you have some kind of hardware issue, or some timing problem. Big help, huh?
I would start with simple sketches that only do the communication that is failing; fake or omit everything else. You may already have such pair leftover from your early experiments and tests.
Yes, likely a left over. My first experience with Ebyte modules; it has been very challenging. Fatigue has been an issue too. Spent hours and days going over this code; before posting, little crossed eyed now. Good to have additional eyes on code; thank you 777.
I have verified module is putting out the RF, Wake on Radio and Message waveform:
Switching options in loop are working. There is an issue with Deep Sleep. When deep sleep is called; ESP32 goes to sleep, then it immediate wakes and goes to and executes setup. Can deep sleep be called from within the loop?
Sender and ReceiverCode is complex; receiver code alone is 584 lines long.
Thought code might be too long to copy paste in the post; linked to GitHub Repository in post #7.
E220-Remote-Switch project has been completed; featuring E220, Wake-On-Radio with ESP32 Deep Sleep.
E220-Remote-Switch project utilizes two, Ebye E220-900T30D RF modules and two, ESP32 microcontrollers. Current project status: INA226 and KY002S have not been implemented in this update.
ESP32 Receiver; push receiver reset button, this puts the ESP32 into deep sleep.
ESP32 Sender; push sender reset button, this sends Wake on radio (WOR) message to wake ESP32 Receiver from deep sleep.
Open browser to "http://10.0.0.27/relay"; this will create a web request for turning on battery power and start a countdown timer to turn off battery power, then put the ESP32 receiver into deep sleep.
Next web request has a yet to be resolved issue; instead of turning on battery power, this web request ESP32 Sender sends a WOR message awaking the deep sleeping ESP32 receiver.
Second web request is required to turn on battery power and start the countdown timer.
Three advantages of using the Ebyte, E220-900T30D is increased distance 10 km (estimated at power of 30 dbm) and Sleep current of 5 uA. E220-900T30D third feature is the ability to send a WOR message to wake up the receiving
transciver allowing second message; to turn on battery power.
Transmit current of 620 mA is almost instantaneous at 30dbm to send; up to 200 bytes, before dropping to sleep current. Receiving current; for a message, 17.2 mA. Current values are from "Ebytes E220-900T30D User Manual". Measured Standby current 11.8 mA. (E220, Always powered on). Ultilizing E220 Sleep Mode, Sleep current (E220, Always on) ranges from .54 uA to 97.33 uA measured!