invio sms tramite ENC28J60

Salve, sto cercando di inviare una notifica tramite sms mediante un sms gateway (in particolare skebby).
Il codice l'ho preso da qui http://www.lucadentella.it/2012/12/16/enc28j60-e-arduino-12/ e l'ho modificato in maniera tale da mandare un testo standard e da utilizzare un ip statico nella mia rete.
Riesco a collegarmi correttamente alla rete e il dns risolve correttamente il gateway di skebby ma lo sketch va in stallo subito dopo aver inviato la richiesta. (per capirci dopo aver scritto nella seriale "Request sent to Skebby SMS Gateway").
Ho controllato nella API di skebby e la richiesta http rispetta tutti i canoni imposti dal sito. Qualcuno è già incappato nel mio stesso problema?
sotto lo sketch.

grazie in anticipo

#include <EtherCard.h>


static byte mymac[] = {0x74,0x69,0x69,0x2D,0x30,0x31};

static byte myip[] = { 10,0,0,200 };

static byte gwip[] = { 10,0,0,1 };

static byte dns[] = { 8,8,8,8 };

static byte sn[] = { 255,255,255,0 };

byte Ethernet::buffer[600];

byte session_id;
Stash stash;

int count;


const char website[] PROGMEM = "gateway.skebby.it";

char username[] = "userskebby";

char password[] = "pwskebby";

char sender_num[]   = "39XXXXXXXXXX";

char recipient[]   = "39XXXXXXXXXX";

char text_buffer[] = "testo";



void setup () {
 
  
	Serial.begin(57600);
  
	Serial.println("Skebby SMS Demo");
  
	Serial.println();
 
  
		if (!ether.begin(sizeof Ethernet::buffer, mymac, 8)) {
    
			Serial.println( "Failed to access Ethernet controller");
    
			while(1); 
  
	} else Serial.println("Ethernet controller initialized");
  
	Serial.println();
 
  
	ether.staticSetup(myip, dns, gwip, sn); 
 
  
	ether.printIp("IP Address:\t", ether.myip);
  
	ether.printIp("Netmask:\t", ether.netmask);
  
	ether.printIp("Gateway:\t", ether.gwip);
  
	ether.printIp("dns:\t", ether.dnsip);
  
  
	if (!ether.dnsLookup(website)) {
    
		Serial.println("DNS failed");    
    
		while(1); 
  
	} else ether.printIp("Skebby IP:\t", ether.hisip);

  
	Serial.println();
  
	Serial.println("INVIO SMS SKEBBY");
  
	Serial.println();
  
  
	count=0;

}
  

void loop() {

    
	if (count==0){ 
      
		send_sms_zerocent(recipient, text_buffer); 
      
		count++;
    
	}
    
    
	ether.packetLoop(ether.packetReceive());  
  
	const char* reply = ether.tcpReply(session_id);
  
  
	if(reply != 0) {
    
		if(strstr(reply, "status=failed") != 0) {
      
			Serial.println("Error sending SMS:");
      
			char* message_pos = strstr(reply, "&message=");
      
			Serial.println(message_pos + 9);
    
		} else Serial.println("SMS sent!");    
    
	Serial.println();
  
	}   


}




void send_sms_zerocent(char* recipient, char* text) {
  
  
	Serial.println("Preparing request for SMS 0Cent service");
  
  
	byte sd = stash.create();
  
	stash.print("method=send_sms&username=");
  
	stash.print(username);
  
	stash.print("&password=");
  
	stash.print(password);
  
	stash.print("&recipients[]=");
  
	stash.print(recipient);
  
	stash.print("&text=");
  
	stash.print(text);
  
	stash.print("&sender_number=");
  
	stash.print(sender_num);
  
	stash.save();
  
  
	Stash::prepare(PSTR("POST /api/send/smsskebby/advanced/http.php HTTP/1.0" "\r\n"
    "Host: $F" "\r\n"
    "Content-Type: application/x-www-form-urlencoded" "\r\n"      
    "Content-Length: $D" "\r\n" 
    "User-Agent: Arduino" "\r\n" "\r\n"
    "$H"), website, stash.size(), sd);
  
  
	session_id = ether.tcpSend();
  
	Serial.println("Request sent to Skebby SMS Gateway");

}

nessuno è in grado di aiutarmi?

Hai provato a chiedere a Dentella sul suo blog ? Molte volte risponde

Ciao, 7uk387
anche io sono alle prese con modifiche allo sketch di lucadentella per tentare di inviare sms un testo definito da mio ip statico ma senza risultati.
Hai avuto modo di risolvere il problema?
Se si, mi dai una mano ?

