Receive SMS with AT Commands using Sim900 and Arduino

Update: I have updated the code and removed the bug. Thanks for informing. Now this code will work perfectly.

Buy This Project

Hello friends, hope you all are fine and having good health. Today, as the name suggests, I am gonna post on how to Receive SMS with AT Commands using Sim900 and Arduino. I have already posted a tutorial on How to Send SMS with Arduino UNO and Sim900, so now we are gonna check the opposite. Sending SMS is quite easy, you just need to write some AT commands and write the message you wanna send and hit the Cntrl + Z and it will be sent. But receiving a text message on your SIM900 shield is a bit difficult because now you need to place a check when user will send a message. So, ideally whenever anyone send a message to your SIM900 module, you should get notified. Today, we are gonna cover this how to receive SMS with AT Commands in detail.

Now, after you get notified, there's a need to read the message as well and also who has sent this message. So, we are also gonna cover it today. So, first of all we will place a check that whenever someone sends a message to our SIM900 module, we get notified and after that we will extract the message and the mobile number of sender. We have designed this code after a lot of effort that's why this code isn't free but we haven't placed a very small amount of $20 so that engineering students can also buy it easily. We can also interface our GSM board with other microcontrollers like PIC Microcontroller as well as 8051 Microcontroller. I have also posted tutorial on How to Receive SMS with SIM900 & PIC Microcontroller and How to Send SMS with PIC Microcontroller so if you are working on PIC Microcontroller then you must give it a look. So, let's get started with How to receive SMS with AT Commands using SIM900 and Arduino.

You must also check GSM Library for Proteus, using this library you can easily simulate your GSM module in Proteus ISIS. Moreover, also have a look at Send SMS with Sim900D in Proteus ISIS in which I have designed a simulation of sms sending in Proteus ISIS.

Receive SMS with AT Commands using Sim900 and Arduino

  • There are many GSM modules available in the market so it doesn't matter which one you are using unless its having SIM900 module in it.
  • I have explained in my previous post that all GSM modules work on AT commands, so here first of all we are gonna have a look on AT commands we are gonna use for receiving the SMS.
  1. ATE0 - IT is used to turn off the Echo of GSM shield.
  2. AT - Just to check that your GSM module is working fine.
  3. AT + CMGF = 1 - This command will convert the message style to text. In other words we are telling our shield that we are expecting a text message.
  4. AT+CNMI=1,2,0,0,0 - This command will alert our GSM shield and now whenever it will receive message, it will automatically send an alert on the serial port.
  • We are gonna use these four commands in our code and we will be able to receive text message on the GSM shield.
  • Remember we have to put Enter after each of the above AT commands in order to execute it.
  • Below is the first phase of the code and as you can see in this code we are simply sending these four commands serially from arduino to GSM shield.
  • These are two functions I have shown below, the first function is Config() which is simply sending the commands via serially and then the Response() function which is called after every AT command and is receiving the response of that AT command.
  • So, here's the partial code for How to Receive SMS with AT Commands using Sim900 and Arduino.
void Config()
{
delay(1000);
Serial.print("ATE0r");
Response();
Serial.print("ATr");
Response();
Serial.print("AT+CMGF=1r");
Response();
Serial.print("AT+CNMI=1,2,0,0,0r");
Response();
}

void Response()
{
int count = 0;
Serial.println();
while(1)
{
if(Serial.available())
{
char data =Serial.read();
if(data == 'K'){Serial.println("OK");break;}
if(data == 'R'){Serial.println("GSM Not Working");break;}
}
count++;
delay(10);
if(count == 1000){Serial.println("GSM not Found");break;}

}
}
  • The response of these commands is shown below on the Serial Monitor of Arduino.
  • For each AT command, we get a response "OK" from the GSM shield.
  • Now, I know that I have sent all these four AT commands and my GSM shield is ready to receive the text messages and will inform me.
  • So, when you send a message to your GSM shield, it will give a notification as shown in the below figure:
  • Each message received by SIM900 module is start with "+CMT" and after that it has the mobile number of the sender and at the end lies the body of the message, which in our message is "www.TheEngineeringProjects.com"
  • So now let's extract this mobile number and the text body from this CMT string.

