Les dernières nouvelles ...
Accueil / Divers / Arduino texting from the countryside

Arduino texting from the countryside

One of my friends would like to get text messages with external/internal temperature from his countryside house.

Why text messages? Because there is no wireless network nor internet connection in that location.

In this country, a plan for unlimited text messages costs ~ 2US$ per month, so SMS is a good option.

So, the story started with an Arduino, a GSM cellular module and its shield and few temperature/humidity sensors:

IMG_2399

The Arduino will be powered with a 5V solar panel and battery.

Here is the schematic (the GSM module uses digital pin 2 and 3 but is not on the drawing for clarity).

Screenshot-1And the code:

 #include 
 #include 
 #include 
 
 #define DHT1PIN 4 // pin 4 and 5 for sensors
 #define DHT2PIN 5
 #define DHT1TYPE DHT11 // DHT 11 
 #define DHT2TYPE DHT22 // DHT 22 
 
 DHT dht1(DHT1PIN, DHT1TYPE); 
 DHT dht2(DHT2PIN, DHT2TYPE);
 SerialGSM cell(2,3);
  
 void setup()
 {
   delay(30000); // GSM cellular initialization time
   cell.begin(9600);
   dht1.begin(); 
   dht2.begin();
 }
  
 void sendSMS()
 {
   cell.Verbose(true); // for debug
   cell.Boot();
   cell.FwdSMS2Serial();
   cell.Rcpt("+1123456789"); // your cell phone number in international format
   float t1 = dht1.readTemperature(); 
   float t2 = dht2.readTemperature(); 
   char message[30];
   sprintf(message,"%.2f",t1 ,"C Inside %.2f", t2, "C Outside");
   cell.Message(message);
   cell.SendSMS();
 }
 void loop()
 {
   sendSMS();
   do // text every 12 hours
   {
     delay(43200000);
   }
   while (1!=0);
 }

Arduino texting from the countryside

La suite est à lire sur le site de : F5IYJ
Arduino texting from the countryside

%d blogueurs aiment cette page :