is there a way to

Aug 11, 2022 Last reply: il y a 3 ans 49 Replies

send a sms from a Raspberry (pi or pico) or a NodeMcu8266 (ESP12) or a ESP32?? Many thanks


If you have a GSM module (2G/3G/4G, depending on your local networks), it should be just a case of generating the right AT command and sending it over the serial port to the module. eg

formatting link
There are also internet SMS services, but not sure they are set up for sending in this way.

Theo

Every VoIP service has SMS service. You connect to their web page and fill out SMS form andd "click" send.

And how exactly does your microcontroller go to their web page and click send? (given you'll need to login first to do that, maybe they want you to do 2FA, etc etc)

You may be able to do it from SIP, but that needs at least some form of SIP stack - not straightforward for a microcontroller.

Theo

But well within the capabilities of a Pi.

David

On a sunny day (Thu, 11 Aug 2022 16:08:40 +0200) it happened zeneca snipped-for-privacy@ailleur.fr wrote in <td32h8$1e38$ snipped-for-privacy@gioia.aioe.org>:

I wrote huaweic:

formatting link
It works with Huawei USB 3G and 4G modem sticks You need for example a prepaid card or some account with a provider.

Or if you don't want to write your own script, ModemManager also supports sending SMSs and other common SMS functions with an AT modem. Beware newer USB mobile broadband modems that appear to the host as USB network adapters with a web-based interface for configuration and therefore don't allow AT commands. The web-based interface _might_ have a send-SMS page though, which if you're really lucky might be simple enough (ie. not all Javascript) that you can use curl or wget to submit an SMS automatcially with that.

There are Email-SMS services which would be easy to use with the "sendmail" command, or its alternatives. In Australia they're all paid services, but cheap enough that they can be less costly than a SIM card if you don't also need the latter for internet access. There are probably similar offerings wherever the OP lives (France, if the email address is anything to go by).

[snip]

I think we need to establish what the OP wants this for. They mentioned three microcontrollers (Pico, ESP8266, ESP32) and one computer (Pi). The answers for each are quite different. Everyone so far has been talking about the Pi running Linux. There are sometimes good reasons to pick a microcontroller over a computer, but we don't know why the OP might want one or other.

Theo

Simple I use them for different project. I am retired from computer industry with a background in electronics. That said I use raspberry pi for some project last is controlling temperature home and a SMS could be interseting in some cases, and it's always good to know. The others are microcontoler with WIFI capabilities and there also are occasions to use and send SMS to notify an alarm?? They all have a UART included to control a GSM modem. Andre Many thanks to you all for your answers

If the device already has an internet connection (wifi), have a look at using MQTT to connect to a Node Red server (on a Pi for example) which can send a Telegram message for free. Because sms usually requires a mobile connection and costs money. See Andreas Spiess YouTube channel for some mqtt/nodered videos

formatting link

I note that on

formatting link
you can find about a number of projects that use a microcontroller (with or without a GSM module) to send SMS messages, including projects that centre around the Arduino, the Raspberry Pi, the ESP8266 NodeMCU, and the ESP32 SIM800L

So, the answer to your question is "Yes, you can send an sms message from a Raspberry Pi, ESP8266 NodeMCU or ESP32."

Take a look at

formatting link
for a list of projects, with instructions.

HTH

Prompted by your posting, I spent a couple of hours this afternoon getting a Raspberry Pi running RISC OS to send a Telegram message via the Telegram API. As you say, Telegram is free, where SMS may not be.

It's just an https message, sent using curl.

curl is actually overkill. All that is required is an https POST, so if you have a smaller/faster https client than curl, it will work just as well, and might likely be faster (curl takes several seconds to be invoked).

David

Having just checked the Wikipedia page about Telegram to see that it doesn't offer any SMS-forwarding feature itself, I'm not sure why it would be a better alternative to SMS than simply sending emails.

Time sensitive messages. Email is normally quick but doesn't have to be. The idea is usually to get a notification on one's phone. It has to have the Telegram app installed, which is like Whatsapp or Signal. And MQTT instead of mail or http has advantages for microcontrollers:

formatting link
The whole Nodered thing is indeed complete overkill for just one device sending one type of message, but it is a fairly powerful click-and-go automation hub and it supports receiving mqtt messages.

Notification within seconds.

It depends what the OP wants. He asked for SMS, sure, but the suggestion is that Telegram works just as fast as SMS, and notifies the user in the same way as SMS. Email is often quite quick, but rarely as fast. Also SMS may not be free to send, even from a SIP account.

So Telegram appears to some of us to offer a functional equivalent to what was originally requested.

Of course the rest of us are not so intimately acquainted with the OP's requirements, so we may have misjudged the situation.

David

If you know which service the destination phone uses, you can use their email-to-SMS gateway. For instance, you can send text to a T-Mobile user by sending email to ##########@tmomail.net (where the "#"s are the phone number, with area code).

Getting ESP* devices to send email is trivial; I knocked together a gadget that sends email when the temperature gets too high in an evening, without much in the way of prior experience coding for these devices.

Increasingly less so. Email providers are putting up more & more barriers in the battle against spam, which also makes delivery less & less reliable. There's a reason people are switching to instant messaging: email is failing.

It is fairly easy to set up a relay under your own control. Failing that a lot of ISPs allow simple SMTP access without authorisation from within their own IP networks.

Email isn't failing, but it remains overwhelmingly 'pull' technology - it bears the same relationship to 'instant' messaging as a letter does to a phone call.

In short it is subject to delays.

Yes delivery to humans is getting less and less reliable, but sending email in an automated way is still quite easy. If you're sending to an Email-SMS gateway, especially one from a provider that you have a paid account with, there shouldn't be any problems with ending up in the junk folder. If your device's emails are rejected by the SMTP server then you only need to talk to the SMS gateway provider and get them to allow it, because unlike with normal email they're the only server that you need to worry about.

The funny thing is that I'm getting less spam than I used to, yet reports of my emails not arriving (often it's impossible to determine whether this means they just went into "junk", which based on successful SMTP delivery logs seems most likely) have suddenly become much more frequent.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required