Ti ringrazio
Ciao

Ciao! si ci sono riuscito!
questo è un pezzo del mio sketch (spero di non aver cancellato troppo! ho fatot in velocità)
Sostituisci xxx con i dati del tuo account skebby e l'ip della tua rete.

#include <EtherCard.h>

static byte mymac[] = {0x74,0x69,0x69,0x2D,0x30,0x31};
static byte myip[] = { 10,0,0,200 };
static byte gwip[] = { 10,0,0,1 };
static byte dns[] = { 8,8,8,8 };
static byte sn[] = { 255,255,255,0 };
byte Ethernet::buffer[600];
byte session_id;
Stash stash;

const char website[] PROGMEM = "gateway.skebby.it";
char username[] = "xxx";
char password[] = "xxx";
char sender_num[]   = "39xxx";
char recipient[]   = "39xxx";
char text_buffer[] = "testo!!!";
int count=0;

void setup () {
 
  Serial.begin(57600);
  Serial.println("Skebby SMS Demo");
  Serial.println();
  if (!ether.begin(sizeof Ethernet::buffer, mymac, 8)) {
    Serial.println( "Failed to access Ethernet controller");
  } else Serial.println("Ethernet controller initialized");
  Serial.println();
 
  ether.staticSetup(myip, gwip, dns, sn); 
 
  ether.printIp("IP Address:\t", ether.myip);
  ether.printIp("Netmask:\t", ether.netmask);
  ether.printIp("Gateway:\t", ether.gwip);
  ether.printIp("dns:\t", ether.dnsip);
  
  if (!ether.dnsLookup(website)) {
    Serial.println("DNS failed");    
  } else ether.printIp("Skebby IP:\t", ether.hisip);

  Serial.println();
  Serial.println("INVIO SMS SKEBBY");
  Serial.println();
}
  
void loop() {
 if(count==0){
    send_sms_zerocent(recipient, text_buffer);
    count++;
 }
    ether.packetLoop(ether.packetReceive());  
    const char* reply = ether.tcpReply(session_id);
    if(reply != 0) {
        if(strstr(reply, "status=failed") != 0) {
          Serial.println("Error sending SMS:");
          char* message_pos = strstr(reply, "&message=");
          Serial.println(message_pos + 9);
        } else Serial.println("SMS sent!");    
        Serial.println();
        delay(1000);
    }
     
}


void send_sms_zerocent(char* recipient, char* text) {
  
  Serial.println("Preparing request for SMS 0Cent service");
  
  byte sd = stash.create();
  stash.print("method=send_sms&username=");
  Serial.print("method=send_sms&username=");
  stash.print(username);
  Serial.print(username);
  stash.print("&password=");
  Serial.print("&password=");
  stash.print(password);
  Serial.print(password);
  stash.print("&recipients[]=");
  Serial.print("&recipients[]=");
  stash.print(recipient);
  Serial.print(recipient);
  stash.print("&text=");
  Serial.print("&text=");
  stash.print(text);
  Serial.print(text);
  stash.print("&sender_number=");
  Serial.print("&sender_number=");
  stash.print(sender_num);
  Serial.print(sender_num);
  Serial.println();
  stash.save();
  
  Stash::prepare(PSTR("POST /api/send/smsskebby/advanced/http.php? HTTP/1.1" "\r\n"
    "Host: $F" "\r\n"
    "Content-Type: application/x-www-form-urlencoded" "\r\n"      
    "Content-Length: $D" "\r\n" 
    "User-Agent: Arduino" "\r\n" "\r\n"
    "$H"), website, stash.size(), sd);
  
  session_id = ether.tcpSend();
  Serial.println("Request sent to Skebby SMS Gateway");
}

controlla inoltre se utilizzi un telefono android che sia attivata l'app google partner (altrimneit non ricevi in realtime i mesasggi)

spero di esserti stato d'aiuto!

Ciao

Ciao,
Ti ringrazio per la tempestività della risposta.
Mi dispiace solo non potermi divertire subito ( sarò con il 'mio' Arduino solo tra 15 giorni).
Ti farò sapere se ci sono riuscito.
Ciao e grazie.

Ciao 7uk387,

finalmente sono tornato a casa e posso continuare a divertirmi con Arduino.
Ho provato a caricare il tuo sketch ma su una ethernet shield (è questo il motivo che mi da problemi ?)

ho cambiato :
static byte mymac[] =
static byte myip[] =
static byte gwip[] =
static byte dns[] =
static byte sn[] =

...

char username[] =
char password[] =
char sender_num[]
char recipient[] =
char text_buffer[] =

e

Serial.begin(9600); [invece di 57600]

