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

Simplify IoT Development.

Moderators: lily.li, violet, seth.welday

Post Reply
talhatazourkarneinitoure
Pre-kindergarten
Pre-kindergarten
Posts: 4
Joined: Wed Jul 10, 2019 5:47 am

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

Post by talhatazourkarneinitoure » Tue Oct 15, 2019 8:45 pm

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.

User avatar
salmanfarisvp
Kindergarten
Kindergarten
Posts: 62
Joined: Sun May 20, 2018 2:02 am
Are you a staff member of seeedstudio?: no
Which products/projects are your favorite?: Linklt One , BeagleBone Green , ReSpaker
Contact:

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

Post by salmanfarisvp » Sat Oct 19, 2019 1:15 pm

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 .
Thank You :) .

talhatazourkarneinitoure
Pre-kindergarten
Pre-kindergarten
Posts: 4
Joined: Wed Jul 10, 2019 5:47 am

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

Post by talhatazourkarneinitoure » Wed Oct 30, 2019 11:24 pm

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: Select all


#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

}

talhatazourkarneinitoure
Pre-kindergarten
Pre-kindergarten
Posts: 4
Joined: Wed Jul 10, 2019 5:47 am

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

Post by talhatazourkarneinitoure » Wed Oct 30, 2019 11:32 pm

here is just the code to send SMS

Code: Select all

#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());
  }

}

Post Reply