المساعدة بالتحكم بالمنزل عن بعد بالتلفون او الجوال


(system) #1

السلام عليكم ورحمة الله
أرجو من المهندسين المختصين بهندسة الاتصالات والتحكم مساعدتي بمعلومات عن التحكم بأجهزة البيت عن بعد بتلفون أو جوال وياريت تفيدوني كتير لانه هدا مشروعي التخرج وشكرا الكم كتير:):):slight_smile:


(mohannd) #2

اتفضل اخى الكريم الدائرة


(mohannd) #3

Parts list:ICs:IC1- PIC16F84A microcontrollerIC2- MCT2E opto isolatorIC3- NE555 timer IcIC5- 7805C or 7805CT regulator ICResistors (all 1/4th W unless otherwise stated):R1- 10K, 1WR2- 15KR3 to R6 - 2.2KR7 - 2.2K (eight pieces for eight relay circuits)Capacitors:C1- 0.47uF/200V non electrolyticC2- 47uF/25V electrolyticC3,C4 - 22pF non electrolyticC5- 0.01uF non electrolyticC7,C8 - 0.1 uF non electrolyticC9,C10- 100uF/25V electrolyticTransistors:BC547 - eight piecesRelays:12V, 60mA (or less) relay with 2A SPDT switching contacts - 8 piecesDIP switch:4 switch DIPDiodes:D1,D2 - 10V, 500mW zener diodesD3 - 1N4007D4 - 1N4007 (8 pieces for 8 relay circuits)Crystal:Q1 - 4MHz ceramic crystal resonator


(mohannd) #4

C source code complied using HT-Soft PIC C compiler
define TIMEOUTS 98 // no. of timeouts to occur for waiting (1 timeout = 200x256us), 98 timeouts=5sec

#include<pic.h>
#include<pic1684.h>

__CONFIG(0x3ff1);

void ringcounter(void);
void dowakeon(void);
void dowakeoff(void);
void delay(void);
void wait5sec(void);
void getdipswitch(void);

char WAKEON = 4;
char WAKEOFF = 5;
char WAITDELAY = 2;
char ringcount=0;
unsigned int x=0;

void main(void)
{

GIE=0; //disable interrupts
TRISA=0b00011111; //PORTA=in
TRISB=0b00000000; //B0 to B7 output
OPTION=0b11010111; // tmr0/prescaler 256/tmr0 --> internal
PORTB =0; //turn all relays off

// getdipswitch function sets the intial on/off rings and also the delay for rings to turn device on through A4,A3,A2,A1
// A4 A3 wakeon wakeoff
// 0 0 2 3
// 0 1 3 4
// 1 0 4 5
// 1 1 5 6
//
// A2 A1 waitdelay
// 0 0 5
// 0 1 10
// 1 0 15
// 1 1 20

getdipswitch(); //configure rings and delay

while(1)
{
ringcounter();
if(ringcount==WAKEON)
dowakeon();

else if(ringcount==WAKEOFF)
    dowakeoff();

}

}

void ringcounter(void)
{
ringcount=0;
while(1)
{

x=0;
TMR0=0;
while(RA0==0)         
{    
    if(TMR0&gt;=200)                    // to keep some margin in case TMR0 rolls back to 00, keep it to C8(200dec)!!
    {
        TMR0=0;
        x++;
        if(x&gt;=TIMEOUTS)            //if timeout 5s return. Total timeout = 200us*TIMEOUTS*256(prescaler)
            return;
    }
}
    while(RA0==1);                    //while A0=1 wait
ringcount++;
}

}

void dowakeon(void)
{
char i;
for(i=0;i<WAITDELAY;i++)
{
ringcounter();
if(ringcount==0)
continue;
else
switch(ringcount)
{

        case 1: RB0=1;
                break;
        case 2: RB1=1;
                break;
        case 3: RB2=1;
                break;
        case 4: RB3=1;
                break;

        case 5: RB4=1;
                break;

        case 6: RB5=1;
                break;

        case 7: RB6=1;
                break;

        case 8: RB7=1;
                break;
        default: break;
    }
}

ringcount=0;
}

void dowakeoff(void)
{
char i;
for(i=0;i<WAITDELAY;i++)
{
ringcounter();
if(ringcount==0)
continue;
else
switch(ringcount)
{

        case 1: RB0=0;
                break;
        case 2: RB1=0;
                break;
        case 3: RB2=0;
                break;
        case 4: RB3=0;
                break;
        case 5: RB4=0;
                break;

        case 6: RB5=0;
                break;

        case 7: RB6=0;
                break;

        case 8: RB7=0;
                break;
        default: break;
    }
}

ringcount=0;
}

void wait5sec(void)
{
x=0;
TMR0=0;
while(x<TIMEOUTS)
if(TMR0>=200) // to keep some margin in case TMR0 rolls back to 00, keep it to C8(200dec)!!
{
TMR0=0;
x++;
}
return;

}

void getdipswitch(void)
{
char temp1,temp2;
temp1 = (PORTA&0b00011000)>>3; //get the A4,A3 bits into temp1
temp2 = (PORTA&0b00000110)>>1; //get the A2,A1 bits into temp2
switch(temp1)
{
case 0: WAKEON=2;WAKEOFF=3;
break;
case 1: WAKEON=3;WAKEOFF=4;
break;
case 2: WAKEON=4;WAKEOFF=5;
break;
case 3: WAKEON=5;WAKEOFF=6;
break;
default:break;
}

switch(temp2)
{
case 0: WAITDELAY=1;
break;
case 1: WAITDELAY=2;
break;
case 2: WAITDELAY=3;
break;
case 3: WAITDELAY=4;
break;
default:break;
}

}


(mohannd) #5

Compiler Hex code file to be directly programmed into the PIC
here


(mohannd) #6

Instructions for the telephone operated remote switch:
A) While constructing the main circuit, make sure you use 18pin sockets (base) for the PIC16F84A. Do not solder the IC directly to the board since you may have to remove it for programming. Before you use the PIC on the main circuit, you have to first program it.
B) To program the PIC16F84A microcontroller

Remove the PIC from the programmer socket and put it into the main circuit socket.
Set the DIP SWITCH as follows:
Switch3 Switch4 No. of initial rings to Switch ON(activate half of the board)
OFF OFF 5
ON OFF 4
OFF ON 3
ON ON 2
The number of initial rings to Switch OFF is one more than the number of rings to switch ON. For example, if you have set switch3 OFF & Switch4 ON then number of initial rings to activate half of the board to switch ON the relays is 3 and number of initial rings to activate half of the board to switch OFF the relays is 3+1 = 4
Switch1 Swtich2 Delay before making the second set of rings
OFF OFF 20sec
ON OFF 15sec
OFF ON 10sec
ON ON 5sec
This is the maximum delay the board can take after it is half activated. It will reset after this delay.
D) Now connect the circuit to the phone line and switch on its power supply.
E) You can test the board now. For example set the DIP switch to Switch1 ON, Switch2 OFF (15 sec delay) & switch3 ON, switch4 OFF (4 rings to activate half for switching ON). If you want to switch ON relay 1 (connected to RB0 of main circuit) then you have to do the following:

[ol]
[li]Give 4 rings and put down the receiver[/li][li]Wait 5 seconds (this 5 seconds wait is required to prevent the board from detecting continous rings)[/li][li]then within 15 seconds give 1 ring (1 ring for relay1, 2 rings for relay2 and so on) and put down the receiver[/li][li]then within 5 sec the relay1 will switch ON[/ol]To switch off relay1:[/li][ol]
[li]Give 5 rings and put down the receiver[/li][li]Wait 5 seconds (this 5 seconds wait is required to prevent the board from detecting continous rings)[/li][li]then within 15 seconds give 1 ring (1 ring for relay1, 2 rings for relay2 and so on) and put down the receiver[/li][*]then within 5 sec the relay1 will switch OFF[/ol]


(system) #7

السلام عليكم ورحمة الله وبركاته

جزاك الله خير أخوي مهند

عندي أسئلة عن هالبروجكت إذا ممكن :

  1. هل هذا البروجكت يعمل على الجوال او على الثابت ؟
    2.وكيف سيتم استقبال ال sms ؟ هل عن طريق GPRS ?

لأن فكرة البروجكت واضحة لكن التفاصيل غامضة نوعاً ما …

أتمنى إني أحصل على رد … وشكراً مقدماً


(mohannd) #8

اخى الكريم هذه الدائرة للخط العادى ولك عندى مفاجاءة وهى الدائرة الخاصة بالتحكم باستخدام الموبايل او الجوال


(system) #9

جزاك الله أخي خير الجزاء على ردك السريع …

ولكن لدي سؤال آخر … هل هذا النظام يستقبل مكالمة أو رسالة من الهاتف النقال ؟
وكيف سيتم استقبالها ؟

واعتذر عن أسئلتي الكثيرة …


(system) #10

علي فكرة دي كانت نفس فكرة مشروع تخرجي