Monthly Archives: August 2011

555 IC based Touch Alarm


Security has been a major issue in the present day world. And security gadgets of various nature are available today. Here I introduce a simple touch alarm that can be used on doors with metallic handles (This alarm works only on metallic handles) . This is a simple and easy to make circuit.

Circuit Diagram

touchalarm

touch alarm Circuit

Parts Required

Part     Value 

C1       100n
C2       100u
G1       AB9V
IC1      NE555
IC2      NE555
R1       10k
R2       47k
R3       1k
R4       10k
R5       10k
T1       BC547

Description

The main part of this circuit is the first 555 timer IC which is set as a monostable multi vibrator , The metallic loop is attached to PIN2 of 555 IC and it is active low, so when someone touches the door handle to which the alarm loop is attached the voltage to get grounded or the voltage at PIN2 gets reduced to less than 1/3 Vcc, so a pulse is formed with t=1.1RC. here the value of R2 and C2 can be made small  just sufficient to generate a small pulse to set the latch. (Sometimes the IC may remain triggered even when not touched in such  case ground PIN2 with a capacitor of 100nF).

The second part of the Circuit is a transistor that has been set as a not gate. For a note gate output is low when input is high. The input is given to transisitor base and output is taken from the collector, this output is given to the third part of the circuit.

The third part of the circuit is another 555 IC set as a latch, when the PIN2 is grounded the latch output will be set to 1 and when PIN4 is grounded the latch is reset, the switch is provided to reset the latch, the output of the latch is given to a buzzer.

Advertisements

Compiling a Linux Kernel


The advantage of linux is that we can choose what our system needs and thereby improve its efficiency. Compiling the kernel has its own advantages though it is a time consuming process.A  new Linux user may find it difficult to compile Linux kernel. This tutorial contains the process to compile Linux kernel version 3.0.3 under Ubuntu. However, instructions remains the same for any other distribution except for apt-get command.

Step # 1

Get Latest Linux kernel code and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number.

Step # 2

Configure kernel Before you configure kernel make sure you have development tools (gcc compilers and related tools) are installed on your system. If gcc compiler and tools are not installed then use apt-get command under Debian Linux to install development tools.Also we need the libncurses5-dev for the menuconfig

# sudo apt-get install gcc
# sudo apt-get install libncurses5-dev

Step # 2

Extract tar (.tar.bz3) file Type the following command:

 # sudo tar -xjvf linux-3.0.3.tar.bz2 -C /usr/src
 # cd /usr/src
Now you can start kernel configuration by typing any one of the command:

$ make menuconfig – Text based color menus, radiolists & dialogs. This option also useful on remote server if you wanna compile kernel remotely.

$ make xconfig – X windows (Qt) based configuration tool, works best under KDE desktop

$ make gconfig – X windows (Gtk) based configuration tool, works best under Gnome Dekstop. For example make menuconfig command launches following screen:

$make config  – Textmode

You have to select different options as per your need. Each configuration option has HELP button associated with it so select help button to get help.

Step # 4

Enter:

$ sudo make

Start compiling to kernel modules:

$ sudo make modules

Install kernel modules:

$ sudo make modules_install

Step # 5

So far we have compiled kernel and installed kernel modules. It is time to install kernel itself.

# make install

It will install three files into /boot directory as well as modification to your kernel grub configuration file: System.map-2.6.25 config-2.6.25 vmlinuz-2.6.25

Step # 6:

Type the following command at a shell prompt:

#sudo update-grub

Step # 8 :

Reboot computer and boot into your new kernel Just issue reboot command:
#sudo shutdown -r now

A Peek Into the Sky


The quest for mans’ knowledge about the universe started since he became a rational animal.Ancient civilisations made use of astronomical observations in prediciting seasons, The first observatory perhaps might be the stonehenge situated in UK. It is believed to have been used for marking sunrise and sunset and also the moonrise and moon set.

MYTHS ABOUT THE EARTH AND SUN
In the ancient time people believed that the sun was carried from the eastern horizon to the western horizon on a chariot pulled by seven horses, and that the earth was a large island surrounded by seas on all sides and carried on the back of a turtle.

