Troubleshooting SIMCOM SIM800 / SIM900 with Hologram


#1

(If Ben happens across this - This is Tim posting from the Hackerboxes thread).

So I am using an Arduino Uno with a SIM800L. I have the SIM activated ok (so it seems). I am connecting to T-Mobile’s network it looks like. However I can not get SMS messages to go out. The Hologram dashboard does not show any activity at all.

I’m kind of stuck. :frowning:


#2

Hi @TimGTech

For some reason the SIM800 sent requires a SMS config. This blog post explains the steps http://www.smssolutions.net/tutorials/gsm/sendsmsat/

Basically run this command: AT+CSMP=17,167,0,16 . The post explains things in more detail.

If you could try this, then we can go from there. @benstr

Thanks,
Ryan


#3

@TimGTech I created an Arduino library to make integration with the SIM800 easier. Check it out when you have a moment: https://github.com/hologram-io/hologram-SIM800


#4

I’ve looked at the library but I’m still a bit confused. I’m trying to talk to SIM800l directly via a terminal. Everything goes well including AT+CIPSTART=“TCP”,“23.253.146.203”,“9999” that results in “CONNECT OK”

Now I couldn’t quite figure out what to send in order to connect to some server. Suppose I want to connect to TCP socket 99 with IP “111.222.333.444” and send “PING” to it. And listen to the reply. What do I do? The sendData routine suggests forming a request starting with lower case “s” and ending in ctrl-z. Are the _deviceId and _deviceKey the “Shared ID” and “Shared Key”? And where to put the actual destination IP and port?
Thanks.


#5

Yeah, still working on documentation right now. The library is still in beta and have been holding off on the documentation because the API might change. Case in point, since you last posted ther is a new version 0.2.0 on github. Go ahead and download it from here: https://github.com/hologram-io/hologram-SIM800/releases/tag/v0.2.0

Lets see if we can get you up and running in the meantime.

Sending Data to our Cloud

  1. Get your Device_Id and Device_Key from our Dashboard. Go to: Dashboard > Devices > Select your Device > Configuration > Show Router Credentials > Generate New CSR Key.


  2. Pass these 4 digit keys into the Hologram800 initializer


#include <Hologram800.h>
#include <SoftwareSerial.h>

const int RX_PIN = 7; //SIM800 RX connected to pin D7
const int TX_PIN = 8; //SIM800 TX connected to pin D8
const char HOLOGRAM_ID[] = "ID_GOES_HERE";  //replace w/your SIM id
const char HOLOGRAM_KEY[] = "KEY_GOES_HERE"; //replace w/your SIM key

Hologram800 hologram(TX_PIN, RX_PIN, HOLOGRAM_ID, HOLOGRAM_KEY);

setup() {
  Serial.begin(9600);
  while(!Serial);
  hologram.begin(9600);
}

loop() {

}
  1. Send a “Hello World” to the cloud by modifying the loop:
loop() {
  if(hologram.initialized) {
    hologram.sendData("HELLO WORLD")
  }

  while(hologram.initialized); // stop the loop from looping :)
}
  1. You should now see the data in your cloud logs at https://dashboard.hologram.io/devices/logs

Receiving Data from the Cloud

~~ Coming Soon ~~ :wink:


#6

@alexf, also saw you wanted to talk to the SIM800 directly through a serial terminal. Here are the instructions for doing that.

NOTE: This is advanced and tedious. The Arduino IDE Serial Monitor is not capable of executing all the AT commands. This walkthrough assumes you have screen installed for Mac or equivalent. Install screen with sudo apt-get install screen.

  1. Upload this sketch:
#include <Hologram800.h>
#include <SoftwareSerial.h>

const int RX_PIN = 7; //SIM800 RX connected to pin D7
const int TX_PIN = 8; //SIM800 TX connected to pin D8
const char HOLOGRAM_ID[] = "ID_GOES_HERE";  //replace w/your SIM id
const char HOLOGRAM_KEY[] = "KEY_GOES_HERE"; //replace w/your SIM key

Hologram800 hologram(TX_PIN, RX_PIN, HOLOGRAM_ID, HOLOGRAM_KEY);

setup() {
  Serial.begin(9600);
  while(!Serial);
  hologram.begin(9600);
  Serial.println("Setup Complete");
}

loop() {
  hologram.serialDebug();
}
  1. In your command terminal list all the serial ports and identify your Arduino $ ls /dev/tty*

  2. Start a screen instance

  3. Type commands directly into the terminal. Screen allows for you to send CTRL+Z and other keyboard commands not available in the Arduino Serial Monitor.

  4. Here are a few other helpful Screen shortcuts

  • CTRL+A+D will detach an instance and put you back into normal terminal mode.
  • $ screen -list will list any active screen instances.
  • screen -r will resume your detached instance.

#7

Ben, thank you very much for a reply and a pointer to the updated library. I have a confession to make: I don’t even use Arduino for this project, but since “wiring” is C++ under a different name, it’s a good way to understand the functionality.
I did get the router credential, and BTW there is a bug: the HEX code is correct for the ID, but is a repeat of the ID instead of the Key. Even on your screenshot.
As for the terminal, the only challenge is sending the Control-Z, AKA 0x1a at the end. Not sure about Arduino terminal emulator, but Termite works well under Windows and I use “minicom” under Linux for like 15 years.
My real question was not how to use the tools, but WHAT to send after establishing a connection and sending “AT+CIPSEND”. After posting here I experimented some more and was able to send an SMS to my phone by sending a string used in the sendCloudSMS() routine.
Using the cloud server for sending generic TCPIP data to a 3-d party internet-connected device is still a mystery.
Yes, I can copy the string starting with lowercase “s” and ending in ^z from sendData. But what actual data should be send to say send a request to port 80 of a server at 123.123.123.123? Or should I open a connection directly to 123.123.123.123? If so, what’s the purpose of the “23.253.146.203”,“9999” other than sending cloud SMS? Is it used at all for generic TCPIP?
Thanks.


#8

Hey @alexf,

Just catching up on this thread now. So do I understand you correctly, you do not want to send data to our cloud but instead to another TCP server?

If so then you can ignore the IP and Port I have in my code (“23.253.146.203”,“9999”) since that’s Hologram’s socket server. Also, you can ignore the string manipulations I do since that is just for our cloud as well.

Lastly, there is a little trick with AT+CIPSEND. If you pass the string length you will not need to terminate with Crtl-Z. Instead, a newline and carriage return /n/r would trigger the string to send.

Example:

AT+CIPSEND=11\n\r
> hello world\n\r
SEND OK

#9

Thanks. I’ve figured out the arbitrary server part, but the length parameter may come handy.