Electronics For You - - Con­struc­tion -

which dis­tin­guish it from other de­vices. The ven­dor ID ( Log­itech) has to be men­tioned in the code. Now you can run the loop. pl pro­gram.

Loop.pl. This is a Perl script that runs con­tin­u­ously to check whether the we­b­cam is con­nected or not. Val­ues for ‘ sleep’ com­mand in the code can be changed to achieve an op­ti­mal per­for­mance. Thun­der­bird has to be in­stalled and con­fig­ured be­fore run­ning this pro­gram. The flow­chart of the pro­gram is shown in Fig. 3.

When the vis­i­tor rings the door bell by press­ing switch S1, it trig­gers the monos­table cir­cuit and the we­b­cam gets con­nected to the sys­tem. The pro­gram con­trol moves in­side the if($count2==1) con­di­tion in the loop.pl code. Then it starts ex­e­cut­ing the fol­low­ing pro­grams se­quen­tially:

We­b­cam.pl. It is a Perl script which ac­quires the im­age from the we­b­cam us­ing Streamer tool. The im­age is stored in your sys­tem. The path of

PARTS LIST the im­age ac­quired has to be spec­i­fied in the op­tions of Streamer tool as “streamer –o /path/of/the/im­age”

The Streamer can be in­stalled from the In­ter­net by us­ing the fol­low­ing com­mand:

Streamer reads au­dio and video data from ‘/dev/video0’ and ‘/dev/ dsp’ lo­ca­tions. Then it writes the data to the disk. Var­i­ous out­put for­mats are sup­ported. The fol­low­ing in­struc­tion in the code cap­tures the im­age from the we­b­cam and stores it in your PC: where ‘­c’ de­fines the de­vice driver and ‘­o’ de­fines the file des­ti­na­tion.

With ‘streamer –h’ ex­e­cuted in the con­sole, the de­tails of Streamer com­mand can be viewed on the PC’S screen.

Lis­ten. pl. This Perl script uses Mplayer tool to play the au­dio mes­sage “Please, may I know your name” to the vis­i­tor.

Record.pl. This code records the au­dio from the vis­i­tor us­ing arecord tool. The des­ti­na­tion for the au­dio ac­quired has to be spec­i­fied in the op­tions of arecord tool as ex­plained be­low: where ‘-f’ is the for­mat, ‘-d’ du­ra­tion of five sec­onds, ‘­D’ de­vice name and ‘/ home/efyin­dia/doc­u­ments/au­dios/ au­dio_$date.wav’ des­ti­na­tion of the file.

The arecord can be in­stalled from the In­ter­net by us­ing the fol­low­ing com­mand:

arecord is a com­mand-line sound file recorder for the ALSA sound­card driver. It sup­ports sev­eral file for­mats and mul­ti­ple sound­cards with mul­ti­ple de­vices.

With ‘arecord –h’ ex­e­cuted in the con­sole, more de­tails of arecord com­mand can be viewed on the screen.

Mail_ pic. sh. It is a Shell script which sends an e-mail to the house owner’s e-mail ID us­ing Thun­der­bird

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.