Hello
I'm a beginner in programming and I'd like to know if someone could help me solve my problem.
I am working on a QA (Air Quality) probe that must work in 3G/4G. Unfortunately I am stuck on the configuration of my modem.
My equipment:
-Lilygo T-Call A7670E
-ATH20+BMP280
-NO2 Sensor UART
So here is a presentation of the beginning of my script:
<
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <Adafruit_AHTX0.h>
#include <TinyGPSPlus.h>
#include <TinyGsmClient.h>
// Define modem model
#define TINY_GSM_MODEM_A7670
// Declaration of Sensor Objects
Adafruit_BMP280 bmp;
Adafruit_AHTX0 aht;
TinyGPSPlus gps;
// Variable of ajustement
float temperatureOffsetBMP = -6.1;
float pressureOffset = -1.0;
float temperatureOffsetAHT = -4.6;
float humidityOffset = 2.70;
// NO2 sensor configuration
#define NO2_TX 15
#define NO2_RX 14
HardwareSerial SerialNO2(2);
// GPS and 3G/4G module configuration
#define MODEM_RST 5
#define MODEM_PWRKEY 4
#define MODEM_POWER_ON 23
#define MODEM_TX 27
#define MODEM_RX 26
#define GPS_TX 12
#define GPS_RX 13
#define SerialMon Serial
#define SerialAT Serial1
TinyGsm modem(SerialAT);
void setup() {
SerialMon.begin(115200);
delay(10);
// Sensors initialization
Wire.begin();
if (!bmp.begin(0x77)) {
SerialMon.println("Impossible de trouver le capteur BMP280");
while (1);
}
if (!aht.begin()) {
SerialMon.println("Impossible de trouver le capteur AHT20");
while (1);
}
// NO2 sensor initialization
SerialNO2.begin(9600, SERIAL_8N1, NO2_RX, NO2_TX);
// Initialisation du module GPS et 3G/4G
pinMode(MODEM_PWRKEY, OUTPUT);
pinMode(MODEM_POWER_ON, OUTPUT);
digitalWrite(MODEM_PWRKEY, LOW);
digitalWrite(MODEM_POWER_ON, HIGH);
SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);
delay(3000);
SerialMon.println("Modem initialization...");
modem.restart();
SerialMon.print("Network Connection...");
modem.gprsConnect("your_apn", "", "");
SerialMon.println("Connected !");
}
void loop() {
// BMP280 read data
float temperatureBMP = bmp.readTemperature() + temperatureOffsetBMP;
float pressure = (bmp.readPressure() / 100.0F) + pressureOffset;
float altitude = bmp.readAltitude(1017.00);
// AHT20 read data
sensors_event_t humidity, temp;
aht.getEvent(&humidity, &temp);
float temperatureAHT = temp.temperature + temperatureOffsetAHT;
float humidityAdjusted = humidity.relative_humidity + humidityOffset;
// NO2 sensor read data
String no2Data = "";
while (SerialNO2.available() > 0) {
char c = SerialNO2.read();
no2Data += c;
}
float no2Concentration = no2Data.toFloat();
// GPS read data
while (SerialAT.available() > 0) {
gps.encode(SerialAT.read());
}
// Valid GPS data verification
if (gps.location.isValid()) {
SerialMon.print("Latitude: ");
SerialMon.println(gps.location.lat(), 6);
SerialMon.print("Longitude: ");
SerialMon.println(gps.location.lng(), 6);
SerialMon.print("Altitude GPS: ");
SerialMon.println(gps.altitude.meters());
SerialMon.print("Nombre de satellites: ");
SerialMon.println(gps.satellites.value());
SerialMon.print("Précision HDOP: ");
SerialMon.println(gps.hdop.value());
} else {
SerialMon.println("Données GPS non valides");
}
// Affichage des données sur le moniteur série
SerialMon.print("Température: ");
SerialMon.print(temperatureBMP);
SerialMon.println(" °C");
SerialMon.print("Humidité: ");
SerialMon.print(humidityAdjusted);
SerialMon.println(" %");
SerialMon.print("Pression: ");
SerialMon.print(pressure);
SerialMon.println(" hPa");
SerialMon.print("Altitude: ");
SerialMon.print(altitude);
SerialMon.println(" m");
SerialMon.print("Concentration NO2: ");
SerialMon.print(no2Concentration);
SerialMon.println(" ppm");
SerialMon.print("Température interne: ");
SerialMon.print(temperatureAHT);
SerialMon.println(" °C");
delay(60000); // Attendre 60 secondes avant la prochaine lecture
}
At each check I receive this as an answer:
<
In file included from C:\Users\tn\Documents\Arduino\sketch_oct28a\sketch_oct28a.ino:6:
C:\Users\tn\Documents\Arduino\libraries\TinyGSM\src/TinyGsmClient.h:137:2: error: #error "Please define GSM modem model"
137 | #error "Please define GSM modem model"
| ^~~~~
exit status 1
Compilation error: exit status 1
I have been looking for several solutions in vain and now I don't know which path to take.
Can you please give me your help and experience?