CONSTELLATIONS AND THE ZODIAC
A group of stars is called a constellation.Ancient people used the constellations for navigation, to know the seasons etc. The stars in the sky are grouped into 88 constellations. Among the 88 there are 12 that stradle the sky along the apparent yearly path of the sun called ecliptic. These 12 are known as the zodiacal constellations and the band of 12 constellations is known as zodiac.
These are:

Name Image Mythology
Aquarius Water CarrierBabylonian Name.In Greek mythology, Aquarius (also known as Ganymede in Roman myth) was a beautiful young boy whom Zeus brought to Olympus to be the cup bearer of the Gods. It is suggested that Zeus fell in love with Aquarius.
Aries Ram or Golden Fleece.In Greek mythology, the ram carried Athamas’s son Phrixux and daughter Helle to Colchis to escape Ino. When the ram reached Colchis, Phrixux sacrificed the ram and hung its fleece in the Grove or Ares. This fleece turned to gold and later was the quest of Jason and the Argonauts.The constellation name was common in Greek, Babylonian and Egyptian cultures.
Cancer CrabJuno sent a crab to defeat Hercules while fighting Hydra. The crab was crushed by Hercules.
Capricorn Sea GoatAlso known as Amalthea who provided for baby Zeus after Rhea saved him from Cronos.The word “cornucopia” comes from the broken horn of Capricorn – or the “horn of plenty.”
Gemini Twin BrothersThe two bright stars– Castor and Pollux – are also the brothers’ names. They were the brothers of Helen of Troy.They are also the protectors of ships and sailors.
Leo LionPrehistoric constellation associated with royalty. In Egyptian mythology, it represents the life giving floods since the Sunwas in this constellation during the heavy rains.In Greek mythology, Leo represents the Nemean Lion which was killed by Hercules.
Libra ScalesThe only “non-living” object in the Zodiac.Romans chopped claws from Scorpio during Autumn Equinox to make Libra.

In Greek mythology, Libra is the scaled held by Astraea that represents justice.

Ophiuchus Serpent HolderWhile not an Astrological sign, Sunspends longer time here than in Scorpio.In Greek mythology, Ophiuchus is a legendary physician who tried to become immortal to avoid death. Zeus killed him with a bolt of lightening, but honored him because of good works.
Pisces Two FishVenus and her son Cupid escaped Typhon as two fish tied together.In Greek mythology, they are Aphrodite and Eros.
Sagittarius The ArcherA Chiron, half-man half-horse, sent to kill the scorpion (Scorpio).In Babylonian mythology, this represents the demon Pabilsaq.
Scorpio The ScorpionSent by Gaia to kill Orion when he said he would kill all animals.It is also said that Apollo sent the scorpion to kill Orion.

Orion and Scorpio are on opposite sides of the sky.

Taurus The BullBabylonian constellation.Jupiter turns into bull to carry off Europa – daughter of King of Crete.

It is also said that Zeus brought the ram to try and win the heart of Europa.

Virgo The VirginGoddess of farms and harvest. Virgo could also represent Ishtar, Isis, Demeter, Cybele, and Athena.Also thought to represent Astraea, the daughter of Zeus representing justice.

It is also suggested that Virgo represents Persephone, queen of the underworld.

The Following Link gives details about the 88 constellations

An alarm to remind you to water Plants


This is a circuit that will remind you to water plants when the pot is dry, this circuit is mainly meant for the indoor plants that are the unfortunate ones that don’t even receive rainfall.

The Circuit consist of two probes( You can use nails or just strips of uninsulated wires) When the probes are shorted the LED will be turned off. When the soil is wet the resistivity of soil is so low that the LED is turned off, when the soil is dry the resistivity of soil is high and it does not conduct.

Plant watering reminder

 

In this circuit Q1 and T1 form an astable oscillator and T2 acts as a switch that turns on and off the astable oscillator. A buzzer can be used instead of the LED. The pot can be used to adjust the sensitivity of the device.

 

 

 

 

