SIM 900 epalsite v1.1

15328885305_cd8569eb8b_o sim900

Test sur une carte arduino UNO avec la librairie GSM.h

Les cavaliers sont positionnés pour GRX =3 et GTX = 2 afin d’utiliser la librairie software serial ATTENTION les indications sur la carte sont croisées ! GTX=RX 2 Arduino et GRX=TX 3 Arduino

cavaliers

L’alimentation est fournie via les broches VIN et GND

gndvin

15142300968_af133f9ef8_o15142340977_bc9086d4df_o

Pour que la carte GSM fonctionne avec toutes les cartes ARDUINO, il faut utiliser les broches (PIN) suivantes :

Pour l’Arduino UNO :

TXPIN : 3 RXPIN : 2 RXINT : 3
Pour Arduino MEGA :
TXPIN : 3
RXPIN : 10 <=> donc positionner le cavalier de la carte GTX de la carte GSM sur la sortie 10
RXINT : 4  <=> PIN à ne pas utiliser !

Pour Arduino LEONARDO :
TXPIN : 3
RXPIN : 8
RXINT : 3

A tester : PIN 7 pour démarrage automatique ? Afin d’éviter d’appuyer sur le bouton power pour démarrer la carte

http://www.ebay.com/itm/SIM900-Quad-band-GSM-GPRS-Shield-for-Arduino-UNO-MEGA-Leonardo-/321418410538?ssPageName=ADME:L:OU:FR:3160

http://wiki.epalsite.com/index.php?title=SIM900_Quad-Band_GPRS_shield_with_Micro_SD_card_slot#Purchasing_this_module

 

LEDs(color) Status Description
PWR(Red) ON Power of the GPRS Shield is on
OFF Power of the GPRS Shield is off
Netlight(Green) 64ms On/800ms Off SIM900 has not registered to a network
64ms On/3000ms Off SIM900 has registered to a network
64ms On/300ms Off GPRS communication
OFF SIM900 is not running

 

 /*  
  SMS sender  
  Adapt from :   
  http://arduino.cc/en/Tutorial/GSMExamplesSendSMS  
  For epalsite v1.1 shield  
  */  
 //-- GSM library  
 #include <GSM.h>  
 //-- SIM PinNumber  
 #define PINNUMBER ""  
 //-- For starting Shield  
 int pwrkey = 7;  
 //-- initialize the library instance  
 GSM gsmAccess;  
 GSM_SMS sms;  
 //--  
 void setup()  
 {  
  //-- initialize serial communications and wait for port to open:  
  Serial.begin(9600);  
  Serial.println("SMS Messages Sender v1.2");  
  //-- Switch On the Shield  
  digitalWrite(pwrkey, HIGH);    
  delay(2000);          
  digitalWrite(pwrkey, LOW);   
  delay(2000);          
  digitalWrite(pwrkey, HIGH);    
  delay(3000);          
  //-- connection state  
  boolean notConnected = true;  
  //-- Start GSM shield  
  while(notConnected)  
  {  
   if(gsmAccess.begin(PINNUMBER)==GSM_READY)  
    notConnected = false;  
   else  
   {  
    Serial.println("Not connected");  
    delay(1000);  
   }  
  }  
  Serial.println("GSM Ready !");  
 }  
 void loop()  
 {  
  Serial.print("Enter a mobile number: ");  
  char remoteNum[20]; // telephone number to send sms  
  readSerial(remoteNum);  
  Serial.println(remoteNum);  
  // sms text  
  Serial.print("Now, enter SMS content: ");  
  char txtMsg[200];  
  readSerial(txtMsg);  
  Serial.println("SENDING");  
  Serial.println();  
  Serial.println("Message:");  
  Serial.println(txtMsg);  
  // send the message  
  sms.beginSMS(remoteNum);  
  sms.print(txtMsg);  
  sms.endSMS();   
  Serial.println("\nCOMPLETE!\n");  
 }  
 /*  
  Read input serial  
  */  
 int readSerial(char result[])  
 {  
  int i = 0;  
  while(1)  
  {  
   while (Serial.available() > 0)  
   {  
    char inChar = Serial.read();  
    if (inChar == '\n')  
    {  
     result[i] = '';  
     Serial.flush();  
     return 0;  
    }  
    if(inChar!='\r')  
    {  
     result[i] = inChar;  
     i++;  
    }  
   }  
  }  
 }  

Laisser un commentaire

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur la façon dont les données de vos commentaires sont traitées.

Articles récents
Commentaires récents
fatima dans Bienvenue !
AdminDroid dans Bienvenue !
fatima dans Bienvenue !
Archives
Catégories