how to use wio GPS traker to send data from DHT by SMS to a phone.

hi, I am using a wio GPS traker and want to send data a get from the DHT sensor as a SMS to a phone , i can send a text message as it shown in the wio traker tutorial using the exemple file “sendSMS” but i don’t know how to send data.

need your help, if someone already did it befor.

Hi ,



Yes , you can also send the data via sms , insated of giving text message you gave the data vraible of DHT sensor .

can you share the code that you are using to send sms , i’ll help you to add the DHT varible to send the data DHT data .

so thanks , here is the code i am using , i just add the dht sensor code to the code SMSSens for wio GPS Traker. [code]

#include “MC20_Common.h”
#include “MC20_Arduino_Interface.h”

#include “DHT.h”

#define DHTPIN 2 // what pin we’re connected to

// Uncomment whatever type you’re using!
#define DHTTYPE DHT11 // DHT 11
//#define DHTTYPE DHT22
//#define RGBPIN 10

DHT dht(DHTPIN, DHTTYPE);
const char message[128] = “Hello MC20!”;

GPSTracker gpsTracker = GPSTracker();

void setup() {

SERIAL.begin(115200); 
SERIAL.println("DHTxx test!");
Wire.begin();

/*if using WIO link,must pull up the power pin.*/
// pinMode(PIN_GROVE_POWER, OUTPUT);
// digitalWrite(PIN_GROVE_POWER, 1);

dht.begin();

pinMode(RGBPIN, OUTPUT);
digitalWrite(RGBPIN, LOW);
SerialUSB.begin(115200);
while(!SerialUSB);

gpsTracker.Power_On();
SerialUSB.println(“Power On!”);

if(!gpsTracker.waitForNetworkRegister())
{
SerialUSB.println(“Network error!”);
return;
}

gpsTracker.sendSMS(“xxxxxxxxxxx”, “Hello MC20!”); // Change ****** to your test phone number

}

void loop() {

float temp_hum_val[2] = {0};
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds ‘old’ (its a very slow sensor)

if(!dht.readTempAndHumidity(temp_hum_val)){
    SERIAL.print("Humidity: "); 
    SERIAL.print(temp_hum_val[0]);
    SERIAL.print(" %\t");
    SERIAL.print("Temperature: "); 
    SERIAL.print(temp_hum_val[1]);
    SERIAL.println(" *C");
}
else{
   SERIAL.println("Failed to get temprature and humidity value.");
}

delay(1500);
/* Debug */
if(SerialUSB.available()){
serialMC20.write(SerialUSB.read());
}
if(serialMC20.available()){
SerialUSB.write(serialMC20.read());
}
gpsTracker.sendSMS(“xxxxxxxxxxx”,temp_hum_val[1] ); // Change ****** to your test phone number

}[/code]

here is just the code to send SMS
[code]
#include “MC20_Common.h”
#include “MC20_Arduino_Interface.h”

#define RGBPIN 10

const char message[128] = “Hello MC20!”;

GPSTracker gpsTracker = GPSTracker();

void setup() {
pinMode(RGBPIN, OUTPUT);
digitalWrite(RGBPIN, LOW);
SerialUSB.begin(115200);
while(!SerialUSB);

gpsTracker.Power_On();
SerialUSB.println(“Power On!”);

if(!gpsTracker.waitForNetworkRegister())
{
SerialUSB.println(“Network error!”);
return;
}

gpsTracker.sendSMS(“xxxxxxxxxxx”, “Hello MC20!”); // Change ****** to your test phone number

}

void loop() {
/* Debug */
if(SerialUSB.available()){
serialMC20.write(SerialUSB.read());
}
if(serialMC20.available()){
SerialUSB.write(serialMC20.read());
}

}[/code]