Using Node-RED to send SMS through dongle

1,447 views
Skip to first unread message

Liam Broughton

unread,
May 4, 2018, 6:44:23 AM5/4/18
to Node-RED
Hello all,

So I am trying to configure my Node-RED flow to send SMS messages through a 3G dongle that I have connected through my USB port.


But I am receiving the errors shown in the screenshot. (This is from my serial "in" node and my debug node coming from the function node with the following code inside)

var num = msg.payload.Number;
var at_cmd = "AT+CMGS=\""+num+"\"";

msg.payload=at_cmd+"\r";

return msg;

I have seen that you can do this through Twilio, but I believe the outcome of using a 3G dongle will be much cheaper.

If anyone has any experience with this and knows how to help me out it would be really appreciated!

Thanks,

-Liam.
Node-RED flow with errors.png

Zenofmud

unread,
May 4, 2018, 7:28:20 AM5/4/18
to node...@googlegroups.com
You have a capital ’N’ in the first line where the demo has a lowercase ’n’

> On May 4, 2018, at 6:44 AM, 'Liam Broughton' via Node-RED <node...@googlegroups.com> wrote:
>
> <Node-RED flow with errors.png>

Liam Broughton

unread,
May 4, 2018, 7:36:42 AM5/4/18
to Node-RED
Hi Paul,

I changed it to a capital N as that is what my msg.payload.Number is set to in my form.

However, I tried to change the capital "N" to a lower case "n" both in the function node and in my form, and no luck.

I have just googled the error code I am receiving "+CMS ERROR: 302" and it is stating that this is the error:
The operation to be done by the AT command is not allowed.

I am going to try a different GSM dongle soon to see if the issue is the dongle itself not accepting the command.

I will let you know on any updates.

-Liam.

Dave C-J

unread,
May 4, 2018, 7:44:47 AM5/4/18
to node...@googlegroups.com
Have you set the modem into text mode ? maybe you need a bit more up front configuration before sending the message.
eg

Liam Broughton

unread,
May 4, 2018, 8:50:41 AM5/4/18
to Node-RED
Hi Dave,

I did see this article..

How would I refer to my USB port then when I enter these commands?

As just entering them on the raspberry pi terminal I just get the error - "-bash: AT+CMGF=1: command not found"

-Liam.

Liam Broughton

unread,
May 4, 2018, 10:13:35 AM5/4/18
to Node-RED
I have found this link:

Showing me how to put my dongle into SMS mode.

However, my raspberry pi doesn't seem to have the command "cu" installed.

I have done a quick google search and cannot find anything relating to the raspberry pi when it comes to trying to install this command.

Just updating to npm v6.0.0 now. Will update if I find anything else.

-Liam.

Mike Bell

unread,
May 4, 2018, 2:23:01 PM5/4/18
to Node-RED
If you really want the cu command, just do

sudo apt-get update
sudo apt
-get install cu

BTW, cu (call up) is a throwback to the days when you wanted your computer to talk to a dial-up modem. I'm not surprised that it's not installed in Raspian, but it's nice to see a 21st C use for it.

Liam Broughton

unread,
May 8, 2018, 4:33:56 AM5/8/18
to Node-RED
Thanks for that Mike!

Interesting to know that cu was used a while back!

I will let you know if I get this working or not.

Thanks,

-Liam.

Dave C-J

unread,
May 8, 2018, 4:46:35 AM5/8/18
to node...@googlegroups.com
You should be able to do this with just simple AT commands via the serial port. But will be a some commands up front to set it up - then send the message. 
Reply all
Reply to author
Forward
0 new messages