Monday 8 October 2018

How to Interface GSM Modem with the 8051 MIcrocontroller

       Today iam going to discuss about GSM interfacing with 8051 microcontroller which is very much essential for communication based projects.
GSM is the acronym for Global System for Mobile Communication. GSM module is wireless modem that transmits data using radio waves. GSM architecture is similar to the mobile architecture. GSM modems are generally used in many electronic applications and they are required to interface with the microcontrollers.
 
The microcontroller used is AT89C51 microcontroller. To communicate with GSM modem, AT commands are required.
                                                             AT commands are instructions used to control a modem. AT is the abbreviation of ATtention. Every command line starts with "AT" or "at". That's why modem commands are called AT commands. Many of the commands that are used to control wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and ATO (Return to online data state), are also supported by GSM/GPRS modems and mobile phones. Besides this common AT command set, GSM/GPRS modems and mobile phones support an AT command set that is specific to the GSM technology, which includes SMS-related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS messages)

The following AT commands are generally used to control the operations of GSM modem.
Command –  Operation
AT+CSMS    –    Select message service.
AT+CMGF   –    Message format.
AT+CMGL   –    List messages.
AT+CMGR   –    Read message.
AT+CMGS   –    Send message.
AT+CMGD   –   Delete message.
ATA              –    Answer a call.
ATD              –   Dial a number.
ATDL            –  Dial the last outgoing number.
ATH             –   Hang up the call.
The circuit of interfacing GSM to AT89C51 microcontroller mainly consists of GSM modem and 8051 family microcontroller. GSM has RS232 interface for serial communication. In between the GSM module and the microcontroller MAX232 IC is connected.
MAX232 IC is used for converting the logic levels. RS232 logic levels of GSM are converted to the TTL logic levels of the microcontroller using this MAX232 IC. MAX232 IC has 16 pins. This is a dual driver IC as it has two transmitters and receivers. Interfacing of GSM to AT89C51 microcontroller uses only one transmitter and receiver.
AT to check the modem.
AT+CMGF=1 to configure the GSM module to SMS mode.
AT+CMGS=”mobile number  to send the mobile number to the GSM module.
CTRL+Z to send the message.


Wednesday 18 January 2017

Top 10 Latest Electronic Gadgets

Today i would like to share again a few latest electronic gadgets,Because being an electronic geek and also being an electronics student it makes me to share this.The world changes rapidly as we see now. Let's take a look at the most astonishing gadgets to come in the future.

It is a geek world where almost every month we hear about the launch and release of new gadgets, smartphones and devices from across the globe. Big brands are running a race where they want to surpass and subdue other leading brands offering their high class tech devices. Well today I am giving you a clue that what top 10 latest must have tech gadgets are in fashion for the year 2017.1. 5-Port USB Charging Station | Useful Gadget 2017
You know it is difficult when you have siblings and a huge family but having little ports to charge up your smartphones all in one go. Here I have something exciting, a USB port that gives you 7 slots for smartphones and tablet. Feel easy and use them to charge your phones simultaneously with safe USB charging station.
7--Port-Multi-Device-USB-Charger

2. Handheld Mobile Portable Document scanner 1050 DPI | Technology Gadget 2016


Gone are the times when people used to have huge scanners at their workplaces or at their homes. Now the market has introduced portable scanners that are easy to carry and work so smartly. This portable, handheld scanner is so apt for the businessmen, students and travelers etc. It magically and digitally converts your color or black & white photos, receipts and books into digital files. Now you can yourself scan images with up to 1050 DPI resolution and save them directly to a SD memory card. It for sure is a must have for 2016.
Handheld-Mobile-Portable-Document-scanner-1050-DPI-2Handheld-Mobile-Portable-Document-scanner-1050-DPI-3

3. Triby – Connected speaker for the kitchen | Kitchen Gadget 2016


It is such a fun gadget to have at your home, now you can make free Internet calls between Triby and your family smartphones through the Triby application, and regular phone calls with Bluetooth. You can play music with fantastic sound and you can also set in the radio stations of your choice.
Triby-Connected-speaker-for-the-kitchen-2

4. Fitbit Surge Fitness Superwatch | Wearable gadget 2016


With this super smart watch now you can keep a check on your bodily activities, track workouts & view workout summaries; steps, distance, calories burned, floors climbed and active minutes. You can also set alarm and wake up with a silent alarm. Text and call notifications can appear on the touchscreen display of the fitness smart watch. Isn’t this all amazing on the wrist of your hand?
Fitbit-Surge-Fitness-Superwatch-gadget-2016

5. Silhouette Cameo Electronic Cutting Machine Set | Must Have gadget for Graphic Designers


Well to do everything with perfection, we can never compromise on the quality of the stuff. When it comes to the CAMEO’s Print & cut feature it gives you an amazing experience. With it, you can cut precisely around the designs and images you have printed on your home printer. It is the right choice for making stickers etc. Graphic designers would love to own this cutting machine kit.
Silhouette-Cameo-Electronic-Sticker-Cutting-Machine-2

6. MOXO X-1 Portable Wireless Bluetooth Floating Levitating Speaker | Latest Gadget 2016


This wireless speaker lets you play the music on smart phone/tablet, the music will be audible from the bluetooth speaker orb. It can easily be paired with smart phone/tablet automatically. Give your ears a soothing and lavish hearing with this portable levitating speaker.
Portable-Wireless-Bluetooth-Floating-Levitating

7. Executive Portable USB-Enabled Turntable | Music Gadget 2016

This portable USB music gadget offers headphone jack, stereo speakers, auxiliary input and output jack, auxiliary input, RCA output, and headphone jack. It is for sure a must have for the music lovers.
Crosley-Cruiser-Portable-Turntable-2

8. Canon PowerShot D30 Waterproof Digital Camera with HD Videos | Best Gadget 2016


Capture the best memories with this 12MP 1/2.3″ BSI-CMOS sensor. It has 28-140mm F3.9-4.8 equivalent lens with optical image stabilization (5x optical zoom). You can make 1080/24p HD videos plus super slow motion videos at 640×480 (H.264)
This digital camera is totally waterproof and provides you a safer experience with its capacity of being shockproof to 2m / 6.5′. What would you want other than this pleasant experience of a stunning camera?
Canon-PowerShot-D30-Waterproof-Digital-Camera-with-HD-Videos

9. Bluesmart Smart Carry On Luggage for Travelers


Bluesmart is not only a suitcase, it´s your private travel assistant. It is basically a carry-on suitcase that links wirelessly to your smartphone so that you can locate it and also lock it when it is needed. The mobile app lets you see all your data and travel history in one place.
Bluesmart-Smart-Carry-On-Luggage-2

10. Universal Pillow Remote Control | Cool gadget 2016


Nobody has seen something like this pillow remote control which makes you feel at home, at peace and completely laid back when you can use it for TV, DVD, audio receivers, satellite, VCR and more. It is has totally soft padding and it gives you a 100% polyester soft experience that possibly requires 2 AAA Batteries.
Universal-Pillow-Remote-Control-gadget-2016
I am sure now you have a pretty clue that what gadgets are to be bought in the year 2017. Do revert us with your feedback and let us know your experience with any of these gadgets.

Saturday 7 January 2017

Installation of NS-2 Simulator in your Windows in Linux environment

Today i would like to share with you how to install th NS-2 simulator in your Windows platform
First download install VMware/Cygwin software 
secondly download the Ubuntu software and install it in VMware environment and follow the below process

Step by step installation of ns2.35 on ubuntu 14.04

step 1: step1: Download ns-allinone-2.35.tar.gz

Download link:
http://sourceforge.net/projects/nsnam/

step 2:Copy it to home folder(not compulsory, you can change as per your choice )

step 3:Open Terminal (Altr+ctrl+t)

step 4:Install the basic packages required to install the ns2

        $sudo apt-get update 

        $sudo apt-get install build-essential autoconf automake libxmu-dev


step 5: Extract tar file to home. In terminal default directory is home.
            Run follwing command to extract tar file to home directory

          $tar -zxvf ns-allinone-2.35.tar.gz

step 6: Edit line 137 of ns-allinone-2.35/ns-2.35/linkstate/ls.h file as

     
        void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }

              after change save and close this file.

              Go to terminal 

step 7:To install ns2  go to ns-allinone-2.35 directory and run ./install

           $ cd ns-allinone-2.35/
      
           $./install

            it will take 20- 30 min or may be more time to install
       
step 8:After successful installation(without any error) set path in 
      ~/.bashrc profile file

          $gedit ~/.bashrc

          add following lines to the end of this file 

 # LD_LIBRARY_PATH
OTCL_LIB=/home/user-name/ns-allinone-2.35/otcl-1.14
NS2_LIB=/home/user-name/ns-allinone-2.35/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/home/user-name/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/user-name/ns-allinone-2.35/bin:/home/user-name/ns-allinone-2.35/tcl8.5.10/unix:/home/suraj/Desktop/ns-allinone-2.35/tk8.5.10/unix
NS=/home/user-name/ns-allinone-2.35/ns-2.35/
NAM=/home/user-name/ns-allinone-2.35/nam-1.15/
export PATH=$PATH:$XGRAPH:$NS:$NAM


step 9: Change the directory name in above with yours

           $pwd 

**copy the output of above and replace with  "/home/user-name/ns-allinone-2.35"

step7: save and exit the file and run following command

           $source ~/.bashrc

step 10: Run ns

            $ns

             It will show % sign
             type exit to exit

            Run nam command

            $nam

             it will show nam window


if nam shows you error like segmentation fault(core dumped)

go to nam-1.15 and run

$cd ns-allinone-2.35/nam-1.15

$sudo cp nam /usr/local/bin


now run nam

$nam 
Note: In the above code replace the user-name with your name with which the ubuntu was installed in your system
Enjoy!

Saturday 31 December 2016

Breif description about static storage class


The static storage class is very important in C language so i'm going to discuss it in brief 
just have a glance below and i have compared it with an example::
The features of static storage class are as following:
StorageMemory
Keywordstatic
Default initial valueZero
ScopeLocal to the block, in which the variable is defined
LifeValue of the variable persists between different function calls.
#include<stdio.h>
void add();
int main()
{
add();
add();
add();
add();
return 0;
}
void add()
{
 static int i=1;
 printf("\n%d",i);
 i=i+1;
}
OUTPUT : 1 2 3

 static variable do not disappear when the function is no longer active. There value persist. If control comes back to the same function again , the static variables have the same values they had last time around.
Note:
if the storage class is static, then the statement static int i = 1 is executed only once, irrespective of how many times the same function is called.

Storage classes in C



Storage Classes in C

In C language, each variable has a storage class which decides scope, visibility and lifetime of that variable. The following storage classes are most oftenly used in C programming,
  1. Automatic variables
  2. External variables
  3. Static variables
  4. Register variables

Storage Classes are used to describe about the features of a variable/function. These features basically include the scope, visibility and life-time which help us to trace the existence of a particular variable during the runtime of a program.
C language uses 4 storage classes, namely:
auto: This is the default storage class for all the variables declared inside a function or a block. Hence, the keyword auto is rarely used while writing programs in C language. Auto variables can be only accessed within the block/function they have been declared and not outside them (which defines their scope). Of course, these can be accessed within nested blocks within the parent block/function in which the auto variable was declared. However, they can be accessed outside their scope as well using the concept of pointers given here by pointing to the very exact memory location where the variables resides. They are assigned a garbage value by default whenever they are declared.

extern: Extern storage class simply tells us that the variable is defined elsewhere and not within the same block where it is used. Basically, the value is assigned to it in a different block and this can be overwritten/changed in a different block as well. So an extern variable is nothing but a global variable initialized with a legal value where it is declared in order to be used elsewhere. It can be accessed within any function/block. Also, a normal global variable can be made extern as well by placing the ‘extern’ keyword before its declaration/definition in any function/block. This basically signifies that we are not initializing a new variable but instead we are using/accessing the global variable only. The main purpose of using extern variables is that they can be accessed between two different files which are part of a large program.
First File: main.c
#include <stdio.h>
 
int count ;
extern void write_extern();
 
main() {

   count = 5;
   write_extern();
}
Second File: support.c
#include <stdio.h>
 
extern int count;
 
void write_extern(void) {
   printf("count is %d\n", count);
}
Here, extern is being used to declare count in the second file, where as it has its definition in the first file, main.c. Now, compile these two files as follows −
$gcc main.c support.c
It will produce the executable program a.out. When this program is executed, it produces the following result −
count is 5
static: This storage class is used to declare static variables which are popularly used while writing programs in C language. Static variables have a property of preserving their value even after they are out of their scope! Hence, static variables preserve the value of their last use in their scope. So we can say that they are initialised only once and exist till the termination of the program. Thus, no new memory is allocated because they are not re-declared. Their scope is local to the function to which they were defined. Global static variables can be accessed anywhere in the program. By default, they are assigned the value 0 by the compiler.

void test();   //Function declaration (discussed in next topic)
 
main()
{
 test();
 test();
 test();
}
void test()
{
 static int a = 0;        //Static variable
 a = a+1;
 printf("%d\t",a);
}
output :
1 2 3
register: This storage class declares register variables which have the same functionality as that of the auto variables. The only difference is that the compiler tries to store these variables in the register of the microprocessor if a free register is available. This makes the use of register variables to be much faster than that of the variables stored in the memory during the runtime of the program. If a free register is not available, these are then stored in the memory only. Usually few variables which are to be accessed very frequently in a program are declared with the register keyword which improves the running time of the program. An important and interesting point to be noted here is that we cannot obtain the address of a register variable using pointers.
To specify the storage class for a variable, the following syntax is to be followed:
Syntax:
storage_class var_data_type var_name;