mirror of
https://github.com/timmbogner/Farm-Data-Relay-System
synced 2024-11-08 13:10:29 +00:00
sensors
This commit is contained in:
parent
4927d7db57
commit
b091481605
33
new examples/ESPNOW_Sensor/ESPNOW_Sensor.ino
Normal file
33
new examples/ESPNOW_Sensor/ESPNOW_Sensor.ino
Normal file
@ -0,0 +1,33 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
//
|
||||
// ESP-NOW Sensor Example
|
||||
//
|
||||
// Developed by Timm Bogner (timmbogner@gmail.com) for Sola Gratia Farm in Urbana, Illinois, USA.
|
||||
// An example of how to send data via ESP-NOW using FDRS.
|
||||
//
|
||||
|
||||
#include "fdrs_sensor_config.h"
|
||||
#include <fdrs_sensor.h>
|
||||
|
||||
float data1;
|
||||
float data2;
|
||||
|
||||
void setup() {
|
||||
beginFDRS();
|
||||
}
|
||||
void loop() {
|
||||
data1 = readHum();
|
||||
loadFDRS(data1, HUMIDITY_T);
|
||||
data2 = readTemp();
|
||||
loadFDRS(data2, TEMP_T);
|
||||
sendFDRS();
|
||||
sleepFDRS(10); //Sleep time in seconds
|
||||
}
|
||||
|
||||
float readTemp() {
|
||||
return 22.069;
|
||||
}
|
||||
|
||||
float readHum() {
|
||||
return random(0,100);
|
||||
}
|
33
new examples/ESPNOW_Sensor/fdrs_sensor_config.h
Normal file
33
new examples/ESPNOW_Sensor/fdrs_sensor_config.h
Normal file
@ -0,0 +1,33 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
//
|
||||
// Sensor Configuration
|
||||
|
||||
#include <fdrs_globals.h>
|
||||
|
||||
#define READING_ID 1 //Unique ID for this sensor
|
||||
#define GTWY_MAC 0x01 //Address of the nearest gateway
|
||||
|
||||
#define USE_ESPNOW
|
||||
//#define USE_LORA
|
||||
#define DEEP_SLEEP
|
||||
//#define POWER_CTRL 14
|
||||
#define FDRS_DEBUG
|
||||
|
||||
//SPI Configuration -- Needed only on chipsets with multiple SPI interfaces (ESP32)
|
||||
#define SPI_SCK 5
|
||||
#define SPI_MISO 19
|
||||
#define SPI_MOSI 27
|
||||
|
||||
//LoRa Configuration
|
||||
#define LORA_SS 18
|
||||
#define LORA_RST 14
|
||||
#define LORA_DIO0 26
|
||||
//433E6 for Asia
|
||||
//866E6 for Europe
|
||||
//915E6 for North America
|
||||
//#define LORA_BAND 915E6 // LoRa Frequency Band
|
||||
//#define LORA_SF 7 // LoRa Spreading Factor
|
||||
//#define LORA_TXPWR 17 // LoRa TX power in dBm (+2dBm - +20dBm), default is +17dBm
|
||||
//#define LORA_ACK // Request LoRa acknowledgment. Increases battery usage.
|
||||
//#define LORA_ACK_TIMEOUT 400 // LoRa ACK timeout in ms. (Minimum = 200)
|
||||
//#define LORA_RETRIES 2 // LoRa ACK retries [0 - 3]
|
20
new examples/ESPNOW_Stress_Test/ESPNOW_Stress_Test.ino
Normal file
20
new examples/ESPNOW_Stress_Test/ESPNOW_Stress_Test.ino
Normal file
@ -0,0 +1,20 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
//
|
||||
// ESP-NOW Stress Tester or "Spammer"
|
||||
//
|
||||
// Sends ESP-NOW packets at approximately 60Hz.
|
||||
//
|
||||
|
||||
#include "fdrs_sensor_config.h"
|
||||
#include <fdrs_sensor.h>
|
||||
|
||||
void setup() {
|
||||
beginFDRS();
|
||||
}
|
||||
void loop() {
|
||||
for (uint8_t i=0; i < 255; i++) {
|
||||
loadFDRS(float(i), IT_T);
|
||||
sendFDRS();
|
||||
delay(15);
|
||||
}
|
||||
}
|
33
new examples/ESPNOW_Stress_Test/fdrs_sensor_config.h
Normal file
33
new examples/ESPNOW_Stress_Test/fdrs_sensor_config.h
Normal file
@ -0,0 +1,33 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
//
|
||||
// Sensor Configuration
|
||||
|
||||
#include <fdrs_globals.h>
|
||||
|
||||
#define READING_ID 3 //Unique ID for this sensor
|
||||
#define GTWY_MAC 0x01 //Address of the nearest gateway
|
||||
|
||||
#define USE_ESPNOW
|
||||
//#define USE_LORA
|
||||
//#define DEEP_SLEEP
|
||||
//#define POWER_CTRL 14
|
||||
//#define FDRS_DEBUG
|
||||
|
||||
//SPI Configuration -- Needed only on chipsets with multiple SPI interfaces (ESP32)
|
||||
#define SPI_SCK 5
|
||||
#define SPI_MISO 19
|
||||
#define SPI_MOSI 27
|
||||
|
||||
//LoRa Configuration
|
||||
#define LORA_SS 18
|
||||
#define LORA_RST 14
|
||||
#define LORA_DIO0 26
|
||||
//433E6 for Asia
|
||||
//866E6 for Europe
|
||||
//915E6 for North America
|
||||
//#define LORA_BAND 915E6 // LoRa Frequency Band
|
||||
//#define LORA_SF 7 // LoRa Spreading Factor
|
||||
//#define LORA_TXPWR 17 // LoRa TX power in dBm (+2dBm - +20dBm), default is +17dBm
|
||||
//#define LORA_ACK // Request LoRa acknowledgment. Increases battery usage.
|
||||
//#define LORA_ACK_TIMEOUT 400 // LoRa ACK timeout in ms. (Minimum = 200)
|
||||
//#define LORA_RETRIES 2 // LoRa ACK retries [0 - 3]
|
33
new examples/LoRa_Sensor/LoRa_Sensor.ino
Normal file
33
new examples/LoRa_Sensor/LoRa_Sensor.ino
Normal file
@ -0,0 +1,33 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
//
|
||||
// LoRa Sensor Example
|
||||
//
|
||||
// Developed by Timm Bogner (timmbogner@gmail.com) for Sola Gratia Farm in Urbana, Illinois, USA.
|
||||
// An example of how to send data via LoRa using FDRS.
|
||||
//
|
||||
|
||||
#include "fdrs_sensor_config.h"
|
||||
#include <fdrs_sensor.h>
|
||||
|
||||
float data1;
|
||||
float data2;
|
||||
|
||||
void setup() {
|
||||
beginFDRS();
|
||||
}
|
||||
void loop() {
|
||||
data1 = readHum();
|
||||
loadFDRS(data1, HUMIDITY_T);
|
||||
data2 = readTemp();
|
||||
loadFDRS(data2, TEMP_T);
|
||||
sendFDRS();
|
||||
sleepFDRS(10); //Sleep time in seconds
|
||||
}
|
||||
|
||||
float readTemp() {
|
||||
return 21.0;
|
||||
}
|
||||
|
||||
float readHum() {
|
||||
return random(0,100);
|
||||
}
|
33
new examples/LoRa_Sensor/fdrs_sensor_config.h
Normal file
33
new examples/LoRa_Sensor/fdrs_sensor_config.h
Normal file
@ -0,0 +1,33 @@
|
||||
// FARM DATA RELAY SYSTEM
|
||||
//
|
||||
// Sensor Configuration
|
||||
|
||||
#include <fdrs_globals.h>
|
||||
|
||||
#define READING_ID 2 //Unique ID for this sensor
|
||||
#define GTWY_MAC 0x01 //Address of the nearest gateway
|
||||
|
||||
//#define USE_ESPNOW
|
||||
#define USE_LORA
|
||||
#define DEEP_SLEEP
|
||||
//#define POWER_CTRL 14
|
||||
#define FDRS_DEBUG
|
||||
|
||||
//SPI Configuration -- Needed only on chipsets with multiple SPI interfaces (ESP32)
|
||||
#define SPI_SCK 5
|
||||
#define SPI_MISO 19
|
||||
#define SPI_MOSI 27
|
||||
|
||||
//LoRa Configuration
|
||||
#define LORA_SS 18
|
||||
#define LORA_RST 14
|
||||
#define LORA_DIO0 26
|
||||
//433E6 for Asia
|
||||
//866E6 for Europe
|
||||
//915E6 for North America
|
||||
//#define LORA_BAND 915E6 // LoRa Frequency Band
|
||||
//#define LORA_SF 7 // LoRa Spreading Factor
|
||||
//#define LORA_TXPWR 17 // LoRa TX power in dBm (+2dBm - +20dBm), default is +17dBm
|
||||
//#define LORA_ACK // Request LoRa acknowledgment. Increases battery usage.
|
||||
//#define LORA_ACK_TIMEOUT 400 // LoRa ACK timeout in ms. (Minimum = 200)
|
||||
//#define LORA_RETRIES 2 // LoRa ACK retries [0 - 3]
|
Loading…
Reference in New Issue
Block a user