Sending Sensors readings with SIM900 - SMS

Hello everyone,

I’m having a problem in my arduino project using the Shield SIM900 to send sensors readings values to my Android app through a sms message.

The sensors i’m using is the DS18B20 and the soil moisture sensor.

The program i got right now:

#include <DallasTemperature.h>
#include <OneWire.h>
#include “SIM900.h”
#include <SoftwareSerial.h>
#include “sms.h”
SMSGSM sms;

#define ONE_WIRE_BUS 4

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);
DeviceAddress sensor1;

int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];

void setup(void)
{

Serial.begin(9600);
Serial.println(“Controle de Temperatura e Umidade”);

if (gsm.begin(2400))
{
Serial.println(“SMS READY”);
started=true;
}
else
{
Serial.println(“IDLE”);
}
}
void loop(void)
{

int HumidityValue=analogRead(0);
HumidityValue = map(HumidityValue, 0, 1023, 0, 100);
Serial.print(“Humidity:”);
Serial.print(HumidityValue)
delay(560);

Serial.print("\nTemperature Value - ");
sensors.requestTemperatures();
Serial.println(“Complete”);

Serial.print(“Temperature:”);
Serial.print(sensors.getTempCByIndex(0));
Serial.print(" graus");
Serial.print("\n");
delay(560);

if (HumidityValue>70)
{
digitalWrite(8, HIGH);
delay(114);
}

else if (HumidityValue<30)
{
digitalWrite(8, LOW);
delay(114);
}

if(started)
{
if (sms.SendSMS(“number”, HumidityValue))
sms.SendSMS(“number”, sensors.getTempCByIndex(0));
Serial.println(“Readings SENT”);
}

}

hope u guys can help me with that,

Thank you

I'm having a problem in my arduino project using the Shield SIM900 to send sensors readings values to my Android app through a sms message.

What IS the problem?

hope u guys can help me with that,

Without knowing what the problem is? That seems unlikely.

Sorry about that,

the problem that i'm having its: When the SIM900 sends the message to the app with the humidity value, the message come with no information (blank information).

the second problem i'm having is in this part:

sms.SendSMS("number", sensors.getTempCByIndex(0));

Arduino message error:

no matching function for call to 'SMSGSM::SendSMS(const char [10], float)'

Most times, text messages contain, strangely enough, text.

YOU must convert the int and float values to strings, and send the strings in the text messages.

itoa() and dtostrf() seem like useful functions.

I figure it out what i need to do, thanks for that,

Just trying to learn how to do that in my project :sweat_smile:

I tried like this :

if(started)
{
char resulthumidity [6];
char resulttemperature [10];
itoa (HumidityValue,resulthumidity,10);
dtostrf (sensors.getTempCByIndex(0),5,2,resulttemperature);
if (sms.SendSMS("99999999", resulthumidity))
sms.SendSMS('"99999999", resulttemperature);
Serial.println("SMS SENT");
delay(1000);
}

It's had done compiling, but i still open for some opinions and changes.

Thats for the help btw :slight_smile:

        if (sms.SendSMS("99999999", resulthumidity))                                   
        sms.SendSMS('"99999999", resulttemperature);

You could now look at strcpy() and strcat() and send one text message containing both values AND some identifying information.