• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Arduino UNO + neoway M590
#1
Witam, od niedawna jestem użytkownikiem arduino, na początek postanowiłem pobawić się z modułem GSM neoway M590, udało mi się podłączyć (nie wiem czy dobrze) - dioda mruga po podłączeniu do zasilania.

Posiadam dokładnie taki moduł: 

[Obrazek: 4591_b.jpg]


i tak: 

I - PUste
T - Tu mam podpięte TX z arduino
R - RX z arduino
U - 3.3v z arduino
K - PUSTE
G - MASA

No i wiadomo z drugiej strony masa i 5v.


i teraz jak podłącze arduino pod usb - nic się nie dzieje, natomiast jak połączę na chwilę G z K to moduł tak jakby "startuje" i zaczynają mrugac 2 diody. 

Pierwsze pytanie brzmi - czy dobrze to podłączyłem?


Drugie pytanie brzmi - jeżeli dobrze to podłączyłem to dlaczego jak załaduję ten kod:


Kod:
// Include the GSM library
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

void setup() {
 // initialize serial communications and wait for port to open:
 Serial.begin(9600);
 while (!Serial) {
   ; // wait for serial port to connect. Needed for native USB port only
 }

 Serial.println("SMS Messages Sender");

 // connection state
 boolean notConnected = true;

 // Start GSM shield
 // If your SIM has PIN, pass it as a parameter of begin() in quotes
 while (notConnected) {
   
   
   
   if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
     notConnected = false;
     Serial.println("xxx");  
   } else {
     Serial.println("Not connected");
     delay(1000);
   }
 }

 Serial.println("GSM initialized");
}

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] = '\0';
       Serial.flush();
       return 0;
     }
     if (inChar != '\r') {
       result[i] = inChar;
       i++;
     }
   }
 }
}

Na monitorze portu szeregowego wyświetla mi się tylko: SMS Messages Sender i nic dalej nie idzie?


Jestem początkujący więc proszę o wyrozumiałość, dzięki z góry!
 
Odpowiedź
#2
Czy aby nie powinieneś do T modułu podłączyć RX, a do R modułu podłączyć TX Arduino?
Chyba tak działa poprawnie komunikacja (na krzyż) Smile

pozdr.
Jeżeli pomogłem, to poproszę o punkt reputacji Big Grin
 
Odpowiedź
#3
No ok, zmieniłem i nadal bez zmian, w monitorze wyświetla mi ten komuikat, co opisałem powyżej.
 
Odpowiedź
#4
Ostatnio również się bawię z GSM'em ale na module SIM900A.

Działający przykład do odbioru SMS'a wygląda u mnie tak:

Kod:
// GSM READ

#include <SoftwareSerial.h>
SoftwareSerial gsm(2, 3);
String atCommand;

void setup()  
{
 Serial.begin(9600);
 gsm.begin(9600);
}

void loop()
{
 //READ
 if (gsm.available())
 {
   Serial.write(gsm.read());
 }

 while (Serial.available())
 {
   delay(10);
   if (Serial.available() > 0)
   {
     char c = Serial.read();
     atCommand += c;
   }
 }
}

Porównując z Twoim kodem instrukcja if (gsm.available()) jest u mnie w pętli LOOP a nie w SETUP.

pozdr.
Jeżeli pomogłem, to poproszę o punkt reputacji Big Grin
 
Odpowiedź
#5
Włożyłem kartę sim od orange, próbuję wysłać sms na tym kodzie:

Kod:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
int ch = 0;
int led = 13;
String val = "";

void setup() {
  pinMode(led, OUTPUT);
  digitalWrite(led, LOW);
  Serial.begin(9600);
  Serial.println("GSM tester v1.0");
  mySerial.begin(9600);
  mySerial.println("AT+CLIP=1");
  delay(100);
  mySerial.println("AT+CMGF=1");  
  delay(100);
  mySerial.println("AT+CSCS=\"GSM\"");
  delay(100);
}

void loop() {
  if (mySerial.available()) {  
    while (mySerial.available()) {
      ch = mySerial.read();
      val += char(ch);
      delay(10);
    }
    if (val.indexOf("RING") > -1) {  
      if (val.indexOf("555555555") > -1) {
        Serial.println("--- MASTER RING DETECTED ---");
        mySerial.println("ATH0");
        digitalWrite(led, HIGH);
        delay(3000);
        digitalWrite(led, LOW);
      }
    } else
      Serial.println(val);  
    val = "";
  }
  if (Serial.available()) {  
    while (Serial.available()) {
      ch = Serial.read();
      val += char(ch);
      delay(10);
    }
    //mySerial.println(val);
    if (val.indexOf("sendsms") > -1) {
      sms(String("hello world"), String("+555555555"));
    }
    val = "";
  }
}

void sms(String text, String phone)
{
  Serial.println("SMS send started");
  mySerial.println("AT+CMGS=\"" + phone + "\"");
  delay(500);
  mySerial.print(text);
  delay(500);
  mySerial.print((char)26);
  delay(500);
  Serial.println("SMS send complete");
  delay(2000);
}

i wyswietla tylko: GSM tester v1.0

diody mrugaja +/- co 1 sek

co moze byc jeszcze nie tak?
 
Odpowiedź
#6
Dodam jeszcze,  że czasami diody się tak jakby "Przymrużają"
 
Odpowiedź
  


Skocz do:


Przeglądający: 1 gości