wateralarm

Parts List

Part     Value
C1       100nf
R1       100k
R2       470k(Pot or Preset)
R3       1M
Q1       BC328
T1       BC107
T2       BC107
LED      (Or buzzer)
Battery  9V
Battery clip
Wires, solder,pcb etc

 

Automounting A partition in Ubuntu


Certain times we may have a hard disk that has several partitions and of which only one is related to the Installed ubuntu OS.

The remaining partitions have to be mounted each time you start your computer. I had faced such a situation where my music files and all other documents where on a separate partition and each time i had to mount them manually and provide my password (till ubuntu9.10, from ubuntu 10.04 they have not been prompting for password), I could not set my library location in banshee and i couldn’t do such configurations because each time i shutdown tat location is lost to the player, so i decided to set automount, this article will be helpful to all those who face any similar situation.

The file that contains the data regarding the devices to be mounted at startup are in /etc/fstab

Screenshot of /etc/fstab

First we have to create a directory to which our partition will be mounted  create one directory per partition. I created the directories in the directory /media

open up the terminal and type

sudo mkdir location_of_dir/name_of_dir

or you can use nautilus the file manager to create a folder.

If the the directory is created in a location where u need root privileges use sudo,

after that we can modify /etc/fstab, It is always advisable to create a backup of the /etc/fstab because any error in that file can prevent your OS from booting.

Once you have created the backup.

sudo gedit  /etc/fstab

open the /etc/fstab with a text editor of your choice with root privileges

In this file add the details in the order

<file system> <mount point>   <type>  <options>       <dump>  <pass>

Where filesystem can be obtained by checking the output of the command

mount -l

perform this operation when the required partition is mounted from that you will obtain the filesystem something like /dev/sda3 etc

Mount point is the directory you created specify full path.

type is the type of file system like ext4,fat,ntfs etc.

options is normally given as defaults and dump and pass is given 0

I had a partition /dev/sda5 and i created the directory /media/mydisk my partition was of type ext4, so to my /etc/fstab I added

/dev/sda5                  /media/mydisk      ext4      defaults      0      0     

Save the file and in command prompt type

sudo mount -a

If everything went well your partitons should be mounted by now now try restarting your compurter and you can still see that your partitions are amounted, and you are free you don’t have to mount them everytime.

Hope this will be helpfull to you.

A Simple Game


Below I have given the code to a simple game that i made, I wish that some reader may try it and modify it, this game was maybe one of the big work that i have done in C. It has been released under the GPL so pls feel free to download, play, share and modify. Expecting feedbacks 🙂

This is how the game works there  is a matrix of 9 numbers 1-9, select a submatrix w for top d for right s for down and a for let, then press f to rotate the sub matrix and do so till the matrix is in order

/****************************This is a simple game*******************************************************
   Copyright (C) <2010> <Vineeth Kartha>

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation;version 2 of the License.
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307 USA

you can contact me for help at vineeth.kartha@gmail.com
*/

#include<stdio.h>
#include<stdlib.h>
void licence()
{
     printf("Copyright (C) <2010> <Vineeth Kartha> \nThis program is free software; you can redistribute it and/or modify\n it under the terms of the                GNU General Public License as published by\n the Free Software Foundation;version 2 of the License.   \n This program is distributed in              the hope that it will be useful,   \n but WITHOUT ANY WARRANTY; without even the implied warranty of   \n MERCHANTABILITY or FITNESS FOR A              PARTICULAR PURPOSE. See the   \n GNU General Public License for more details.   \n You should have received a copy of the GNU General              Public License   \n along with this program; if not, write to the Free Software   \n Foundation, Inc., 59 Temple Place, Suite 330, Boston,              MA   02111-1307 USA\n\nyou can contact me for help at vineeth.kartha@gmail.com");
     printf("\n\n Press any key to continue");
}
int main()
    {    
     system("clear");
     int x=0,y=0,i,j,flag=0;
     int row=0,col=0,count=0;
     int arr[3][3],corr[3][3];
     int t,choice=1,num=1,score=0;
     char ch='q';
     for(i=0;i<3;i++)
        {
         for(j=0;j<3;j++)
            {
             corr[i][j]=num;
            }
         num++;
        }
     srand(time(NULL));
     while(choice!=3)
     {
      system("clear");
      licence();
     printf("\n 1) Play \n 2) Help \n 3) Exit \n");
     scanf("%d",&choice);
     if(choice==1)
        {
/* To fill the array with numbers from 1 - 9 in random order*/
         while(flag<9)
            {
              num=rand()%10;            //to generate random numbers
              for(i = 0;i<3;i++)
                {
                  for(j=0;j<3;j++)
                    {
                     if(num == arr[i][j]||num==0)    // to verify if number is 0 or if its already present
                        {
                         count++;
                        }            
                    }
                }
              if(count==0)
                 {
                    arr[row][col]=num;
                  flag++;
                  col++;
                  if(col>=3)
                    {
                      row++;
                      col=0;
                    }
                }
            else
                {
                 count=0;
                }
            }
/* To display the array*/

        for(i=0;i<3;i++)
            {
             for(j=0;j<3;j++)
                {
                printf("%d",arr[i][j]);
                printf("    ");            
                }
              printf("\n");
            }

        while(1)
            {
            scanf("%c",&ch);
/* Select upper square*/
            if(ch=='w')
                {
                 x=0;
                }    
/* Select lower square*/
            if(ch=='s')
                {
                 x=1;
                }
/* Select left square*/

            if(ch=='a')
                {
                 y=0;
                }
/* Select right square*/

            if(ch=='d')
                {
                 y=1;
                }
/* Rotate the digits*/
            if(ch=='f')
                {
                 t=arr[x][y];
                 arr[x][y]=arr[x+1][y];
                 arr[x+1][y]=arr[x+1][y+1];
                 arr[x+1][y+1]=arr[x][y+1];
                 arr[x][y+1]=t;
                 score++;
                }
/* Exit*/
            if(ch=='q')
                {
                 break;
                }
            system("clear");
            printf("\n\n\n\n\t\t\t");
            for(i=0;i<3;i++)
                {
                 for(j=0;j<3;j++)
                    {
                      printf("%d",arr[i][j]);
                     printf("    ");            
                    }
                 printf("\n\t\t\t");
                }
            num=0;
            for(i=0;i<3;i++)
                {
                 for(j=0;j<3;j++)
                    {
                      if(arr[i][j]==corr[i][j])
                        {
                         num++;
                        }            
                    }
                }
            if(num==9)
                {
                 printf("\n\n\t\t\tYOU WON\n");
                }
            }
    }
    if(choice==2)
    {
     system("clear");
     printf("\n This is a game where you have to arrange numbers 1-9 in a matrix in order.\n w --> select the top sub matrix \n s --> select bottom          submatrix \n a --> select left submatrix \n d --> select right submatrix.\n f--> rotate the numbers.");
     printf("\n press any  NUMBER key to continue.......");
     scanf("%d", &num);
    }
    }
    if(choice ==3)
    {
     system("exit");
     system("clear");
    }
}

An Electronic Dice


The circuit is one among the few which actually worked for me, The electronic dice is a circuit that lights X number of LEDs where X varies from 1-6 like in a normal dice, the Circuit can also be improvised to make a number guessing game.

The main part of the circuit is the IC 4071 which is a decade/divider counter (datasheet).

Parts Required

Resistors -10k x 3

-470

-330 x 3

Capacitor- 0.01uf

Diodes -1N4148 x 6

LEDS – 7

IC 4071

IC555

Push switch,

9V battery

In this circuit the 555 timer Ic is setup as a astable multivibrator with approx 5khz frequency and that clock pulse is given to the decade counter, that is set to count till 5 and reset.

The Leds are arranged that only a particular number of LEDs are lighted , the logic can also be implemented using Gates, but here to reduce cost and complexity the easisest method of wirirng certain pins to certain LEDs are adopted.

When the Push switch is pressed clock pulse reaches the IC4071 and it cycles throught the allowed states and when we release the button it stops at a number.

If you could go back in time and relive one day of your life, which would you choose?


Hmmmm….. a very confusing topic…………Still when I look back my school days were my best days. And to choose one day among them would be unfair because all were the best so rather I should wish to relive 6-7 years of my life. But now for the sake of this post I would like to relive our Trip to Kodaikanal When we were In 10th. It was one of the best trips I ever had with my friends, I don’t remember the exact date but it was in a December Just before Christmas. And we the 10th std Students Of SAPS set forth on a journey that would remain in our memories till the end of our days. We started early in the morning and for breakfast we reached a College in Kuttikanam.

Kuttikkanam, the land of lush green tea plantations, lofty peaks and gushing streams, lies in the Idukki district, 3500 feet above the sea level. Clouds gently touch the peaks that flank the verdant slops of Kuttikkanam. Indeed, the streams silvering down from the top hill peaks will fill your hearts with warm feelings.
The valleys and hills of Kuttikkanam are draped in mist all through the year. On a fairly warm day the mercury reads around 15°C.The beauty of Kuttikkanam is a ‘JOY FOR EVER’: We can see the sunset and the sea as we tune our ears to the symphony of the winged choristers!

The history of Kuttikkanam dates back to 1750’s. In 16th Century the place was under the rule of Changanacherry Kings. In 1756, the King of Travancore conquered Changanacherry, and brought the place under his supremacy. At that time Kuttikkanam and Peermade outside human haunt. It was a CMS Missionary, named Henry Baker who first discovered the uniqueness of this place and he started coffee plantations here. But the plantations were shifted to tea, during the regency of Srimoolam Thirunal. After that the spread the fame of this place was just a matter of time . Soon many Europeans toed the line of Henry Baker.

hope Church

With their arrival the place began to prosper and soon became the destination of the glitterati .At that time there were no good roads connecting Kuttikkanam with any towns . To reach the place there was only a pathway. The English started Aerial rope way LTD; which was incidentally Travancore states’ first public LTD company, however poor economic aspects crippled the company, and they shifted their focus to road transport The renaming of company into Road Transport Corporation marked the complete change. Later in 1960’s, owing to political and social reasons the company was taken over by Mr. Michael Kallivayalil, a brilliant young entrepreneur from Kerala. By that time, most of the English owned properties had been handed over to native entrepreneurs.

During the British reign and after, man power was brought to Kuttikkanam from various places of Kerala and Tamilnadu .They constitute the major part of the population of Kuttikkanam.Then We Visited Hope Church

One of the oldest churches in Kuttikkanam,it boasts of a history of more than 150 years. As the name suggests, it was the hope for hundreds for many a generation. A must see place for the spiritually inclined.

After spending some time there we left for Thekkedy

Boat trip In Thekkedy

There we had  a wonderful boating trip and though it is a wildlife reserve there were no much wildlife to see, though we enjoyed some beautiful sceneries. Then from there in the evening we left for Kodaikanal. It was a pretty long trip by bus and we had lots of fun and games nad it was the first time that I saw the movie “Anyan”

Thekkady

 

 

 

 

 

 

 

Kodaikanal

it is a city in the hills of the taluk division of the Dindigul district in the state of Tamil Nadu, India. Its name in the Tamil language means “The Gift of the Forest”. Kodaikanal is referred to as the “Princess of Hill stations” and has a long history as a retreat and popular tourist destination. It’s a lot cooler in temperature than lower elevation cities such as Chennai.

Kodaikanal was established in 1845 as a refuge from the high temperatures and tropical diseases of the plains.[4] Much of the local economy is based on the hospitality industry serving tourism.

Kodaikanal Lake

We reached a our lodge((Danny’s Guest House”), at night and since we were all tired after dinner we went to our rooms, but though our bodies were tired deep in our minds we were all thrilled and in festive mood and we rocked the place whole night most of us stayed up playing pranks on those who fell asleep :-).

Kodaikanal has several scenic natural attractions which are enjoyed by its visitors .

Kodaikanal Lake, 500 metres (1,600 ft) from the bus stand, is an artificial, roughly star-shaped 45 ha (60 acres) lake built in 1863. It is recognized as Kodaikanal’s most popular geographic landmark and tourist attraction. Rowboats and pedalos can be hired at the Kodaikanal Boat Club with its main entrance near the only five-star hotel in Kodaikanal, The Carlton. Horses and bicycles can be hired beside the lake for short periods. The 5 kilometres (3.1 mi) path that skirts the periphery of this lovely lake is a favourite walk for the locals and tourists alike.

Tour De France

Bryant Park: Just east of the lake and 500 metres (1,600 ft) from the bus stand, is a wonderfully maintained 20.5 acres (8.3 ha) botanical garden. The park was planned and built in 1908 by a forest officer from Madurai, H.D.Bryant, and named after him. With 325 species of trees, shrubs and cactuses, the park is a rainbow of stunning flowers during the peak season. A large section is dedicated to nearly 740 varieties of roses. There is a 1857 Eucalyptus tree and a Bodhi tree which adds a religious significance to the park. Ornamental plants are cultivated in a nursery for sale. The park organizes horticultural exhibits and flower shows every summer, to coincide with the peak season. Entrance fee to the park is nominal and it is open all year.[33]

 

 

 

Coaker’s Walk, 500 metres (1,600 ft) from the bus-stand, constructed by Lt.Coaker in 1872, is a 1-kilometre (3,300 ft) paved

Coacker's Walk

pedestrian path running along the edge of steep slopes on the southern side of Kodai. The walk, winding around Mount Nebo, starts in front of the Van Allen hospital, running parallel to the Van Allen Hospital Road and joins the main road beside St.Peter’s Church, providing a stunning panoramic view of the plains. On a clear day one can view as far as Dolphin’s Nose in the south, the valley of the Pambar River in the southeast, Periyakulam town and even the city of Madurai. A fascinating rare phenomenon called Brocken spectre can be witnessed, when a person can see his shadow on the clouds with a rainbow halo. This occurs when the sun is behind the viewer and clouds and mist are to the front. There is an observatory with a telescope halfway along the walk. Entrance fee to the walkway is nominal and it is open all year.[34]

Bear Shola Falls, 3 kilometres (1.9 mi) from the bus-stand, is a tall waterfall in a Reserve forest. The final approach to this quiet area is a gently climbing foot-path.

Green Valley View, (formerly called Suicide Point) 5.5 kilometres (3.4 mi) from the bus-stand and near the golf course, has an excellent panoramic view of the plains and a sheer drop of 1,500 metres (4,900 ft) overlooking the Vaigai Dam to the south. The stairway leading up to it is highly commercialized and lined with rows of shops to tempt tourists.[35]

Pine forests, In 1906, with a view to growing valuable timber, Mr. Bryant started the Kodaikanal pine plantations in the south-west of Kodaikanal.

Pillar rocks

Pillar Rocks, 8 kilometres (5.0 mi) from the bus-stand, is a set of three giant rock pillars which stand 122 metres (400 ft) high.[40] Managed by the Tamil Nadu Forest Department, The viewpoint can be crowded but is not commercialized. There is an excellent public garden adjacent to the viewpoint.


Then early in the morning some of us got up and went for a walk to see what Kodaikanal was all about, there were some old German settlements there and a pretty Old church with a Big Bell infront of it, Then we started our trip after breakfast and we saw almost the whole of Kodaikanal in two days and it was not kodaikanal but it was the fun we had when we all were together our boating trips, cycling trips etc,

A Bell a an Old Church in Kodaikanal

 

 

 

 

 

 

 

 

 

Friends are the biggest treasure that a person finds in his life and I still remember those beautiful days I spent with my friends, If I get a chance to relive that day then definitely i will not forget to thank each of my friends and tell them how special the all are to me.

Your Chance to be a Hero this Independence day


Everyone wants to be a hero, everyone has fantasized about saving the planet  and thats why super hero comics have always inspired us. Now you have a Golden Opportunity to save the planet, to be a super hero-To SAVE THE PLANET.