in fase di compilazione mi segnala
Poca memoria disponibile, potrebbero presentarsi problemi di stabilità.
e in fase si esecuzione
dopo il msg

Skebby SMS Demo

si ferma e non fa altro

mi puoi dare qualche "dritta" ?

Ciao e grazie

(nel caso sia indispensabile la sk ENC28J60, come si collega all'arduino ? )

Buona serata
Nando

Ciao,
a me è capitato tempo fa di usare i servizi sms di messagenet / voipcheap etc., basati su semplici GET

Qui le istruzioni:

basta di fatto costruire una url del tipo:

https://www.voipcheap.com/myaccount/sendsms.php?username=xxxxxxxxxx&password=xxxxxxxxxx&from=xxxxxxxxxx&to=xxxxxxxxxx&text=xxxxxxxxxx

Ciao Pitusso.

ho bisogno, per cortesia, di un tuo aiuto.
Dove sbaglio ?

Ho un account con messagenet.

Ho inserito, per prova, nella barra degli indirizzi il comando (preso dal sito di messagenet
https://messagenet.zendesk.com/entries/87889518?locale=1&locale=22 ):

https://api.messagenet.com/POST /api/send_sms HTTP/1.1auth_userid=”XXXXXX”&auth_password=”XXXXXX”&destination="XXXXXXX"&text="XXXXX"[&sender= "XXXXXXX"&report=0|1][&format=json|plist|xml]

(sostituendo le XXX con i valori reali) ma continua a darmi l'errore

{"error":403,"description":"Invalid username or password"}

Per favore, mi dai qualche "dritta" ?

Ciao e grazie

(con voipcheap gli SMS sono gratuiti se inviato ad altri utenti voipcheap ?). Ciao

fecapo:
https://api.messagenet.com/POST /api/send_sms HTTP/1.1auth_userid=”XXXXXX”&auth_password=”XXXXXX”&destination="XXXXXXX"&text="XXXXX"[&sender= "XXXXXXX"&report=0|1][&format=json|plist|xml]

(sostituendo le XXX con i valori reali) ma continua a darmi l'errore

{"error":403,"description":"Invalid username or password"}

L'errore dice che o il nome utente o la password sono errate.
Domanda: ma hai lasciato le parentesi quadre? Di solito indicano che i parametri compresi fra le parentesi sono opzionali, ma se li metti devi eliminare le parentesi quadre. potrebbe essere che in presenza di parentesi quadre il parser si imbroglia e ti restituisce il codice errore sbagliato.

Ciao,
ho eliminatole parentesi quadre (e il contenuto) ma continua a segnalarmi lo stesso errore.
il problema potrebbe essere che messagenet utilizza il metodo POST e non il GET ?

Ho verificato comunque che gli sms di messagenet costano circa 10€c.
Invece gli SMS di Skebby sono gratis se si inviano ad altri utenti Skebby e ho deciso di "sperimentare" questa strada (basta creare due utenti uno "arduino" e uno "mio" e il gioco è fatto.

il problema che la sketch di 7uk387 (riportato sopra) è molto pesante (utilizzo arduino uno): in fase di compilazione mi segnala
"Poca memoria disponibile, potrebbero presentarsi problemi di stabilità."
e in fase si esecuzione si ferma...

Mi rivolgo sia a 7uk387 che a Pitusso:

secondo voi è possibile ridurre lo sketch (drasticamente) per poter dare spazio ad altra memoria necessaria al progetto ?

Vi ringrazio.

Ciao

Prova a sostituire tutti i
Serial.println("lamiastringa");
con
Serial.println(F("lamiastringa"));

La F evita la copia della stringa in RAM, viene lasciata sulla flash.
Vale anche per Serial.print. Non so invece se funziona anche con ether.printIp.

Ciao! scusa se ti rispondo solo ora nel frattempo spero che tu abbia risolto lo stesso.
lo sketch nonostante le dimensioni funziona egregiamente in quanto rimane libera circa il 30% della memoria.
non è necessario creare 2 utenti skebby puoi utilizzare lo stesso utente per arduino e per lo smartphone in cui desideri ricevere la notifica.
come prima cosa ti consiglio di provare l'url della richiesta al gateway skebby direttamente nel browser seguendo le specifiche riportate qui: Skebby API Reference avendo cura di mandare la richiesta con metodo post (in firefox devi andare in developer-network-edit e resend e scrivere al posto di get post).

una volta appurata la correttezza devi generare una richiesta analoga con lo sketch e per far ciò devi modificare opportunamente il codice che ti ho postato sopra con i parametri del tuo utente.

Ciao e buona serata