Call & SMS using GSM Module & Arduino
In this post, we will learn how to make a Call & SMS using GSM Module & Arduino. This is a Simple Homemade Phone using GSM Module and Arduino. This simple phone is capable of calling to another number as well as receiving an incoming call. Similarly, it can also be used to send an SMS as well as read a received SMS.
So we have interfaced GSM Module SIM800/SIM900 with Arduino UNO Board. A 16×2 LCD is used for displaying the operations that are happening like displaying signal strength, carrier name, incoming or outgoing call, SMS sent received status, and also time elapsed. The 4×4 Keypad is used to enter the number or type an SMS text using the alphanumeric keyboard. The mic is used to transmit the spoken sound and a speaker is used for ringing and listening to incoming calls/voice.
You can check the advance version of this project here: Nextion Display Based Mobile Phone using GSM & Arduino
This simple homemade phone can be useful for final year projects and also for understanding the functioning of the GSM module using some AT Commands functions. The components can be purchased from the link given below. All the circuit diagram connections, as well as every explanation, is included below.
You can check one of our earlier project based on GSM Module: Gas Leakage Detector with SMS Alert using GSM Module & Arduino
Bill of Materials
Following are the list of components required for the project: Simple Homemade Phone- Call & SMS using GSM Module & Arduino
S.N. | Components Name | Quantity | Purchase Links |
---|---|---|---|
1 | Arduino UNO Board | 1 | Amazon | AliExpress |
2 | SIM800/900 GSM Module | 1 | Amazon | AliExpress |
3 | 16x2 LCD Display | 1 | Amazon | AliExpress |
4 | Potentiometer 10K | 1 | Amazon | AliExpress |
5 | 4x4 Keypad | 1 | Amazon | AliExpress |
6 | Speaker 8-ohm 0.2 Watt | 1 | Amazon | AliExpress |
7 | Condenser Mic | 1 | Amazon | AliExpress |
8 | 5V DC Power Supply | 1 | Amazon | AliExpress |
9 | 12V DC Power Supply | 1 | Amazon | AliExpress |
10 | Connecting Wires | 20 | Amazon | AliExpress |
11 | Breadboard | 1 | Amazon | AliExpress |
SIM800 GSM Module
Description
SIM800 is a quad-band GSM/GPRS module designed for the global market. It works on frequencies GSM 850MHz, EGSM 900MHz, DCS 1800MHz, and PCS 1900MHz. SIM800 features GPRS multi-slot class 12/ class 10 (optional) and supports the GPRS coding schemes CS-1, CS-2, CS-3 and CS-4. With a tiny configuration of 24243mm, SIM800 can meet almost all the space requirements in users’ applications, such as M2M, smartphone, PDA, and other mobile devices.
SIM800 has 68 SMT pads and provides all hardware interfaces between the module and customers’ boards. SIM800 is designed with a power-saving technique so that the current consumption is as low as 1.2mA in sleep mode. SIM800 integrates TCP/IP protocol and extended TCP/IP AT commands which are very useful for data transfer applications.
Features
• Support up to 552 Keypads.
• One full function UART port, and can be configured to two independent serial ports.
• One USB port can be used as debugging and firmware upgrading.
• Audio channels which include a microphone input and a receiver output.
• Programmable general-purpose input and output.
• One SIM card interface.
• Support Bluetooth function.
• Support one PWM.
• PCM/SPI/SD card interface, only one function can be accessed synchronously.
• Power supply 3.4V ~ 4.4V
• Typical power consumption in sleep mode is 1.2mA
• Frequency bands GPRS multi-slot class 12
• Support SIM card: 1.8V, 3V
• Serial Port: Can be used for AT commands for data stream
• USB Port: Can be used as debugging and firmware upgrading
Circuit Diagram & Connections:
Assemble the circuit as shown in the figure above. Connect SIM800/SIM900 Module to Arduino digital pin 2 & 3. Similarly connect the 16×2 LCD to Arduino analog pins A0, A1, A2, A3, A4, A5. Similarly connect 4×4 Keypad to Arduino digital pins 11, 10, 9, 8, 7, 6, 5, 4. The speaker and microphone need to be connected to the GSM Module.
Circuit Operations & Working:
Arduino UNO with a GSM shield is used to perform four cellular operations. These are
1. Make calls
2. Receive calls
3. Send SMS
4. Receive SMS
We interface Arduino with GSM shield using AT commands. So, take an overview of some commonly used AT commands:
1. AT: Test whether GSM shield respond
2. AT+CIMI: Request International Mobile Subscriber Identity
3. ATD+91XXXXXXXXXX: Dial the specified number ( replace x with the number)
4. AT+CMG=1: Switch on the messaging mode of gsm
5. AT+CNMI=2,2,0,0, 0: Turn on the message indicator
6. ATH: Halt call
7. ATA: Pick up an incoming call
8. AT+COPS: Get the service provider name
9. AT+CSQ: Get the signal strength
How to Send/Receive Call & SMS?
To Send Call
By pressing button ‘A’ you will be in Send call mode. LCD will prompt you to enter a number to call.
These buttons are used in send call mode
1 2 3 |
‘D’:used to cancel calling operation ‘*’:used to delete a printed digit ‘#’: Call on the dialed number |
To Send SMS
Press ‘B’ key for configuring shield in send message mode. ‘Enter number’ will be prompted by your LCD. You need to enter a 10 digit number
1 2 3 4 |
These buttons are also used in Send message mode. ‘D’: Used to cancel the sending operation ‘*’: Used to delete a printed digit ‘#’: Send SMS on the dialed number |
To Receive Call & SMS
Module configures itself in receiving mode when it starts and the LCD will show a response as soon as a call or SMS is received. The program uses only two buttons for user interaction in case of response received.
1 2 |
‘*’: used to show the received SMS/ Pick up Call. ‘#: used to halt or terminate message / terminate incoming Call |
Source Code/Program:
The code for making Call & SMS using GSM Module & Arduino is given below. The code is developed by Agam Tyagi. The full code credit goes to him and Mr. Devvrat Arya as well as Mr. Harsha Deva Boley Shetty.
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 |
#include <SoftwareSerial.h> #include<String.h> #include <LiquidCrystal.h> SoftwareSerial mySerial(2,3); // These pins are connected to GSM module( RX, TX ) LiquidCrystal lcd(14, 15, 16, 17, 18, 19); // These are connected to LCD pins (RS, EN, D4 ,D5, D6, D7 ) respectively, Vdd-5V, Vss & R/W -GND String number= ""; String action= "WT"; //String codes: RC =Receive call, RM= Receive msg, SC= Send calll, SM= Send message, WT= Wait // Receive sms Strings String Response =""; String sms=""; String Type; String Caller_id; String Text; String SP_name=""; char character; char quote= 0x22; // Global Flags bool Send_m=false; bool sms_Receive_mode_off=true; bool Receive_mode=false; bool msg_Receive=false; bool time_registered=false; bool msg_fetched=false; bool on_call=false; bool start_Receive=false; bool flag=true; int sec,minutes; // Clock variables long c_start; long c_time; int i=0; int indexOfQuotes[10]; double time_start; double time_current; double operational_time; /********* Keypad Variables**********/ int r1=11; int r2=10; int r3=9; int r4=8; int c1=7; int c2=6; int c3=5; int c4=4; int colm1; int colm2; int colm3; int colm4; char value; // char num1; void setup() { Serial.begin(9600); Serial.println("GSM startrd"); mySerial.begin(9600); mySerial.setTimeout(2000); Serial.setTimeout(2000); initilise(); lcd.begin(16, 2); get_SP(); } void loop() { Serial.println("Action: "+ action); //Reports it current mode of working while(action=="WT") // Its wait for SMS and Calls in this loop { if(sms_Receive_mode_off) //So, This turns on the SMS recieve mode { delay(1000); On_sms_Receive_mode(); } if(flag) { Serial.println("Receive_ready"); flag=false; print_head("Connected to:"); // Service provide name is printed on LCd print_content(SP_name); clear_Serial(); } if(Receiving_on()) // FINALLY, the module is set to receive, Receive_on will beocome true in case msg or call arrives { Extract_type(); } else { // In case of no reciving, update the current signal strength update_signal_strength(); get_request(); // Or, check if user pressed any button for callling or SMS } } while(action=="SM") // Sending Msg action { Serial.println("Enter number to message"); print_head("Send SMS to"); number= Take_input(); // Take input through swith matrix //LCD print for Send message bool success = send_sms(number); if(success) // If sucessful go to wait state otherwise send again { action="WT"; } flag=true; } while(action=="SC") //Sending call action, similar process as above { print_head("Enter Call num"); Serial.println("Enter number to call"); number = Take_input(); if (valid_number()) // Check number is 10 digit long { print_head("Calling"); print_content(number); delay(1000); send_call(number); print_head("On line with"); print_content(number); delay(1000); clear_Serial(); if(on_call) {terminate_call();} // Waits here till the user is on call } action="WT"; flag=true; } while(action=="RC") // Recive call action { Serial.println("Press * to pick up or # to terminate"); print_head("Call from"); print_content(Caller_id); clear_Serial(); WaitForPickup(); //incall if(on_call) // Waits here till the user is on call {terminate_call();} Serial.println("Call response Recieved"); action="WT"; flag=true; } while(action=="RM") // Recieve SMS action { Show_sms(); action="WT"; flag=true; } } /* * Function to get the service provider(SP) name * Sets a Global varible: SP_name */ void get_SP (void) { bool got_it=false; delay(1000); mySerial.println("AT"); delay(500); print_head("Connecting GSM"); while(!( SP_name.indexOf('"')>0)) { if(GSM_operational()) { mySerial.println("AT+COPS?"); //AT command for getting serivce provider name mySerial.println(); } delay(1000); while(mySerial.available()) { char character=mySerial.read(); SP_name.concat(character); } } // Extracton process SP_name= (SP_name.substring(SP_name.indexOf('"')+1,SP_name.lastIndexOf('"'))); Serial.println("Connected to: "+ SP_name); } // Fuciton to print current signal strength on lcd void update_signal_strength (void) { String Network; long Strength; mySerial.println("AT+CSQ"); mySerial.println(); delay(500); while(mySerial.available()) { char character=mySerial.read(); Network.concat(character); } Network=Network.substring(Network.indexOf(':')+2,Network.indexOf(',')); Strength= Network.toInt(); // Strength Int value here Strength=(Strength*100/31); // MAX strength= 31 lcd.setCursor(13,2); lcd.print(int(Strength)); lcd.print('%'); } //It recives a the char value of key pressed and stores it into void get_request (void) { value=Return_Keypad_Values(); event(value); } // Select the apt mode as per the input void event(char func) { switch (func) { case 'A': action="SC"; //Send call break; case 'B': action="SM"; // Send Message break; case 'C': action="RC"; // Receive Call break; default: action="WT"; // Wait for response break; } } /* * Input: (string:num,) * Output bool( t=sent f=unsent) * Function to send sms to number */ bool send_sms (String number) { delay(1000); mySerial.println("AT"); delay(500); if(GSM_operational()) { mySerial.println("AT+CMGF=1"); delay(500); } if(GSM_operational()) { mySerial.print("AT+CMGS=\""); // Send the SMS number mySerial.print(number); mySerial.println("\""); delay(1000); mySerial.print("GSM bot functonal"); // SMS BODY here in case u want change // mySerial.print(i); delay(500); mySerial.write(0x1A); mySerial.write(0x0D); mySerial.write(0x0A); Serial.println("SMS sent"); print_head("SMS Sent to"); print_content(number); delay(2000); return(true); //SMS sent succussfuly } return(false); // Failed attempt } /* * Input: (string:num,) * Output bool( t=sent f=failed) * Function to send call to number */ bool send_call (String number) { mySerial.println("AT"); delay(500); if(GSM_operational()) { //Number dialing Serial.println("Calling to :" +number); print_head("Calling to"); print_content(number); mySerial.println("ATD"+ number +";"); // AT command for dialing up the number mySerial.println(); on_call=true; return(true); } return(false); } // This is to switch on the messaging mode of Gsm void On_sms_Receive_mode (void) { mySerial.print("ATE0"); delay(500); if(GSM_operational()) mySerial.print("AT"); delay(500); if(GSM_operational()) mySerial.print("AT+CMGF=1"); // Setup in msging mode delay(500); if (GSM_operational()) { mySerial.print("AT+CNMI=2,2,0,0,0\r" ); //Prints the msg on serial as soon as it arrives delay(500); while(mySerial.available()) { char response = mySerial.read(); Serial.println(response); } Serial.println("Receive mode On"); sms_Receive_mode_off=false; //turn it on off } } /* * Input: none * Output: True: A response( call or sms) incoming, Or false * */ bool Receiving_on (void) { bool Response_available=false; if(mySerial.available()) { while(!halt_fetch()) //In case of incoming recieve until halt_fetch() gives true { while(mySerial.available()) { if(!time_registered) //Capture the time of start of message receiving { time_start=millis(); time_registered=true; } char character=mySerial.read(); Response.concat(character); Serial.print(character); // Store as a string } } Serial.println("Response Received"); //Looks like we got something Response_available=true; msg_fetched=false; flag=true; } return (Response_available); } /* *The function is created to halt or to indicate the end of receiving *It does that by a timeout of 3sec or Response Text limit of 500 characters *Input: none *Output: Boolean, T= halt fetching F= Wait for message */ bool halt_fetch (void) { bool halt=false; if(time_registered) { time_current=millis(); operational_time=time_current-time_start; } if(operational_time>3000 || Response.length()==200 ) // Halt condition { halt=true; operational_time=0; } return halt; } /* * It extracts the Response and caller id * It does that by quotes position. * Caller id is between first and second quotes * While, Text message is after last quotes */ void Extract_type (void) { if(valid_input()) { Serial.println("Valid respone"); extract(); Serial.println(Response); //In case u want to see everything incoming Serial.println("Type: "); Serial.print(Type); Serial.println("Caller id : "); Serial.println(Caller_id); Serial.println("Text: "); Serial.println(Text); callORsms(); Serial.print(Caller_id); } time_registered=false; Response=""; //Clear string for refresh incoming } /* * Checks the validity condition, * True: Its call or msg Resonse * False: it is some junk */ bool valid_input (void) { bool validity; validity=(( Response.indexOf('+') > 0) && (Response.indexOf('"')>0 )); //If the reponse has these two thing that means it is a 'real' response if(!validity) { Serial.println("invalid input"); } return (validity); } // Find the indexes of all the quotes in the stirng and sets them up in gloablevariable: indexOfQuotes[index] void extract(void) { int Length,i,index=0; Length=Response.length(); for(i=0;i<=Length;i++) { if(Response.charAt(i)==quote) { indexOfQuotes[index]=i; index++; } } Type=Response.substring(1,indexOfQuotes[0]); Caller_id=Response.substring(indexOfQuotes[0]+1,indexOfQuotes[1]); Text=Response.substring(indexOfQuotes[5]+3); Serial.println("Extracted"); } // Determine weather the response is of call or sms void callORsms (void) { if( Type.indexOf("LIP")>0) //Call string consist this( +CLIP) { action="RC"; Serial.println("Call from: ");} else if(Type.indexOf("MT")>0 ) // Msg stirng consist (+CMT) { action="RM"; Serial.println("Message from: ");} } // Waits till customer press * or # void WaitForPickup (void) { char key; bool user_wait = true; //default state while(user_wait) { user_wait=check_termination(); key=Return_Keypad_Values(); if(key=='*') //picking up reponse { mySerial.println("ATA"); mySerial.println(); Serial.println("Call picked up"); print_head("Call picked up"); print_content(Caller_id); delay(1000); user_wait=false; on_call=true; } if(key=='#') //Termination action { mySerial.println("ATH"); mySerial.println(); Serial.println("Call Terminated"); print_head("Call Terminated"); delay(1000); print_content(Caller_id); on_call=false; user_wait=false; } } } /* * This function is used after two user get connected on a call * It waits '#' to terminate or 'NO CARRIER' on serial monitor * It updates clock untill waiting * */ void terminate_call (void) { char key; bool user_wait = true; //default state start_clock(); while(user_wait) { user_wait=check_termination(); key=Return_Keypad_Values(); if(key=='#') { mySerial.println("ATH"); //Termination action mySerial.println(); Serial.println("Call Terminated"); print_head("Call Terminated"); delay(1000); print_content(Caller_id); user_wait=false; } else { update_clock(); } } on_call=false; } // Function to start a clock void start_clock (void) { lcd.clear(); c_start=millis(); sec=0; minutes=0; lcd.print("On call"); } // Function to update the value as arduino internal clock void update_clock (void) { long current= millis(); if(current-c_start>1000) { sec++; c_start=current; } if(sec>59) { minutes++; sec=-0; } lcd.setCursor(0,1); if(minutes<10) {lcd.print('0');} lcd.print(minutes); lcd.print(':'); if(sec<10) {lcd.print('0');} lcd.print(sec); } // Fuction to Show sms on a LCD void Show_sms (void) { print_head("SMS from"); print_content(Caller_id); char key; // Enhance modularity bool user_wait = true; while(user_wait) {key=Return_Keypad_Values(); if(key=='*') { print_head(Text.substring(0,16)); // This can scroll SMS print_content(Text.substring(16,32)); delay(2000); print_head(Text.substring(16,32)); print_content(Text.substring(32,48)); delay(2000); //A scroll fuction can be made Serial.println(Text); user_wait=false; } if(key=='#') { print_head("OK"); Serial.println("MSG Terminated"); delay(500); user_wait=false; } } } //True if starkey is pressed bool Starkey_pressed (void) { char key; key=Return_Keypad_Values(); return (key=='*'); } //True if Hashkey is pressed bool Hashkey_pressed (void) { char key; key=Return_Keypad_Values(); return (key=='#'); } //Check if 'NO CARRIER' is printer on Serial monitor bool check_termination (void) { bool check=true; String listen_no=""; while(mySerial.available()) { char data= mySerial.read(); Serial.print(data); listen_no.concat(data); } if(listen_no.indexOf("CAR")>0) // I check for only CAR { check=false; } return check; } // A Fuciton to check the lenth of number calling should be 10 + ('+91' country code) =13 bool valid_number (void) { bool valid=false; if(number.length()==13) // condition here {valid=true;} else {print_head("Invalid input"); delay(1000); } return valid; } //Essential command to determine the state of GSM module bool GSM_operational(void) { int count =0; bool Status=false; mySerial.println(); while(1) { if (mySerial.available()>0) { char data = mySerial.read(); if( data == 'O' || data == 'K') //Its working properly { Serial.println("OK"); Status=true; break; } if( data == 'E' || data == 'R' || data== 'O') // Working yet busy with some thing else { Serial.println("GSM not functional"); Status=false; break; } } count++; delay(10); if (count == 100) { Serial.println("GSM not connected"); // No reponse for AT commands Status=false; break; } } return Status; } void clear_Serial (void) { while(mySerial.available()) { char character=mySerial.read(); Serial.print(character); } } /************************************************************* * Keypad Firmware Ahead * *************************************************************/ /* * input: none * Output: A 13 digit number * Waits till user enter a ten Digit number */ String Take_input (void) { String num="+91"; int len=0; int len2; while (len <= 13) { len=num.length(); num1=Return_Keypad_Values(); if ((num1!='A')&&(num1!='B')&&(num1!='C')&&(num1!='a')) { if ((num1!='#') && (num1!='*') && (num1!='D')) {num+=String(num1); print_content(num); Serial.println(num); } else if (num1=='*') { num.setCharAt(len-1,'*'); print_content(num); num.remove(len-1); } else if (num1=='#') { Serial.println(num); break; } else if(num1=='D') { break; } } } return num; } void initilise() { pinMode(r1,OUTPUT); pinMode(r2,OUTPUT); pinMode(r3,OUTPUT); //use in setup pinMode(r4,OUTPUT); pinMode(c1,INPUT); pinMode(c2,INPUT); pinMode(c3,INPUT); pinMode(c4,INPUT); Serial.begin(9600); digitalWrite(c1,HIGH); digitalWrite(c2,HIGH); digitalWrite(c3,HIGH); digitalWrite(c4,HIGH); } void row1() { digitalWrite(r1,LOW); digitalWrite(r2,HIGH); digitalWrite(r3,HIGH); digitalWrite(r4,HIGH); } void row2() { digitalWrite(r1,HIGH); digitalWrite(r2,LOW); digitalWrite(r3,HIGH); digitalWrite(r4,HIGH); } void row3() { digitalWrite(r1,HIGH); digitalWrite(r2,HIGH); digitalWrite(r3,LOW); digitalWrite(r4,HIGH); } void row4() { digitalWrite(r1,HIGH); digitalWrite(r2,HIGH); digitalWrite(r3,HIGH); digitalWrite(r4,LOW); } void ReadRows() { colm1=digitalRead(c1); colm2=digitalRead(c2); colm3=digitalRead(c3); colm4=digitalRead(c4); } char Return_Keypad_Values(void) { row1(); ReadRows(); delay(100); if(colm1==LOW) { Serial.println("1"); delay(200); return '1'; } else if(colm2==LOW) { Serial.println("2"); delay(200); return '2'; } else if(colm3==LOW) { Serial.println("3"); delay(200); return '3'; } else if(colm4==LOW) { Serial.println("A"); delay(200); return 'A'; } row2(); ReadRows(); delay(100); if(colm1==LOW) { Serial.println("4"); delay(200); return '4'; } else if(colm2==LOW) { Serial.println("5"); delay(200); return '5'; } else if(colm3==LOW) { Serial.println("6"); delay(200); return '6'; } else if(colm4==LOW) { Serial.println("B"); delay(200); return 'B'; } row3(); ReadRows(); delay(100); if(colm1==LOW) { Serial.println("7"); delay(200); return '7'; } else if(colm2==LOW) { Serial.println("8"); delay(200); return '8'; } else if(colm3==LOW) { Serial.println("9"); delay(200); return '9'; } else if(colm4==LOW) { Serial.println("C"); delay(200); return 'C'; } row4(); ReadRows(); delay(100); if(colm1==LOW) { Serial.println("*"); delay(200); return '*'; } else if(colm2==LOW) { Serial.println("0"); delay(200); return '0'; } else if(colm3==LOW) { Serial.println("#"); delay(200); return '#'; } else if(colm4==LOW) { Serial.println("D"); delay(200); return 'D'; } return 'a'; } /************************************************************* * LCD functions Ahead * *************************************************************/ //Print out the Heading On lCD void print_head (String str) { lcd.clear(); lcd.setCursor(0,0); lcd.print(str); } //Print secondary content on LCD void print_content (String str) { lcd.setCursor(0,1); lcd.print(str); } |
3 Comments
Hey, nice project. I rebuild it but my Sim900 modul seem to doesnt respond to at commands. you have any ideas for trouble shooting?
I have a question. I am trying to build a scheme diagram for this project, but I couldn’t find the SIM800 GSM Module in Fritzing. Could you please help me out and tell me how were you able to find the part?
hi, i’m also interested of doing this kind of project. Can you be contacted for this stuff to provide technical help?