We all know mother Earth is the place we’ve got, and its our only home, but we have all forgotten the fact and we have ruined it, well things still can be brought under control if we act now, and lets start by reducing the use of plastics, we may not be able to ban it completely. But there are things that we can do and everyone knows how bad plastics can be, in certain places there are rules in the usage  of plastics, hats off to the people and Governments of those areas for the rest of us, on this Independence day lets Give our country a new face by reducing plastics, Lets take a resolution that:

  • A plastic bag is also reusable. It does not necessarily have to be thrown away after a
  • single use. Try to use each plastic bag for as long as possible. This will help reduce the
  • number of plastic bags in circulation.
  • Take your own bag to all stores you shop in and say “no bag needed, thanks!”
  • Try not to buy convenience foods packages in plastic
  • Take your own containers to restaurants for buying parcels
  • When ordering drinks, say “no straw please!”
  • Put empty cardboard boxes in your car to transport heavy items to and from your car without a bag.
  • Use paper cups for functions and tea shops

USE REUSE AND RECYCLE Let that be our principle.

A C Program to Find Convolution of Two Signals


The convolution of ƒ and g is written ƒg, using an asterisk or star. It is defined as the integral of the product of the two functions after one is reversed and shifted. As such, it is a particular kind of integral transform:

(f * g )(t)\ \ \, \stackrel{\mathrm{def}}{=}\ \int_{-\infty}^{\infty} f(\tau)\, g(t - \tau)\, d\tau
= \int_{-\infty}^{\infty} f(t-\tau)\, g(\tau)\, d\tau.       (commutativity)

While the symbol t is used above, it need not represent the time domain. But in that context, the convolution formula can be described as a weighted average of the function ƒ(τ) at the moment t where the weighting is given by g(−τ) simply shifted by amount t. As t changes, the weighting function emphasizes different parts of the input function.

More generally, if f and g are complex-valued functions on Rd, then their convolution may be defined as the integral:

(f * g )(x) = \int_{\mathbf{R}^d} f(y)g(x-y)\,dy = \int_{\mathbf{R}^d} f(x-y)g(y)\,dy.
In Digital Signal Processing where convolution is done between two discrete signals the procedure followed is :
There are different methods used in finding convolution (refer Signals And Systems by  Openheim for more details on each method). Here i will demonstrate a C program that uses the matrix method to find convolution.
The CODE
/* Vineeth Kartha
Program To Find Convolution
Released Under GPL */
#include<stdio.h>
int main()
{
printf(“\n\tThis program finds the convolution of a signal and its Impulse response\n”);
printf(“—————————————————————————\n\n”);
int i,j,k,x[10],h[10],y[10],a[10][10],n,m;
printf(“enter the number of elements in x[n]:\t”);
scanf(“%d”,&n);
printf(“enter the elements of x[n]:\n”);
for(i=0;i<n;i++)
{
scanf(“%d”,&x[i]);
}
printf(“enter the number of elements in h[n]:\t”);
scanf(“%d”,&m);
printf(“enter the elements of h[n]:\n”);
for(i=0;i<m;i++)
{
scanf(“%d”,&h[i]);
}
for(k=0;k<m;k++)
{
for(i=0;i<n;i++)
{
a[k][i]=h[k]*x[i];
}
}
for(k=0;k<(n+m-1);k++)
{
y[k]=0;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if((i+j)==k)
{
y[k]+=a[i][j];
}
}
}
}
printf(“\n\tx[n]={“);
for(i=0;i<n;i++)
{
printf(“%d “,x[i]);
}
printf(“}\n\th[n]={“);
for(i=0;i<m;i++)
{
printf(“%d “,h[i]);
}printf(“}\n\n\n\ty[n]=x[n]*h[n]\n——————————————\n\n\ty[n]={“);for(i=0;i<(n+m-1);i++)
{
printf(“%d “,y[i]);
}
printf(“}\n\n”);
return 0;
}


			
%d bloggers like this: