STAMP CATM does not respond (Solved, HTML Get and Send Email)
-
Hi,
I have my STAMP CATM connected to my M5StickC : GND to GND , +5 Out to 5V, G36 to RX and G26 to TX.
Then :
Serial2.begin(115200, SERIAL_8N1, RXD2, TXD2);
delay(300);
Serial2.println("ATI\r\n");
Read_Response(5000); // Serial2 read into Receive_buffer
Serial.println(Receive_buffer);But when reading out the Serial2 I get no response at all.
Any idea?
Thanks -
have you got a sim in it?
-
Thank you for your reply
SIM card is placed according to picture.
In the mean time I have tried different scenarios with :
//Serial1.begin(115200, SERIAL_8N1, RXD2, TXD2);
Serial1.begin(115200, SERIAL_8N1, 26, 0);
//Serial1.begin(115200, SERIAL_8N1, 0, 26);This is based on the following link in which also problems with Serial are mentioned : https://community.m5stack.com/topic/1521/serial2-on-m5stickc/5
This link appears to provide working serial to serial communication: https://gist.github.com/dj1711572002/0ad8aa8aee618e5f2b7bfa719bc2b736
But no luck for me.
I hope anyone got this working.
Regards -
Well,
Finally found it :
This is works : Serial1.begin(115200, SERIAL_8N1, 0, 26); // SIM7080G
and G26 connected to TX and G0 to RX.
Now trying to get the modem responding to SIM7080G commands. -
I’ve got one on my desk but haven’t purchased a sim for it yet
-
@happyuser
A few tips who want to start with this module:
1] Remove PIN code, makes life much easier
2] Download the application notes for this module. Both the complete AT instruction set and the note on HTTP application. This document provides clear instructions how to use HTTP, GET, POST etc
3] I experienced ERROR response on SHCONF command. Googled around, saw numerous hits. It appears that switching off and on power does the trick for me. I did not see a reset AT instruction
4] I got it all working with these instructions :
Serial.println("Begin..");
//pinMode(RXD2, INPUT);
//pinMode(TXD2, OUTPUT);
//showLog("Reset Module...");
//SIM7020
//DTU.Init(&Serial1,36, 26);
//Serial1.begin(115200, SERIAL_8N1, RXD2, TXD2);
//Serial1.begin(115200, SERIAL_8N1, 26, 0);
Serial1.begin(115200, SERIAL_8N1, 0, 26); // SIM7080Gdelay(300); //Serial1.print("ATI\r\n"); //Serial1.println("AT+CSQ\r\n"); //Serial1.println("AT+IPR?\r\n"); Serial1.print("ATZ\r\n"); // Reset to default delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+IPR=115200\r\n"); // Reset to default delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CCLK?\r\n"); // Reset to default delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHSSL=1,\"\"\r\n"); // Reset to default delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CFUN=1\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CMGF=1\r\n"); // text mode delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500);
// Om http te testen
Serial1.print("AT+CFUN=0\r\n"); // Disable RF delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); //Serial1.print("AT+CGDCONT=1,\"IP\",\"internet\",,0,0\r\n"); // Serial1.print("AT+CGDCONT=1,\"IP\",\"internet\"\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CFUN=1\r\n"); // Enable RF delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CGATT?\r\n"); // Check PS Service delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CGNAPN\r\n"); // Query the APN service delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CNCFGN=0,1,\"internet\",,0,0\r\n"); // Before activation please delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CNACT=0,1\r\n"); // Activate delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CNACT?\r\n"); // Query the APN service delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHCPARA\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHCONF=?\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHCONF?\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500);
// Serial1.print("AT+SHCONF="URL","https://api.thingspeak.com/update"\r\n"); // Query the APN service
//Serial1.print("AT+SHCONF="URL","httpbin.org"\r\n"); // Query the APN service
//Serial1.print("AT+SHCONF="URL","http://34.193.132.77"\r\n"); // Query the APN service//SIM7600_Error=1; //for (int i=0;i<10;i++) // { //Serial1.print("AT+SHCONF=\"URL\",\"http://www.google.com\"\r\n"); // Query the APN service Serial1.print("AT+SHCONF=\"URL\",\"http://www.httpbin.org\"\r\n"); // Query the APN service delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(2000); // if (SIM7600_Error=0) {break;} // } Serial1.print("AT+SHCONF=\"BODYLEN\",1024\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHCONF=\"HEADERLEN\",350\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHCONN\r\n"); // Query the APN service delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHSTATE?\r\n"); // Query the APN service delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHCHEAD\r\n"); // Query the APN service delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHAHEAD=\"User-Agent\",\"curl/7.47.0\"\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHAHEAD=\"Cache-control\",\"no-cache\"\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHAHEAD=\"Connection\",\"keep-alive\"\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHAHEAD=\"Accept\",\"*/*\"\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHREQ=\"/get?user=jack&password=123\",1\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SHREAD=0,391\r\n"); // delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500);
-
Okay, Had a lot of <bad language> getting sending email working.
Than I realized that powering the module straight from the M5StickC appeared to causes glitches. I have placed a capacitor on top of the 5Volt to the module and now I am able to send emails also. For those that are interested, here is the code (with a lot of overhead no doubt, that works for me ):
Serial1.begin(115200, SERIAL_8N1, 0, 26); // SIM7080Gdelay(300); //Serial1.print("ATI\r\n"); //Serial1.println("AT+CSQ\r\n"); //Serial1.println("AT+IPR?\r\n"); Serial1.print("ATZ\r\n"); // Reset to default delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CREBOOT\r\n"); // Reset to default delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500);
/*
Serial1.print("AT+CMEE=2\r\n"); // Verbose error printing ??
delay(10);
Read_Response_OK(5000);
Serial.println(Receive_buffer);
delay(500);
*/Serial1.print("AT+IPR=115200\r\n"); // SetTE-TAFixedLocalRate delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CCLK?\r\n"); // Clock delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500);
// Upload a file
Serial1.print("AT+CFSINIT\r\n"); // Clock delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500);
String Command_Str;
Command_Str="AT+CFSWFILE=0,"0001.txt",0,";
Command_Str=Command_Str+FileSize;
Command_Str=Command_Str+",10000\r\n";
Serial.println(Command_Str);Serial1.print(Command_Str); delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); for (int i=0;i<FileSize;i++) {Serial1.print(jpg_small[i]);} Serial1.print("AT+CFSGFIS=0,\"0001.txt\"\r\n"); // delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CPIN?\r\n"); // Ccheck SIM delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CSQ\r\n"); // Check signal delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CFUN=0\r\n"); // Set Phone Functionality isable RF delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); //Serial1.print("AT+CGDCONT=1,\"IP\",\"internet\",,0,0\r\n"); // Serial1.print("AT+CGDCONT=1,\"IP\",\"internet\"\r\n"); // Define PDP Context delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CFUN=1\r\n"); // Set Phone Functionality Enable RF delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CGATT?\r\n"); // Attach or detach from GPRS service delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CGNAPN\r\n"); // Get Network APN in CAT-M or NB-IOT Query the APN service delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CNCFGN=0,1,\"internet\",,0,0\r\n"); // Before activation please delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CNACT=0,1\r\n"); // APP Network Active Activate delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+CNACT?\r\n"); // APP Network Active Activate Query the APN service delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+EMAILCID=0\r\n"); // Set parameters of email delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+EMAILTO=30\r\n"); // Set parameters of email time out delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500);
/*
Serial1.print("AT+EMAILSSL=2,0,"email.cer","email.pem"\r\n"); // Set Encrypted mail
delay(10);
Read_Response_OK(5000);
Serial.println(Receive_buffer);
delay(500);
*/
// https://randomnerdtutorials.com/esp32-send-email-smtp-server-arduino-ide/Serial1.print("AT+SMTPSRV=\"smtp-mail.outlook.com\",587\r\n"); // Set SMTP server delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500);
//SMTP Password: (you need to use a Google App Password, not your Gmail password!)
//https://support.google.com/accounts/answer/185833
// https://www.hesk.com/knowledgebase/index.php?article=72Serial1.print("AT+SMTPAUTH=1,\"my.email.com\",\"myApppassword\"\r\n"); // Set username and password
delay(10);
Read_Response(5000);
Serial.println(Receive_buffer);
delay(500);Serial1.print("AT+SMTPCS=\"ASCII\"\r\n"); // Set Email SSL function delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+EMAILSSL?\r\n"); // Read Email SSL function delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+EMAILSSL=2,0,\"\",\"\"\r\n"); // Set Email SSL function delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+EMAILSSL?\r\n"); // Read Email SSL function delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SMTPFROM=\"my.email@outlook.com\",\"Fakename\"\r\n"); // Set username and password delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SMTPRCPT=0,0,\"Sendto@mac.com\",\"john\"\r\n"); // Set recipient To: delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500); Serial1.print("AT+SMTPSUB=\"Test4\"\r\n"); // Set recipient Bcc: delay(10); Read_Response_OK(5000); Serial.println(Receive_buffer); delay(500);
String Email_Body="This is a new Email";
int Body_size;
Body_size=Email_Body.length();
Serial.print("Body size is :");
Serial.println(Body_size);Serial1.print("AT+SMTPBODY=19\r\n"); // Set recipient Bcc: delay(10); Read_Response_OK(5000); //Serial.println(Receive_buffer); //delay(500); Serial1.print(Email_Body); //Serial1.print("\r\n"); delay(10); Read_Response(5000); Serial.println(Receive_buffer); delay(500);
char ccc;
Serial.println("AT+SMTPSEND");
Serial1.print("AT+SMTPSEND\r\n"); //
delay(10);
while (Serial1.available())
{
ccc=Serial1.read();
Serial.print(ccc);
}/*
Read_Response(5000); //Geen OK
Serial.println(Receive_buffer);
delay(500);
*/
Serial.println("And we are done");
while (1) {delay(300);} -
Thanks for this, I haven't started on mine as still looking through IOT services