Notification System

As you may know, Short Message Service (SMS) had become a very common way to communicate with each other and this might be the cheapest way if not to bug others out of their busy time. A lot of young generation like to use this way to communicate with each other. And of course, as our spirit to keep upgrade and provide the best for you, we too use SMS as one of our tool to notified on the status of your order. Now we decided to add this service for warranty process too.

In order to improve the efficiency, we had developed a Web Page, whereby it only require a few components and it allows all user in our office within local area network to use it. And of course, it’s able send data from your Arduino via an Ethernet network to a web browser, which is not yet available so far. Soon, you’ll receive a message from a ‘Robot’!!  😎

20140321_084356

Hardware & Schematic

  1. Arduino Uno
  2. Ethernet Shield 2.0
  3. GSM – TC35
  4. URS232A (Optional)

Siemens TC35 Rev2.0 comes with a Serial communication which allow direct connection to the Arduino main board without any external level shifter. Please Do NOT use the VCC on TC35 to power up your Arduino or what so ever as it may spoil the TC35.

Untitled Sketch_bb

In my case, I found out that the signal data direct from the TC35 Serial pin is not stable. so I choose to use URS232A to get the data from the RS232 port. Below are the connection:

Untitled Sketch_bb2

Caution: Ethernet shield will turn HOT when power up as it require high amount of power to operate.

The Code

[sourcecode language=”cpp” wraplines=”true”]
#include <SPI.h>;
#include <Ethernet.h>;
#include <avr/wdt.h>; // the media access control (ethernet hardware) address for the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xAD };
IPAddress ip(192,168,1,250);
EthernetServer server(80);
[/sourcecode]

Ethernet devices all require two unique identifying addresses so they can operate on a TCP/IP network: an IP address, and a “MAC” address. The two addresses operate at different layers of the network, and although many people are familiar with IP addresses, MAC addresses are often considered a bit more mysterious. Even if you’ve set up computer networks before, it’s likely you’ve never had to set or worry about MAC addresses until now. But with Arduino and other microcontrollers, it’s normal to have to configure the MAC address as well as the IP address when connecting them to a network. MAC addresses need to be unique on the network, so with Arduino-compatible boards you usually need to configure their MAC address in the sketch. To see an example, launch the Arduino IDE and look in the menu File > Examples > Ethernet > WebServer to see the following code starting at line 21.

[sourcecode language=”cpp” wraplines=”true”]
void setup() {
wdt_disable(); // Watch Dog timer Disable
Serial.begin(4800);
Ethernet.begin(mac, ip);
server.begin();}
[/sourcecode]

In the code, the WatchDog timer is use to prevent the system from hang or waiting the incoming data for too long. And for the Serial communication, I had set it to 4800 Baud Rate so it TC35 GSM Modem had enough time to grab all the incoming data slow and steady.

[sourcecode language=”cpp” wraplines=”true”]
void ParseHttpHeader(EthernetClient client) {
char c;
unsigned char info[40]; // Store URL of total 40 bytes (or 40 ASCII charactors)
unsigned char j=0;
while((c = client.read()) && client.available()) {
if(c == 32) { // if found spacing then replace spacing with &
info[j] = ‘&’; // add ‘&’ act as indicator to stop collecting information
break;}
info[j] = c; // Store the client read into an array(Info).
j++;}
[/sourcecode]

Above code is the function of parse an HTTP request header one character at a time and store in a variable before further filtering. After the filtering is done, then the information should add into the SMS before send.

[sourcecode language=”cpp” wraplines=”true”]
void sendSMS() {
char i = 0;
wdt_enable(WDTO_4S); // Watch Dog Timer enable for 4 Seconds to make sure the GSM modem return the signal. Else, it will reset the page to prevent system hang-up.
Serial.println(“AT”);
while(true) {
if(Serial.available() > 0) {
if(Serial.read() == ‘O’)
break;}
}
// while(Serial.read() != ‘O’); // Wait until received signal ‘O’K from the GSM modem&lt;
delay(100);
Serial.println(“AT+CMGF=1\r”); // Switch to Text mode (GSM)
while(true) {
if(Serial.available() > 0) {
if(Serial.read() == ‘O’)
break;}
}
[/sourcecode]

Above code is the function for SMS sending whereby Arduino will initialize the TC35 according to the SIEMENS TC35 GSM Development Board, GSM-TC35 tutorial.

[sourcecode language=”cpp” wraplines=”true”]
Serial.print(“Your warranty has been shipped via “);
for(char i=0; i<TotalByte_Carrier; i++) {
Serial.write(Carrier[i]);
}
Serial.print(” with CN:”);
for(char i=0; i<TotalByte_CN; i++) { Serial.write(CN[i]); } Serial.print(“. I’m a Robot from Cytron!”); Serial.write(0x1A); while(true) { if(Serial.available() > 0){
if(Serial.read() == ‘+’)
break;}
wdt_reset();
wdt_disable();
[/sourcecode]

The Result

The web layout:

WebPage

Data entered

P/S: This project is still undergoing where to add a function of receive the Delivered Message back; so that we know the SMS is sent to you. Stay Tune!


_____________________________________________________________

Notification System 2.0

20140625_121026

At the last  project (Notification System 1), it seem to be unstable where the webpage can be display sometimes but sometimes not. It take me long time to figure out why. It’s because the SRAM(not Memory) using in Arduino UNO is only 3K. Once the webpage consume the SRAM too much or the space of SRAM was used roughly to 70 ~ 80%,  the whole system become UNSTABLE

And one day, I found out that we have a very Cool and powerful board, Arduino Due, which is not used in our RnD and I decide to give it a try. After some modification and upgrade, now we had added email features and also combine the notification of sales department together in one device. It will be able to send SMS to notify and also email with Carrier Service, parcel tracking number, and of course order number for items purchase. Arduino Due is powerful, lots of memory space and SRAM to develop few page without any problem. 

And I’m using Ethernet shield to received and send the information from local network and also TC35 GSM Modem to send the SMS. The external UART in TC35 is not really stable, so I decided to use URS232A to communicate with it in 9600 baud rate. And the result is Great. 

20140625_121002

The Result

The page now are able to operate in 2 mode which allow to choose Sales or Warranty use. Click any button below may lead to the different pages which the format are little bit different. In here, I choose to use ‘Button’ to represent Sales and Warranty instead of ‘Radio’ button or other is because the ‘Button’ may react instantly once I click it. But for ‘Radio’ button to choose then react only after you submit the whole thing to the server to process.

Notification_1

Once click the Sales button, it will be highlighted and display the table to fill in the information. Once done, click ‘Submit’ button and it will record all the information into the address bar. Then, the microcontroller will read the information on the address bar then do the filtering to get the desire information.

Notification_8

Notification_2Notification_3

In sending the email, it might consume some time to process until it finish send the email. It will take roughly around 30 seconds for each email. But, I had make it optional as not all email address of customer we know. So, if the email address is not entered, it will skip that part and directly jump to process and send the SMS. 

Lastly, is the indication part where to verify if the SMS is successfully sent. As in the TC35, it will reply “Error” if the SMS is not successfully sent out from the system, and “OK” if successfully sent. To make it visible for user, simply create another new webpage just to display the result. I make it display “Done !!!” when OK is received from TC35 and “Error !!!” when Error is received. 

Notification_6

or

Notification_5

The Email

For the email, You may received the same notification as in the SMS text messages. And in the same time, It have the function of  create a Corbon Copy (CC) as well.  If you have any enquirers, please do email to support@cytron.com.my. DO NOT REPLY to notification@cytron.com.my as we will not check this mail box.  😀

Notification_7

*Credit to Jaycon System for the Arduino Email Library file.

Buy

, , , ,

Related Post

Getting Started with IR Distance Click

ESPresso Lite V2 with AT Firmware

Control and Monitor via SMS Part 2

SoftwareSerial conflicting with Servo interrupt

Leave a Reply

Your email address will not be published. Required fields are marked *