Getting the SMS Text & Sender Mobile Number

  • Till now we have learnt How to Receive SMS with AT Commands using Sim900 and Arduino and send you notification over the serial monitor.
  • Now we have to place some checks in our code so that we could be able to get the required data out of this string.
  • In order to do so, I am gonna first save this CMT string into an array, which I named as RcvdMsg[index].
  • But before saving the data into this string, first I need to make sure that I am actually getting the requried string, that's aso possible that I am receving some garbage values.
  • So, I placed a check first, which is checking for these four characters "+CMT", and when I got these character on my serial terminal I got sure that I have the string ready so I made the index = 0 and starting receving the string.
  • Next thing I need to do is make sure that I have got the complete string, that was really a tricky part as there's no end character in the string.
  • So, I used "n" null character for that. If you check the string then you can see that we are getting two null characters in complete string.
  • I placed this check that when I get 2 null characters means I have got the complete string so I stopped receving the string.
  • After that I simply count the charaters, in my string the sender mobile number is at posting 4 to 16 so I made a loop and save it in another array. and similarly did for the message text.
  • Now when I send message after uploading this final code into my Arduino board, I get the below result on my Serial Monitor.
  • Isn't it cool :) So, now we have separated the complete text as well as the sender's mobile number from our GSM string and we can use it anywhere we want.
  • We can use this mobile number in the previous post code and can reply some text back and can also give a missed call to the user, anything we want. I am gonna post on How to send a call using SIM900 in the next post.
  • You can buy the codefor How to Receive SMS with AT Commands using Sim900 and Arduino from our shop by clicking the below button:
Buy This Project
  • I have highlighted all the functions in the code.
  • As I always say, understand it first and then write on your own and do mistakes so that you learn.
That's all for today. I hope you have enjoyed this project named Receive SMS with AT Commands using Sim900 and Arduino. I will meet you guys in the next post. Till then have fun !!! :)

Circuit Designing of LCD with Arduino in Proteus ISIS

Hello friends, I hope you all are doing great. Today, I am going to share Circuit Designing of LCD with Arduino in Proteus ISIS. In my previous tutorial, I have posted a tutorial on How to use Arduino Library in Proteus. Using that library, we can easily test Arduino code in Proteus to check whether its working or not. If you haven't read that post then before starting it, first read it, as without adding the arduino library we can't use Arduino in Proteus.

Coming to today's post, as we have done adding the Arduino Library in Proteus, so I thought to do some projects on it and the first one I chose is quite simple one i.e. Circuit Designing of LCD with Arduino in Proteus ISIS. So we will have a look on how to show some characters on LCD using Arduino in Proteus. If you are working on LCD then you should also have a look at my new post Scrolling Text on LCD using Arduino. Let's get started with Circuit Designing of LCD with Arduino in Proteus ISIS:

Circuit Designing of LCD with Arduino in Proteus ISIS

  • First of all, design a circuit of LCD and Arduino in Proteus ISIS, if you have already added the Arduino Library then you won't find any problem in finding the Arduino in components library of Proteus.
  • You should also download this New LCD Library for Proteus.
  • Design the circuit as shown in below figure:
  • Now, we need to design Arduino sketch for LCD, so open Arduino software and place below code into it.
  • You should have a look at How to get Hex File from Arduino.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{

lcd.begin(16, 2);
lcd.print("www.TheEngineer");
lcd.setCursor(0,1);
lcd.print("ingProjects.com");
}
void loop() {}
Note:
  • For Arduino code, I have used Liquid Crystal Arduino Library, which you can download from the below link and add it in the libraries folder of Arduino software.

Download LiquidCrystal Arduio Library

  • If you haven’t bought your Arduino UNO and LCD yet, then you can buy it from this reliable source:

  • Now compile the code, and get the Arduino hex file which will be in the tmp folder, you can read Arduino Library for Proteus to know in detail how to get the hex file of Arduino sketch.
  • Now double click the Arduino in Proteus ISIS and properties window will pop up.
  • In properties panel, under the Program File section, browse to Arduino hex file as shown in below figure and upload it.
  • Now click Ok and Run your simulation, if everything goes fine then your LCD will start showing the characters as shown in below figure:
  • You should also have a look at these Arduino Projects for Beginners.
  • That's all, was it difficult ??? I dont think so :) Anyways, if you got into any trouble, do ask in comments.
  • In the coming posts, we will explore Arduino in Proteus ISIS more. Till then take care !!!

Training Error: Recognition Failed in EasyVR

