You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently encountering an issue i want to use ESP32S with LORA RYL896 but issue is from the Sender i send the data to my Receiver but unable to receive it although Lora respond OK while configuring with AT Commands maybe the pin out of RX TX not be corrected can anyone help me guiding the right pin outs for it
void goToSleep() {
Serial.println("Going to sleep...");
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
cli();
sleep_enable();
// Sleep for 8 seconds
wdt_enable(WDTO_8S);
sei();
sleep_cpu();
// Waking up after 8 seconds, go back to sleep for 2 more seconds
sleep_disable();
wdt_disable();
wdt_enable(WDTO_2S);
sleep_enable();
sleep_cpu();
// Fully wake up
sleep_disable();
wdt_disable();
Serial.println("Waking up...");
wakeUpSensors();
int httpCode = http.PUT(data);
if (httpCode == 200) {
Serial.println("Data sent to Firebase successfully.");
} else {
Serial.println("Failed to send data to Firebase. Error code: " + String(httpCode));
}
http.end();
} else {
Serial.println("WiFi not connected.");
}
Serial.println("Received: " + receivedLine);
if (receivedLine.startsWith("+RCV=")) {
// Extract payload after "+RCV="
String payload = receivedLine.substring(5);
payload.trim();
// Extract address and length parts
int addrComma = payload.indexOf(',');
if (addrComma == -1) return;
int lengthComma = payload.indexOf(',', addrComma + 1);
if (lengthComma == -1) return;
// Extract the actual message (JSON data)
String message = payload.substring(lengthComma + 1);
message.trim();
// Ensure we have valid JSON format by keeping only the first '}' occurrence
int jsonEnd = message.lastIndexOf('}');
if (jsonEnd != -1) {
message = message.substring(0, jsonEnd + 1); // Keep only valid JSON part
}
Serial.println("JSON: " + message);
// Send JSON to Firebase
sendToFirebase(message);
}
}
}
The text was updated successfully, but these errors were encountered:
I recently encountering an issue i want to use ESP32S with LORA RYL896 but issue is from the Sender i send the data to my Receiver but unable to receive it although Lora respond OK while configuring with AT Commands maybe the pin out of RX TX not be corrected can anyone help me guiding the right pin outs for it
Sender Code
#include <Wire.h>
#include <Adafruit_INA219.h>
#include "HX710B.h"
#include <DHT.h>
#include <avr/sleep.h>
#include <avr/wdt.h>
// Sensor Pins
#define MHSENSOR_PIN A0
#define MQ135_SENSOR_PIN A2
#define SENSOR_LED_PIN 8
#define LDR_SENSOR_PIN A1
#define RAIN_DROP_ANALOG_PIN A3
#define DHT_SENSOR_PIN 5
#define DHT_TYPE DHT11 // Change to DHT22 if needed
const int PRESSURE_DOUT_PIN = 2;
const int PRESSURE_SCLK_PIN = 3;
Adafruit_INA219 ina219;
HX710B pressure_sensor;
DHT dht(DHT_SENSOR_PIN, DHT_TYPE);
const float MAX_BATTERY_VOLTAGE = 8.4;
const float MIN_BATTERY_VOLTAGE = 6.0;
bool isFirstTransmission = true;
void setup() {
Serial.begin(115200);
Wire.begin();
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
digitalWrite(SENSOR_LED_PIN, HIGH);
// Send payload to Reciever
}
void turnOffSensors() {
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(SENSOR_LED_PIN, LOW);
}
void goToSleep() {
Serial.println("Going to sleep...");
}
void wakeUpSensors() {
pinMode(MHSENSOR_PIN, OUTPUT);
pinMode(MQ135_SENSOR_PIN, OUTPUT);
pinMode(LDR_SENSOR_PIN, OUTPUT);
pinMode(RAIN_DROP_ANALOG_PIN, OUTPUT);
pinMode(DHT_SENSOR_PIN, OUTPUT);
}
Receiver SIDE ESP32S
#include <WiFi.h>
#include <HTTPClient.h>
const char* ssid = "Mi 13";
const char* password = "12345678";
const char* databaseURL = "https://green-bot-d7200-default-rtdb.firebaseio.com/sensorData.json";
void sendToFirebase(String data) {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(databaseURL);
http.addHeader("Content-Type", "application/json");
}
void setup() {
Serial.begin(115200);
Serial1.begin(115200);
delay(100);
Serial.println("Initializing LoRa module...");
}
void loop() {
if (Serial1.available()) {
String receivedLine = Serial1.readStringUntil('\n');
receivedLine.trim();
}
The text was updated successfully, but these errors were encountered: