Electron with Australia Telstra Sim and Sending SMS


#1

Hi all,

From reading the kickstarter electron page it states the following about text or SMS messaging.

How about voice and text messages?

While the hardware will technically support both voice and text
messages, the Electron will not be PTCRB certified for voice, and our
SIM cards won’t support either voice or text messages. If you want to
send text messages, we recommend using a web service like Twilio.

I realise sms is part of the 2G/3G mobile evolution and things are (slowly) moving away to all IP, however I still believe there is a market that want and would still demand this feature for updates/alerts (without using services like twilio).

  • Will the Australia Telstra sim card I receive (when I receive it with the Electron) also not allow sending SMS? I am guessing this is how the sim cards are being provisioned as part of Particle being the MVNO.
  • Is there any chance in the future that the capability of sending SMS’s be added/provisioned (for those who would like to avoid services like Twilio)? If so would this incur an extra cost?
  • If I decide to purchase my own prepaid sim card with the capability of sending sms, how confident can I be (without testing before hand) the Electron will be able to send sms’s?

Thanks,
Ben


#2

Purely out of interest, why would you prefer ‘normal’ texts over internet based ones?


#3

Hi Moors,

The product we intend to sell will be mainly directed towards Australian farmers. We do plan to develop an android/ios application and also are advertising the ability to send email notifications, however; out of the 15 farmers or so we have spoken to so far nearly all of them seem inclined towards sms as the primary method of notification.

I guess it’s like that uncle/aunty/mother or father you know who only learnt how to send sms and can’t live without it.

Thanks,
Ben


#4

Understood, but isn’t that what, for example, Twilio does? It send you an SMS, if you trigger it over the internet. You just move the ‘burden’ of sending that text away from the device, into the cloud.
Your customers won’t see the difference. Besides, it’s then much easier to manage all the texts, since that gets handled in one system, rather than per device.


#5

Hi @Ben86! Great question, and I have an easy answer for you :smile:

Yes the Electron will support sending native SMS with your 3rd party SIM that has SMS capabilities.

Out of the box though, there is no Cellular.sendSMS() API that would allow you to do this.

There is however a Cellular.command() API that allows you to send AT commands and receive & parse responses. From here it would be fairly straight forward to create an in user application API like sendSMS("Hello World")


#6

Hi Moors,

Using data to connect to Twilio just to send an sms seems excessive if the mobile network and ue device already have that capability. Furthermore,

  1. The mobile network is more reliable/secure
  2. Using Twilio means you are now relying on another 3rd party.

Twilio could be a redundant option though however, that is if sending an sms via the network fails Twilio could then be secondary option.

Anyway we will be trialling both options and see how things go.

Thanks,
Ben


#7

Hey Bdub,

Thanks for the response. That’s fantastic.

Also who needs Cellular.sendSMS() API commands when you have at your disposal at@ commands!

Thanks,
Ben


#8

Hi @Ben86,

Did you manage to get this working on your end?
I’m also based in Australia trying to leverage the Telstra network to send SMS’s.

Would be great if you could share any code you have please on triggering the SMS - I checked out the ublox page… but got a bit lost (may have been in the wrong spot… but got lost when it started talking about binary messaging formats)

Any help would be greatly appreciated :smile:


#9

Hi @Cameron, I just saw your post, I am not sure how relevant this is and it may well be late, but I’ll offer it anyway. I got the Telstra API working with sending SMS’s triggered by the Photon (not Electron). I described it here: Garage Door Minder - SMS Alert for Garage Door Left Open This is a Twilio style of service. As far as I know it is currently free, but comes with some limitations (eg the sending SMS phone number is not constant). Not sure if Telstra offer a paid/better service than the free one.


#10

Thanks @GreyMonkey

That is a really good find! Telstra have some great stuff sometimes, but so hard to find!
I’ll certainly use this on some of my other projects during dev stage (saves me the Twilio fees each month!) thank you!

I’m still trying to figure out how to get the uBlox device to send SMSs direct from the device - the application we are developing for needs to have a very high up time. So if the webhooks or API service stop working, we had wanted to use the local SMS service. I’ll do some more forum searches. :smile:

Cheers!


#11

Just recently I did something like that for another project

SYSTEM_MODE(SEMI_AUTOMATIC)
SYSTEM_THREAD(ENABLED)
STARTUP(cellular_credentials_set("yourAPN", "", "", NULL))               
SerialLogHandler serlog;

#define RADIO Cellular

int placeCall(const char* telNr, uint32_t duration = 30000);
int sendMessage(const char* telNr, const char* msg);

void setup() {
  RADIO.on();
  RADIO.connect();
  Particle.connect();
}

void loop() {
  static uint32_t ms = 0;
  if (millis() - ms > 60000) {
    ms = millis();
    placeCall("+##########");  // target phone number international format
    sendMessage("+########", "Hi there, I'm Electron!");
  }    
}

int sendMessage(const char* telNr, const char* msg)
{
  int  ret;
  char cmd[64];

  if (!RADIO.ready())
  {
    RADIO.on();
    RADIO.connect();
    if (!waitFor(RADIO.ready, 300000))
    {
      Log.warn("no radio connection");
      return -1;
    }
  }

  ret = Cellular.command("AT+CMGF=1\r\n");
  ret = Cellular.command("AT+CMGS=\"%s%s\",145\r\n", (telNr[0] != '+') ? "+" : "", telNr);
  ret = Cellular.command("%s\x1a", msg);
  switch (ret)
  {
    case WAIT:
      Log.info("WAITING, but probably");
    case RESP_OK:
      Log.info("Sent: '%s' to %s", msg, telNr);
      break;
    default:
      Log.warn("Message not sent (%d)", ret);
      break;
  }

  return ret;
}

int placeCall(const char* telNr, uint32_t duration)
{
  int  ret;

  if (!RADIO.ready())
  {
    RADIO.on();
    RADIO.connect();
    if (!waitFor(RADIO.ready, 300000))
    {
      Log.warn("no radio connection");
      return -1;
    }
  }

  if ((ret = Cellular.command("ATD%s;\r\n", telNr)) == RESP_OK)
  {
    Log.info("Call pending");
    softDelay(duration);
    Cellular.command("AT+CHUP\r\n");
    Log.info("Hung up");
  }
  else
  {
    Log.warn("Call not possible (%d)", ret);
  }

  return ret;
}

inline void softDelay(uint32_t msDelay)
{
  for (uint32_t ms=millis(); millis()-ms < msDelay; Particle.process());
}

Receiving SMS in Particle Electron
Send SMS with Particle Electron
Adafruit Fona library with Photon
Can Boron be used to recieve and send SMS?
#12

Thank you @ScruffR

And it works brilliantly, thank you very much :smile:

Wouldn’t have been able to figure that out myself.


#13

@ScruffR This is a really excellent example :+1:


#14

Hello to all , is it possible to receive phone calls in particle electron 3g in Australia , not voice is required ,i am using either a Vodafone sim card or telstra sim card prepaid both and i simply want the electron to identify the mobile number that calls it.


#15

The Particle SIM card does not support voice, but you can use a 3rd-party SIM card that does. The Electron does not support hardware voice (I2S) as the data lines are not connected. However neither of these will be issues for your application.

You can probably set up voice using Cellular.command, but the problem is that ring notification occurs with the RING URC. There is currently no way for user firmware to subscribe to cellular URCs, so there’s no way to know when the ring occurs.

You’d need to make a custom system firmware build that supports the RING URC and it would probably work, but this is not a supported use case of the Electron.