Hello friends, hope you all are fine and enjoying life. Today's post is about removing a small error named as Recognition Failed in EasyVR, which I encountered while working with EasyVR shield with Arduino UNO. I have posted a complete project on EasyVR shield around a year ago in which I haven't mentioned this error because at that time I didn't encountered it. But today while working with EasyVR shield, I encountered this problem so I thought to share it with you guys.

EasyVR shield is a voice recognition module which is used for recognizing voices and operating accordingly. Using this module, one ca quite easily control anything using voice. In the previous project, I have controlled a robot using voice commands like when I say Forward then it starts moving forward, when I say REVERSE then it start moving backward and so on. So, its quite a cool feature to be added in projects but its not the perfect one as the efficiency of this module is not even 50%, if you are operating in a noise environment then it won't work as you want it to work.So ,let's get started with How to solve Training Error: Recognition Failed in EasyVR.

Training Error: Recognition Failed in EasyVR

  • First of all, I connected my EasyVR with Arduino UNO and run the EasyVR Commander.
  • I selected the Com Port of my Arduino UNO and hit Connect.
  • After that, I added a new command in EasyVR Commander and hit Train Command and it asked for Phase 1.
  • Everything was working perfect but when I train my command i.e. said the word which I wanted to save in the command, I got the error written as "Training Error: Recognition Failed", shown in below figure:
  • I tried again and again to train the command but the error keeps on continuing, which creates quite a problem for me.
  • So, below are the steps, which I have taken in order to remove this error, its kind of a troubleshooting which is quite important to learn for an engineer.

How to solve Training Error: Recognition Failed in easyvr

  • First of all, what you need to check is whether your EasyVR shield is working or not, which I did exactly. So, I remove the EasyVR shield from the Arduino UNO and upload a sketch in Arduino UNO. The sketch I uploaded in Arduino UNO is the test EasyVR sketch comes with the EasyVR library.
  • After uploading the sketch, I connected my EasyVR shield with Arduino UNO and check its output and I got a sigh of relief that my EasyVR shield is working fine, so there's no problem with EasyVR.
  • Now I again opened the EasyVR commander and this time I placed the J12 jumper no SW instead of PC, and start the training procedure and I was like surprised, it worked great.
  • I think the new versions of EasyVR shield doesn't need the jumper to be on PC for training mode.
  • In the project, I have mentioned it that place the Jumper J12 on PC while working with EasyVR Commander and place it on SW while working with Arduino UNO, which is now not applicable for the new version of EasyVR.
  • So, simply, place your jumper J12 on SW position and it will work smoothly.
Note:
  • EasyVR shield doesn't give the 100% result, it got impressed by the noise in the surroundings very quickly so whenever you are using EasyVR shield, make sure that you use it in a calm place. I even turn off my fan in order to make it work properly.
Finally, after resolving this issue, I trained five commands into it for moving a robot, which are shown below:
  • That's all for today, hope it will help you guys in some way. Thanks !!!

Send SMS with Arduino UNO and SIM900D using AT Commands

Hello friends, today's post as the name suggests is about how to send SMS with Arduino UNO and SIM900D using AT Commands. There are different types of SIM900D modules available in the market, so it doesn't matter which module you are using. All SIM900D modules work at AT commands basically so today I am going to show you how to send an SMS via AT commands without using any Arduino library. You should first read the AT commands manual which will give you an idea about AT commands. AT commands are special sets of commands which are used for communicating with SIM900 module. Using these AT commands we let our GSM work for us. Like if you want to send SMS then there's a specific AT command for sending the SMS similarly if you want to change the PIN code for your GSM module then you have a different AT command. So, there are lots of AT commands available. We can interface this GSM module with any microcontroller like PIC Microcontroller or 8051 Microcontroller but here I have interfaced it with an Arduino board. You should also check How to Send SMS with PIC Microcontroller if you wanna use PIC Microcontroller instead of Arduino board.

You must also check GSM Library for Proteus, using this library you can easily simulate your GSM module in Proteus ISIS. Moreover, also have a look at Send SMS with Sim900D in Proteus ISIS in which I have designed a simulation of SMS sending in Proteus ISIS.

Note:

Where To Buy?
No.ComponentsDistributorLink To Buy
1SIM900AmazonBuy Now
2Arduino UnoAmazonBuy Now

Components Used

I have shared the list of components used in this project. I am giving a comparison of three vendors below, you can buy from any of them:
Components List Amazon Ali Express
Give Your Suggestions !!!
Arduino UNO R3 Click Here to Buy Price: $10.99 Click Here to Buy Price: $2.79
GSM Module Sim900 Click Here to Buy Price: $28.99 Click Here to Buy Price: $10

Connect Arduino UNO with SIM900D

  • First of all, connect Arduino UNO with SIM900D module, which isn't much difficult. If you have the module in hand then the first thing you need to do is to power it up and wait for the module to get connected.
  • Usually, an LED is placed on the SIM900D module which keeps on blinking. If it's blinking fast, it means the modules haven't yet captured the signal. When the module captures the signal then the LED keeps on blinking but at lower speed.
  • Now find the TX and RX pins of your SIM900D module and connect the TX of module with RX of Arduino UNO, which is pin # 0 and similarly RX of module with TX of Arduino UNO, which is pin # 1.
  • The module, which I have used for my project is shown in the below figure, with labelled pin configurations and if you want to buy it in Pakistan then click here.
  • One other thing mentioned in above figure is pKey, connect it with ground.
  • Once your connections are ready, then upload the below sketch in your Arduino UNO and start sending messages.
    void setup()
    {
    Serial.begin(9600);
    }
    void loop()
    {
    delay(1200);
    Serial.print("AT");
    delay(1200);
    bool bOK = false;
    while (Serial.available() > 0)
    {
    char inChar = (char)Serial.read();
    bOK = true;
    }

    if(bOK)
    {
    index = 0;
    Serial.println();
    Serial.println("AT+CMGF=1"); // sets the SMS mode to text
    delay(100);
    delay(1200);
    bool bOK = false;
    while (Serial.available() > 0) {
    //Serial.write(Serial.read());
    char inChar = (char)Serial.read();
    bOK = true;
    }
    if(bOK)
    {
    Serial.println();
    Serial.print("AT+CMGS=""); // send the SMS number
    Serial.print("+923004772379");
    Serial.println(""");
    delay(1000);
    Serial.print("A new post is created by Zain."); // SMS body

    delay(500);

    Serial.write(0x1A);
    Serial.write(0x0D);
    Serial.write(0x0A);

    }
    }
    }
  • Change the mobile number with the number, on which you want to send the SMS, I have written mine.
  • You should also change the body of the SMS and can write anything you wanna send as an SMS.
  • The AT commands are required to send the SMS. I have added the comments in front of these commands but still if you get into any trouble, ask in comments.
  • That's all for today, in the coming post, we will have a look how to receive SMS with SIM900 and Arduino.

Interfacing of EasyVR with Arduino

Hello friends, I hope you all are fine and having fun with your lives. In today's post we are gonna see Interfacing of EasyVR with Arduino UNO. In the previous post, we have seen Getting Started with EasyVR Commander. It was quite simple and if you follow the steps carefully you wont stuck anywhere but still if you into some trouble i am here.

Now this tutorial is quite a quick and important one as it contains the real code using which we will control our robot. After adding the voice commands, now close the EasyVR Commander and open the Arduino Software. Connect the arduino board with computer and double check that your jumper J12 in on position SW. You should also read Training Error: Recognition Failed in EasyVR, if you got such error while working on EasyVR. So, let's get started with Interfacing of EasyVR with Arduino UNO.

Interfacing of EasyVR with Arduino UNO

  • First of all, download the Arduino Libraries for EasyVR Shield, you can easily find them from the official website of EasyVR.
  • Simply connect your Arduino UNO with computer.
  • Open the Arduino Software and copy paste the below code into it.
  • Burn your code in the Arduino Board.
  • Now open your Serial Monitor of ARduino UNO, and you will first see the message saying EasyVR Detected.
  • Now speak any of the command you saved in the board on mic and you will see when the command match the serial terminal will send a specific character.
  • You can change this character if you want to by make a simple change in the code.
#if defined(ARDUINO) && ARDUINO >= 100 #include "Arduino.h" #include "SoftwareSerial.h" SoftwareSerial port(12,13); #else // Arduino 0022 - use modified NewSoftSerial #include "WProgram.h" #include "NewSoftSerial.h" NewSoftSerial port(12,13); #endif #include "EasyVR.h" EasyVR easyvr(port); //Groups and Commands enum Groups { //GROUP_0  = 0, GROUP_1  = 1, }; enum Group0 { G0_ARDUINO = 0, }; enum Group1 { G1_FORWARD = 0, G1_REVERSE = 1, G1_LEFT = 2, G1_RIGHT = 3, G1_STOP = 4, }; EasyVRBridge bridge; int8_t group, idx; void setup() { // bridge mode? if (bridge.check()) { cli(); bridge.loop(0, 1, 12, 13); } // run normally Serial.begin(9600); port.begin(9600); if (!easyvr.detect()) { Serial.println("EasyVR not detected!"); for (;;); } easyvr.setPinOutput(EasyVR::IO1, LOW); Serial.println("EasyVR detected!"); easyvr.setTimeout(5); easyvr.setLanguage(EasyVR::ENGLISH); group = EasyVR::TRIGGER; //&amp;lt;-- start group (customize) pinMode(2, OUTPUT); digitalWrite(2, LOW);    // set the LED off pinMode(3, OUTPUT); digitalWrite(3, LOW); pinMode(4, OUTPUT); digitalWrite(4, LOW); pinMode(5, OUTPUT); digitalWrite(5, LOW); pinMode(6, OUTPUT); digitalWrite(6, LOW); } void action(); void loop() { easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening) Serial.print("Say a command in Group"); Serial.println(group); easyvr.recognizeCommand(group); do { // can do some processing while waiting for a spoken command } while (!easyvr.hasFinished()); easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off idx = easyvr.getWord(); if (idx >= 0) { // built-in trigger (ROBOT) // group = GROUP_X; &amp;lt;-- jump to another group X return; } idx = easyvr.getCommand(); if (idx >= 0) { // print debug message uint8_t train = 0; char name[32]; Serial.print("Command: "); Serial.print(idx); if (easyvr.dumpCommand(group, idx, name, train)) { Serial.print(" = "); Serial.println(name); } else Serial.println(); easyvr.playSound(0, EasyVR::VOL_FULL); // perform some action action(); } else // errors or timeout { if (easyvr.isTimeout()) Serial.println("Timed out, try again..."); int16_t err = easyvr.getError(); if (err >= 0) { Serial.print("Error "); Serial.println(err, HEX); } group = GROUP_1; } } void action() { switch (group) { // case GROUP_0: // switch (idx) //  { //  case G0_ARDUINO: // write your action code here //      group = GROUP_1; //&amp;lt;-- or jump to another group X for composite commands //    break; //  } //  break; case GROUP_1: switch (idx) { case G1_FORWARD: Serial.print("9"); digitalWrite(2, HIGH); break; case G1_REVERSE: Serial.print("Q"); digitalWrite(3,HIGH); break; case G1_LEFT: Serial.print("X"); digitalWrite(4,HIGH); break; case G1_RIGHT: Serial.print("Y"); digitalWrite(5,HIGH); break; case G1_STOP: Serial.print("Z"); digitalWrite(6,HIGH); break; } break; } }
So, that's all for today. I hope now you can easily Interface EasyVR with Arduino UNO. Have fun and take care !!! :)

Getting Started with EasyVR Commander

In the previous post we have seen the project description of Voice Recognition Project using EasyVR shield. Today we will have a look at Getting started with EasyVR commander. EasyVR shield is a module which is used for voice recognition. First of all, we save our commands in the EasyVR shield and then we use these commands to control anything. In this project, I need to control the robot with voice commands like when someone says FORWARD then the robot start moving in forward direction.

Now first of all what I need to do is to save this FORWARD voice in the shield, which we will see today how to save the command in the shield and after that I will show you the Interfacing of EasyVR shield with Arduino UNO. So that when I say Forward the motor start to move in forward direction, which we will see in the next post. When I was working on EasyVR Shield then I got into a problem which was How to solve Training Error: Recognition Failed in EasyVR and I solved it so you should also have a look at this tutorial if you got such error.

What is EasyVR Commander?

  • EasyVR Commander is a software using which we save the voice commands in the EasyVR Shield. You guys can easily find it using google and its totally free.
  • Download this software and install it.

How to use EasyVR Commander?

  • First of all connect your EasyVR shield with the Arduino UNO Shield as shown in below figure.
 
  • Now be careful in this step as it took the most of my time, on EasyVR shield you will find a jumper J12. Put this jumper on position PC.
Note: When you are adding commands in EasyVR shield using EasyVR Commander, then this jumper J12 must be on position PC and when you are using this shield in the circuit with arduino then this jumper J12 must be on position SW.
  • Connect your Arduino UNO shield with the computer and run the software EasyVR commander. The software will open up as shown in the figure below.
  • Now select the COM Port on which Arduino UNO is attached, which in my case was at COM20.
  • After selecting the COM Port, click the Connect icon as shown in below figure.
  •  When you hit on Connect icon, the software will connect to the COM Port and will open up as shown below:
  •  If you check the left pane, there are many groups and wordset.
  • In wordset, there are pre defined words, which are already saved in the EasyVR shield.
  • The words which I want to save in the shield, will be saved in the Groups.
  • Now to save these words click on any group where you want to save.
  • In the below figure, I have selected Group 2 and then click on the Add Command button (Click # 1) shown in the figure.
  • It will add the command in the group as you can see I have saved the command OK.
  • Now I have saved the command OK but I have to give it some voice to this command.
  • In order to do so, click on the Train Command icon ( Click # 2 ).
  •  Now when you click on the Train Command icon, a message box will pop up as shown in below figure.
  • Click on the button which says Phase 1.
  • Now as you click on this button, a box appears which say "speak now", now its the time to say your command in the mic like I said OK.
  • After listening the command this pop up will again show up and this time the button will be Phase 2.
  • Again click on the button and it will ask for "speak now" and you again speak the same command in the mic.
  • After that the software verifies the two words and if they are same it will confirm the command.
  • You should also have a look at these Arduino Projects for Beginners.
  • In my case, I have saved total 5 commands in my software as shown in the below figure.
  • These were my five commands to control my robot.
  • Now after adding the commands, simply close the software as the voice commands are now saved in the EasyVR shield.
  • Place the jumper J12 back to position SW.
Note:
  • You can also test your added commands,to do so click on Test Command icon on the software and speak up any of the commands from the selected group.
  • If the command matches, then the software will indicate it. Test it and you will see.
In the next post we will check the arduino side of controlling this shield. I will post the code as well so that you can easily test it. If someone's having any problem in using this shield post in comments and I will surely help you out and subscribe us via email to get such exciting tutorials rite in your mailbox. Take care !!!

Voice Recognition using EasyVR Shield

Hello friends, today's post is, as the name suggests, about the Voice Recognition using EasyVR Shield. Voice recognition is quite a difficult task and usually done on software like MATLAB, but what if someone needs a stand alone project, a kind of autonomous voice recognition project, which doesn't use computer.

EasyVR is the solution for such projects. I recently did one project on this module named as Voice Recognition using EasyVR Shield and it worked really cool so I thought to share this new technology with you guys. I couldn't write the next part of Proteus tutorial, actually firstly I was busy in this project and then I thought to share this one as its quite exciting one. After completing this project, I will come back to Proteus tutorial.

This is the first tutorial in this EasyVR shield series. In the next tutorial, I have shared Getting Started with EasyVR Commander and once you got familiar with the EasyVR Commander then you must read Interfacing of EasyVR Commander with Arduino. When I was working on this awesome shield, I got Training Error: Recognition Failed in EasyVR so if you got such error this read this tutorial.

Project Description - Voice Recognition using EasyVR Shield

  • The complete project was quite messy, it involves a lot of sensors as well as dtmf control, so I am not explaining that part in this tutorial. In this project I will explain that section of the project where we used this module.
  • The functioning of this module is to control the robot movement using voice.
  • So, when someone says FORWARD in the mic of this module, the robot moves forward. Someone says RIGHT and the robot moves right and so on.
  • I have divided this project in parts so that you can easily understand the basic concept behind this project.
  • If you are working on such project and are unable to make the code work then you can also get our services by Contacting Us.
  • I have plans on designing this same project on PIC Microcontroller as well as 8051 Microcontroller and I will share their links once I uploaded them.

So, that was all about the Project Description of Voice Recognition using EasyVR Project. In the next posts, we will first see how to add these voice commands in the EasyVR shield and after that we will have a look at the code, I used in Arduino.

XBee Arduino Interfacing

Hello friends , I hope you all are fine and having fun with your lives. Today, I am going to share a new project which is XBee Arduino Interfacing. In my previous tutorials in the XBee series, we have had first Introduction to XBee Module and after that we have also discussed How to Interface XBee Module with Computer. Now we are all well aware of XBee Module and can easily do the XBee Arduino Interfacing. We have seen in the previous tutorial that XBee Module works on Serial protocol so we have to use the Serial Pins of Arduino UNO board.

If you want to use any other microcontroller then you can its not a big issue, just see the way how the programming goes and convert it to the language of your microcontroller i.e. PIC Microcontrollers or 8051 Microcontrollers. If you guys have any question, you may contact me or can ask in the comments. so, let's get started with XBee Arduino Interfacing:

Other XBee Projects:

XBee Arduino Interfacing

  • First of all you need to do is XBee Arduino Interfacing.
  • So, in order to do that you have to connect the Pin # 2 and Pin # 3 of Xbee with the Tx and Rx of Arduino and Pin # 1 to 3.3V of Arduino and Pin # 10 to ground of Arduino as shown in the below figure:
Note :
  • Don't solder the XBee pins directly into the Arduino as it may damage the XBee.
  • You can buy the XBee Shield for Arduino.
  • After that attach your XBees with the two Arduino Boards and use the below code:
int b1 = 2;
int b2 = A3;int mode1 = A4;
int mode2 = A5;void setup()
{
Serial.begin(9600);
delay(100);
pinMode(b1,OUTPUT);digitalWrite(b1, LOW);

pinMode(b2,INPUT_PULLUP);
pinMode(mode1,INPUT_PULLUP);
pinMode(mode2,INPUT_PULLUP);

}

void loop()
{
if (Serial.available() > 0)
{
delay(500);
Serial.print("+++"); delay(1000);
Serial.print("rnATDL1"); delay(100);
Serial.print("rnATCN"); delay(100);
Serial.print("A");
}

}
  • Now add this code in one of your Arduino Board and a simple serial receiving code on the second arduino.
  • Now whenever you press the button you will get A on the second arduino board.
  • You can change it with anything you like and on the second side you can do anything by adding a condition.

That's all for today. I hope you have enjoyed this tutorial XBee Arduino Interfacing. I will share more projects on XBee Arduino Interfacing soon. If you are getting any problem you can ask in comments. Thanks. ALLAH HAFIZ :))

Interfacing of XBee with Computer

Hello friends, I hope you all are fine and having fun with your lives. In today's tutorial, I am going to show you the Interfacing of XBee with Computer. In the previous part of this tutorial, I have given the Introduction to XBee Module. Hope you guys have read it and if not then go visit it so that you may have some idea about XBee module.

Now come to the second part about how to interface xbee with computer because its important as if you cant interface the xbee with computer then you cant interface it with any microcontroller and later I will tell you its interfacing with microcontroller. You should also check this XBee Library for Proteus which will help you to simulate XBee module in Proteus.

We will cover arduino with more detail as its the most usable microcontroller these days with XBee. In this tutorial, I will remain to the basics of XBee i.e. we will just simple send data from one xbee to another but in coming tutorials we will have a look on quite difficult projects i.e. plotting of nodes using Rssi value. I have also posted a tutorial on Interfacing of XBee Module with Arduino. If you guys have any question, you may contact me or can ask in the comments. So, let's get started with Interfacing of XBee with Computer:

Interfacing of XBee with Computer

  • XBee works on the TX / RX logic so if we want to interface xbee with computer, we need to use a serial module.
  • There are two type of module, one is usb module available at sparkfun and its costly for the students of Pakistan.
  • So we have created our own module, its based on serial port and works is a similar way as this sparkfun module.
  • This serial module consists of MAX232 and here's its circuit diagram.
  • You just need to do is, the pins going to the uC are now go to the pin # 2 and pin # 3 of XBee.
  • Moreover, +3.3 V to the pin # 1 of XBee and Ground to the pin # 10 of XBee.
  • One more thing , dont forget to common the grounds of XBee and this circuit.

Software to Download

  • There is a software named X-Ctu, is used for Interfacing of XBee with Computer.
  • So first of all, download X-Ctu and install it in your computer.
  • Attach your module's serial port with the computer after placing the XBee in it.
  • Open the software, the first interface of this software is shown in the image below :
  • The White Box in which there is written USB Serial Port (COM 9) indicates the serial ports attached to your computer.
  • In my case it is COM 9 and in your case it will be mostly COM 1.
  • Now Click on the Test / Query button and if everything's going fine then the following window will pop up.
  •  This prompt box tell us a few things about XBee.
  • In case if something's missing and not working properly then you will get something like that :

Configuring the XBee

  • There are a lot of AT commands used for the configuring XBee. I will tell you where to enter these commands but first lets have a view at these commands.
  • Here I am explaining those which we are going to use for the simplest communication.
  • + + +  : This command will initiate the command mode and now our xbee is ready for taking orders and in this mode it wont transmit data.
  • ATMY2 : ATMY is used to set the address of xbee we are using and 2 is the address we have set for our module.
  • ATDL5 : ATDL is used to set the address of the destination module and 5 is the address. In other words now our module 2 only send data to that module which has address 5 .
  • ATWR : This command is used to write these configurations into XBee . If you don't use these commands then once you removed your xbee your values will be erased.
  • ATCN : To terminate the command mode and after that you are ready to send data.
NOTE :
  • ATDL of tranmitter = ATMY of reciever
  • Suppose I have two modules so in order them to communicate I will set the first module as ATMY = 2 and ATDL = 5 and the second module as ATMY = 5 and ATDL = 2. Now both the modules can send data to each other.But if I change the second module's ATDL = 3 then my second module can't send the data to first but still my first module can send data to the second. ( a bit complicated :) )
  • Only this +++ command doesn't require ENTER but in all other press the ENTER tab after entering command.

Where to Enter These Commands

  • Now the most common question is where to enter these commands.
  • Let's come back to X-Ctu,Now click the Terminal tab on top of the software as shown below :
  •  Now Enter the Commands one by one as shown in the image below :
  • In the above figure, I have set my first xbee as ATMY = 1111 and ATDL = 2222.
  • Now remove the first XBee and attach the second XBee , restart the software and do the same steps as for first but now the settings will be as follows :
  • In the above figure, I have set my first xbee as ATMY = 2222 and ATDL = 1111.
  • Check the difference in addressing of both XBees.
  • Your both XBees are configured.

Communication Between XBees

  •  Now attach first XBee to one computer using the module and the second to other computer using another module.
  • Open the software and click the terminal tab.
  • Now whatever you enter in the terminal tab of first xbee , it will be receiving on the terminal tab of second and vice versa.
  • So, that's all about Interfacing of XBee with Computer.

That's all for today and I am a bit tired too while writing this tutorial on Interfacing of XBee with Computer, so I will continue it tomorrow regarding the microcontroller part. One more thing play with the software and do let me know what you find in the comments. Thanks. ALLAH HAFIZ :))

Introduction to XBee Module

In this tutorial, we are gonna hanve an Introduction to XBee Module. XBee is an RF module and these days its using in lots of student projects and I am getting a lot of queries reagarding this module. So first we will cover the introduction of XBee in this post. Soon I will tell you about Interfacing of XBee Module with Computer and also after this discussion we will also discuss Interfacing of XBee Module with Arduino. You can also Interface it with other Microcontrollers like PIC Microcontroller or 8051 Microcontroller.

We will cover arduino with more detail as its quite famous and easily accessible microcontroller these days. In this tutorial I am gonna add just simple interfacing of XBee module with arduino but soon I will post few quite difficult project on XBee like mesh networking. If you guys have any question, you may contact me or can ask in the comments. So, let's get Started with Introduction to XBee Module:

What is XBee ?

  • XBee is a very complicated module used for RF communication. It is used for wireless communication.
  • It is used these days in many projects as it is very easy to use and its advantages are more than any other RF module.
  • You can use XBee for point to point communication also.
  • There are two commonly used versions of XBee, one is XBee series 01 and other is XBee pro.
  • The only difference between the two is in their range.XBee pro has more range to operate than the simple XBee.
  • Its hardly available in Pakistan so if you want to buy XBee Series 01 in Pakistan then use our Contact Form. You will get it within 2 days.
  • Download the datasheet of XBee and must read it as reading datasheet is always beneficial.

How to operate XBee ?

  • To operate XBee, you will need two XBees, one will act as a transmitter and the other will act as a receiver.
  • Now suppose you want to send something from one side to another, now you have to connect one xbee at the transmitter side and the other at the reciever side.
  • Let's take an example of home automation project in which you are using a remote to switch on your light or fan etc.
  • So in that case there must be one XBee in your remote and the second one in your board where the light circuit is placed.
  • So when you press the button of remote, the XBee in remote will send an instruction to the XBee in the board.
  • As soon as the XBee in the board recieve the instruction from XBee in the remote it will on the light.
  • Obviously there will be microcontrollers attached with both the xbees and you need hell of a programming to do this operation but I was just explaining the procedure.
So, that's all about Introduction to XBee Module, I hope you have enjoyed this Introduction to XBee Module and are gonna use it in your projects. Thanks for reading and have fun !!! :)
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir