Electron SMS Send Message

Given the example code below, can anyone explain to me why I wouldn’t be getting an SMS message from my particle electron? The phone number in this example is to demonstrate how I formatted my phone number. I feel as though I’m missing something easy here.

Also I am using the particle SIM.

#define MAX_PHONE_NUMBER    14
#define CTRL_Z 0x1A
#define TIMEOUT 10000

unsigned char id;
boolean gain;     // Gain setting, 0 = X1, 1 = X16;
unsigned int ms;  // Integration ("shutter") time in milliseconds
unsigned int data1;
unsigned int data2;
char szPhoneNumber[MAX_PHONE_NUMBER] = "+18005551212";

int lowerLimit = 10;
boolean smsSend = false;

int callback(int type, const char* buf, int len, char* param){  
    Serial.print("Return: ");
    Serial.write((const uint8_t*)buf, len);
    return WAIT;

int setLowerLimit(String args){
    lowerLimit = args.toInt();
    return lowerLimit;

int sendMessage(char* pMessage){
    char szCmd[64];
    sprintf(szCmd, "AT+CMGS=\"+%s\",145\r\n", szPhoneNumber);
    Serial.print("Sending command ");
    char szReturn[32] = "";
    Cellular.command(callback, szReturn, TIMEOUT, "AT+CMGF=1\r\n");
    Cellular.command(callback, szReturn, TIMEOUT, szCmd);
    Cellular.command(callback, szReturn, TIMEOUT, pMessage);
    sprintf(szCmd, "%c", CTRL_Z);
    int retVal = Cellular.command(callback, szReturn, TIMEOUT, szCmd);
    if(RESP_OK == retVal){
        Serial.println("+OK, Message Send");
        Serial.println("+ERROR, error sending message");
    return retVal;

void setup() {
    Spark.function("setmin", setLowerLimit);

void loop() {

    char szMessage[64];
	szMessage = "Particle Electron Test Message!";

Considering the Particle SIM doesn’t support text/voice, that’s probably where your issue is at.

I have a TING SIM, could I use that instead of the Particle SIM?

Never heard of those before. Does it allow for texts?

Yes. They allow for data, text and voice. GSM network, I think they partner with T-Mobile and Sprint.

@jdugat Yea you can not send or receive text messages with the Particle SIM cards.

Anything special I have to do (other than activate) my third party SIM?

Yea you will need to set your APN code in the your code. Search the forum for APN change and you will find the info you need.

1 Like

Thanks for jumping on this, @RWB and @Moors7!

1 Like

@will what are the odds of getting the Particle Sims to have SMS functionality? I would love to be able to send a SMS to a Electron to wake it up when it’s sleeping so I can gain access to it any time I want to to check it’s status or do a firmware update.

It’s a shame we have to look to other providers to get this feature.


I totally concur!

Can I add a question that is probably obvious to everyone but me? OK, great!

If you’re using a 3rd party SIM, is there any dashboard.particle.io et all Particle functionality left? Or is it basically a jailbreakesque Electron that never phones home?

@JoseJones Once you setup the 3rd party SIM APN numbers and possibly change the cellular PING rate to keep the 3rd party cell network alive and connected then you can still use all the Particle Cloud functions but you loose the info on your data usage, data limits, and billing which is nice to have built in to the platform were already using.

@zach @BDub What was the reason for leaving off the SMS functionality on the SIM’s? I’m sure it has to do with trying to keep data rates low but I see other companies offering SIMS with the same or more data + SMS functionality for less per month so I’m not sure why SMS can’t be included for what were paying. Maybe you can shed some light on this.

1 Like

We left off SMS functionality because it would have been extremely expensive. Our plan is to offer simple low-cost texting through Twilio in the future, and if you’re looking to add texting in the short term, you can do a Twilio integration with webhooks.

1 Like

@zach Yes but you can’t wake the Electron from sleep to run functions or do firmware updates using Twillo or other Web based texting services that are available now which is key.

Couldn’t you gave just billed us per SMS message so it cost nothing if we didn’t use it? Other providers are doing this for less per month. Why make us go outside of Particle for these features?

Just a thought, but I guess these don’t provide world wide coverage for the same price - that’s something that often gets forgotten since most people use it only locally.

No they offer world wide service also. I will not mention their name because its a competitor / copy cat company and Jordy deleted my mention of them last time I spoke of them as a alternative if somebody needed the SMS messaging ability.

Plus others are using other cellular providers with varying data rate cost but some being just as good or better than what were paying Particle.

I have no problem paying a premium and I want to support Particle as a company but with the way it is now if I want to be able to send text messages to the Electron to wake it up at any time using System.sleep then I can’t use Particle SIM’s since they do not offer SMS abilities.

Ideally we would just pay per text message sent or received so it’s totally up to us to choose if we need the feature or not.

I have no idea how hard or easy it would be to allow this but I do know others are doing it for less. I’m not complaining about pricing, just the lack of the SMS feature that can be really handy when the Electron is placed in remote locations.

I want to be able to force a Electron out of System.Sleep to run a Firmware update at any time I choose. Sending a SMS to a Electron in System.sleep which then triggers the Ublox modem to ping a interrupt which brings the system out of sleep mode is something that has already been accomplished but it only works with SIM cards by cell providers other than Particle.

I think this would be beneficial to others also.


I see. Good point :+1:

Too bad that competitors with “objectionable” company philosophy are able to offer this and Particle can’t (yet).


Great question @RWB

We have been consciously aware of this feature from the beginning and have provided an internal hardware connection between the modem and the STM32F2 that can be used for exactly this purpose. It does not require an SMS but rather any incoming data. So hypothetically there could be an API end point that you could call to wake up your Electron. That endpoint could be used from an app, the Build IDE, IFTTT, etc… There are time limits on how long the data connection can be open though, so technically you couldn’t sleep for more than 1 hour without at least sending a ping. As far as costs go, a back of the napkin calculation says this should be approximately 100 times less expensive to wake up a device than a typical SMS. Would that satisfy your need, or do you absolutely require an SMS?


@BDub Yea that sounds perfect! And no I can send SMS messages via Twilio or Ubidots when needed so waking up the Electron on demand was really the only reason I wanted SMS messaging :smile:

So this is the first I have heard of this feature? Is it something we can do now or is it a feature that is coming in the near future?

Exciting! I like how you guys are polishing everything up now that the Electron is out the door.

Keep up the good work :spark: Team

It’s one of those features that was planned but hasn’t solidified yet. If you need it, mash the LIKE button on my post above :smile:

1 Like