---
title: "Arduino and SMS notifications"
url: "https://maker.wiznet.io/jaden/projects/arduino-and-sms-notifications/"
markdown_url: "https://maker.wiznet.io/jaden/projects/arduino-and-sms-notifications/md"
type: "UCC: User Created Content"
author: "Jack"
author_url: "https://homeguard24.pl/arduino-i-powiadomienia-sms/"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Jack"
original_url: "https://homeguard24.pl/arduino-i-powiadomienia-sms/"
published: "2022-11-01"
language: "en"
hardware: ["Arduino Ethernet Shield", "SparkFun OpenPIR", "Arduino UNO"]
likes: 3
views: 1039
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Arduino and SMS notifications

> how to use Arduino and smsAPI service to send sms messages

Original author: Jack (source: https://homeguard24.pl/arduino-i-powiadomienia-sms/)

## Components

- **Arduino Ethernet Shield** x 1 ([docs](https://docs.arduino.cc/retired/shields/arduino-ethernet-shield-without-poe-module))
- **SparkFun OpenPIR** x 1 ([docs](https://learn.sparkfun.com/tutorials/openpir-hookup-guide?_ga=2.145876727.278798874.1657068782-1842012612.1651468433))
- **Arduino UNO** x 1 ([docs](https://www.farnell.com/datasheets/1682209.pdf))

## Article

This project show how to use Arduino and smsAPI service to send sms messages when motion is detected.

Connection diagram:

![](https://maker.wiznet.io/upload/ckeditor5/1010957345%5F1667331834%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/1010957345%5F1667332242%2Epng)

usually sending SMS in Arduino using the GSM module.

![](https://maker.wiznet.io/upload/ckeditor5/151033983%5F1667407215%2Epng)

but author use smsAPI that can send sms without GSM module.

he used this company's API([link](https://www.smsapi.pl/)).

The company gave API key to him, so he can send the sms.

This sms API is only free in 50 text message, after that you should pay.

When I searched for Korean SMS API solution companies, there were many companies.

They supported not only SMS but also messengers such as Kakao Talk.

this is arduino code

| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include &amp;lt;Ethernet.h&amp;gt;; #include &amp;lt;SPI.h&amp;gt;; byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01 }; EthernetClient client; int czujnik =7; int val = 0; void setup() { pinMode(10, OUTPUT); pinMode(7, INPUT); Serial.begin(9600); if (Ethernet.begin(mac) == 0) { Serial.println("Failed to configure Ethernet using DHCP"); } } void loop(){ digitalRead(czujnik); val=digitalRead(czujnik); Serial.println(val); if (digitalRead(czujnik)==1){ digitalWrite(10, HIGH); } else { digitalWrite(10, LOW); } if(val&gt;0){ if (client.connect("www.xxx.xx",80)) { //adres serwera client.println("GET /nazwapliku.php HTTP/1.1"); //nazwa pliku client.println("Host: www.xxx.xx"); // SERVER ADDRESS HERE TOO client.println("Connection: close"); } if (client.connected()) { client.stop(); // DISCONNECT FROM THE SERVER } } else{ Serial.println("brak danych do wyslania"); delay(300); } } |
| --- | --- |

this is PHP script

| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | &lt;?php require_once 'smsapi/Autoload.php'; $client = new \SMSApi\Client('login/email'); $client-&gt;setPasswordHash('hasłomd5'); $smsapi = new \SMSApi\Api\SmsFactory(); $smsapi-&gt;setClient($client); try { $actionSend = $smsapi-&gt;actionSend(); $actionSend-&gt;setTo('numer telefonu na ktory ma zostac wyslana wiadomosc'); $actionSend-&gt;setText('tekst wiadomosc'); $actionSend-&gt;setSender('INFOSMS'); //Pole nadawcy lub typ wiadomość 'ECO', '2Way' $response = $actionSend-&gt;execute(); foreach( $response-&gt;getList() as $status ) { echo $status-&gt;getNumber() . ' ' . $status-&gt;getPoints() . ' ' . $status-&gt;getStatus(); } } catch( \SMSApi\Exception\SmsapiException $e ) { echo 'ERROR: ' . $e-&gt;getMessage(); } ?&gt; |
| --- | --- |

It is interesting that SMS transmission was burned using SMS API rather than GSM module, that's why I think this UCC is special.

---

Source: https://maker.wiznet.io/jaden/projects/arduino-and-sms-notifications/
