Salve a tutti
dopo molti tentativi e vari assetti non sono riuscito a far comunicare il modulo GSM SIM800L EVB con la Mega. Ho letto un post in italiano specifico su questo problema seguendo attentamente le indicazioni ma niente.
Ho provato numerosi esempi ma non funzionano. Vi posto il primo:
void setup() {
//Begin serial comunication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
Serial1.begin(9600);
delay(1000);
Serial.println("Starting...");
}
void loop() {
//Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
if(Serial1.available()){
Serial.write(Serial1.read());
}
//Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
if(Serial.available()){
Serial1.write(Serial.read());
}
}
Ho collegato il 5V ad arduino ed anche GND.
Ho collegato l'RX del modulo al pin 18 TX, il TX del modulo al pin 19 RX
Non accade nulla quando digito un comando AT.
Stessa cosa con softserial:
#include <SoftwareSerial.h>
//SIM800 TX is connected to Arduino D8
#define SIM800_TX_PIN 8
//SIM800 RX is connected to Arduino D7
#define SIM800_RX_PIN 7
//Create software serial object to communicate with SIM800
SoftwareSerial serialSIM800(SIM800_TX_PIN,SIM800_RX_PIN);
void setup() {
//Begin serial comunication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);
while(!Serial);
//Being serial communication witj Arduino and SIM800
serialSIM800.begin(9600);
delay(1000);
Serial.println("Setup Complete!");
}
void loop() {
//Read SIM800 output (if available) and print it in Arduino IDE Serial Monitor
if(serialSIM800.available()){
Serial.write(serialSIM800.read());
}
//Read Arduino IDE Serial Monitor inputs (if available) and send them to SIM800
if(Serial.available()){
serialSIM800.write(Serial.read());
}
}
In questo caso il TX del modulo l'ho collegato come richiesto al PIN 8 e RX al 7.
anche in questo caso nulla. Ho provato altri esempi che inviano SMS presi da questo link
ed alimentato tutto dall'esterno con alimentatore 5V (positivo sul pin 5V di arduino) ma nulla. Il modulo se chiamato con un cellulare risponde (squilla....).
Poi ho provato questo:
#include "SIM900.h"
#include <SoftwareSerial.h>
//If not used, is better to exclude the HTTP library,
//for RAM saving.
//If your sketch reboots itself proprably you have finished,
//your memory available.
//#include "inetGSM.h"
//If you want to use the Arduino functions to manage SMS, uncomment the lines below.
#include "sms.h"
SMSGSM sms;
//To change pins for Software Serial, use the two lines in GSM.cpp.
//GSM Shield for Arduino
//www.open-electronics.org
//this code is based on the example of Arduino Labs.
//Simple sketch to send and receive SMS.
int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];
void setup()
{
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");
//Start configuration of shield with baudrate.
//For http uses is raccomanded to use 4800 or slower.
if (gsm.begin(2400)) {
Serial.println("\nstatus=READY");
started=true;
} else Serial.println("\nstatus=IDLE");
if(started) {
//Enable this two lines if you want to send an SMS.
if (sms.SendSMS("349XXX15X4", "Arduino SMS"))
Serial.println("\nSMS sent OK");
}
};
void loop()
{
if(started) {
//Read if there are messages on SIM card and print them.
/** deprecated method
if(gsm.readSMS(smsbuffer, 160, n, 20)) {
Serial.println(n);
Serial.println(smsbuffer);
}
**/
//get 1st sms
sms.GetSMS(1,n,20,smsbuffer,160);
Serial.println(n);
Serial.println(smsbuffer);
delay(1000);
}
};
con i pin 18, 19 ed alimentato da esterno come prima.... e niente
Io francamente con le mie conoscenze mi fermo... non riesco ad andare oltre. Dove sbaglio? Oppure il modulo ha un problema.....
RISOLTO: Il modulo era rotto, non funzionava. Il nuovo funziona con tutti gli sketch!