Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Control Home Appliances Via Telephone Line

Status
Not open for further replies.

rezaf

Advanced Member level 4
Joined
Apr 11, 2009
Messages
106
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Location
Montagram
Activity points
2,147
Dear Friends,
I drawn a schematic circuit for controlling home appliances via telephone line with using of datasheets and web sites. Please review my circuit and tell me if any wrong see in that.
Very Tanks.
Best Regards.
 

Attachments

  • Control Home Appliances by Tel Line-Reza F.pdf
    57 KB · Views: 135

Hi,
Schematic should be OK but you'll definitely have troubles with building the project because there are no debugging features - no ISP program connector, on Reset line there is huge capacitor and small resistor. When you make project keep in mind that the hardest part is to make it working and that you'll need debugging features. I would suggest you buy ICD2 or ICD3 debuggers or some clones - otherwise it is hopeless.
 
  • Like
Reactions: rezaf

    rezaf

    Points: 2
    Helpful Answer Positive Rating
Very Thanks for your reply and review. ok you said true, I add ISP connector to circuit, but please say to me that what capacitor and resistor is recommended for reset line??
 

From my experience resistor on reset line should be > 10K, capacitance could be couple of uF but need to be disconnected for programming (some jumper). BTW, the chip has internal brown out detection so it's not necessary to use external reset . The brown out detection plus a good software delay in the beginning of the main routine work better than what you try to make. Reset line has internal pull up so you can completely leave Reset line free, personally I put one resistor 100K to Vdd for peace of mind.
 
  • Like
Reactions: rezaf

    rezaf

    Points: 2
    Helpful Answer Positive Rating
I changed the circuit to resolve the problems and attached again.
 

Attachments

  • Control Home Appliances by Tel Line-Reza F.pdf
    58.8 KB · Views: 94

The diode D3 makes no sense - reset is active low so it's impossible C14 to pull down the reset line. Just remove D3, C14, R18 - believe me, if you use brown out detect and 0.5s delay in the beginning of the program you'll never have problems.

I don't understand the reason of D13 eighter. C4, C6, C7, C8 should be ceramic capacitors, I don't see decoupling capacitors on U6 (very mportant)

Also there is something wrong with the relay RL1 - usually when you open the phone you need to create DC current loading on the phone line to tell the central that line is busy. Because of C1 and C2 the central will not understand that the line is opened and will continue ringing.
 

I found information about this project and the parts that you said, in the application note of MT8870 and attached it to reply. Please see that(closer in pages: A-51 for D3, A-61, A-62, and other pages).
the C14 & R18 is a part of ICSP port and I found that in PIC18 reference manuals in the past, but if is not true, I remove this parts.
D13 is a part of Beep section that the MCU send Beep sound with that section to the remote user for acknowledgment of receiving codes purpose.
according to datasheet of MAX232 the C4 to C8 can be ceramic or electrolytic (with observe polarity) but don't said that what ceramic capacitor is recommended.
according to your view, I added a decoupling capacitor to supply unit after 7805.
the C1 and C2 is part of DTMF decoding circuit and drawn in MT8870 dataheet. but if you think the place of RL1 is wrong, say to me what place is better for that??
Best Regards.
 

Attachments

  • mt8870_dtmf decoder (application notes)_2.pdf
    401 KB · Views: 111

Please Note that I maked the dtmf decoder section in past days according to the below link and it worked correctly. now I added PIC and Ring detector sections to automating the circuit and controlling devices.
**broken link removed**
Thanks.
 

Hi,
I don't want to argue - if your schematic works and you don't have problems, it's fine. But the telephone central standard is as follows:
1. In order to tell the central that you pick up the phone you need to make 20mA DC current to flow in the line. Usually it's made by putting in parallel to the line a 600 Ohm impedance. Some new centrals can even detect 10mA current as "picked line", the old style centrals are working with up to 30mA.

So if you have capacitors in serial with the line according to the standard you can't make this 20mA to flow and hence there will be no "pick up phone" event.

IMHO you need to change the schematic and to add 600 Ohm impedance loading when you pick up the phone.
 
  • Like
Reactions: rezaf

    rezaf

    Points: 2
    Helpful Answer Positive Rating
Hi,
Very thanks for the time you give me to help resolve the circuit's problems. I changed the circuit and add 600 ohm inductance. Please see the picture attaced. I do True?
 

Attachments

  • Capture.JPG
    Capture.JPG
    148.1 KB · Views: 113

Thanks luben111 . I make the PCB of this project and assembled and take best answer from that with a few changes that I attached in a new PDF file and the C code for use of other friends.:smile: the only problem is that the volum of beep sound is very low.:sad: I insert +5 on the RD6 pin of PIC for beep sound.
below is the code I written for this project(this code worked correctly but can be improved yet):

Code:
/*
* Author :
    Reza F
*/

//*----------------------------------------------
//Configurations and Functions
//*----------------------------------------------

// LCD module connections
sbit LCD_RS at RC4_bit;
sbit LCD_EN at RC5_bit;
sbit LCD_D4 at RC0_bit;
sbit LCD_D5 at RC1_bit;
sbit LCD_D6 at RC2_bit;
sbit LCD_D7 at RC3_bit;

sbit LCD_RS_Direction at TRISC4_bit;
sbit LCD_EN_Direction at TRISC5_bit;
sbit LCD_D4_Direction at TRISC0_bit;
sbit LCD_D5_Direction at TRISC1_bit;
sbit LCD_D6_Direction at TRISC2_bit;
sbit LCD_D7_Direction at TRISC3_bit;
// End LCD module connections

char txt1[] = "Reza F";
char txt2[] = "Tel Remote";
char i;                              // Loop variable
char tone[2];
char tone2[2];
char password[4];
char password2[4] = {'1','2','3','4'};
char txt[4];

void Move_Delay() {                  // Function used for text moving
  Delay_ms(500);                     // You can change the moving speed here
}

void Disconnect() {
      delay_ms(2000);
      RD3_bit = 0;                       //Disconnect - off hook relay off
}

char Decode() {
     if((RA0_bit==0) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '0';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==0) && (RA2_bit==0) && (RA3_bit==0))
      {tone[1] = '1';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==0))
      {tone[1] = '2';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==0))
      {tone[1] = '3';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==0) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '4';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==0) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '5';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==1) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '6';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==1) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '7';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==0) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '8';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==0) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '9';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '*';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==0) && (RA2_bit==1) && (RA3_bit==1))
      {tone[1] = '#';
      return tone[1];}
}

//*----------------------------------------------
//Main - Initialization
//*----------------------------------------------

void main() {

 CCP1CON = 0x00;                       // turn off comparators
 ADCON1 |= 0x07;                      // turn off analog inputs
 
 TRISC0_bit = 0;           //output - LCD
 TRISC1_bit = 0;
 TRISC2_bit = 0;
 TRISC3_bit = 0;
 TRISC4_bit = 0;
 TRISC5_bit = 0;
 PORTC = 0xFF;

 TRISA0_bit = 1;           //input - MT8870 and Ring
 TRISA1_bit = 1;
 TRISA2_bit = 1;
 TRISA3_bit = 1;
 TRISA4_bit = 1;
 TRISA5_bit = 1;


 TRISD0_bit = 0x00;           //output (Relays)
 TRISD1_bit = 0x00;
 TRISD2_bit = 0x00;
 TRISD3_bit = 0x00;
 
 TRISD6_bit = 0x00;           //output (BEEP)
 TRISE = 1;

 PORTD = 0;                  //Relays off (active high)

 RD6_bit = 0;                //Beep off

 i = 1;                              // Loop variable
 tone[1] = 0;
 tone2[1] = 0;
 
 Lcd_Init();                // Initialize LCD
 Sound_Init(&PORTD, 6);
 UART1_Init(9600);          // Initialize UART module at 9600 bps
 Delay_ms(100);
 
 Lcd_Cmd(_LCD_CLEAR);                // Clear display
 Lcd_Cmd(_LCD_CURSOR_OFF);           // Cursor off
 Lcd_Out(1,4,txt1);                 // Write text in first row
 Lcd_Out(2,1,txt2);                 // Write text in second row

 UART1_Write_Text("\r");
 UART1_Write_Text("\n");
 Delay_ms(1000);
 
//*----------------------------------------------
//Main - Body
//*----------------------------------------------
do{
  if(RA5_bit == 0)                      //Ring Detect
   {
    delay_ms(1000);
    Lcd_Cmd(_LCD_CLEAR);                // Clear display
    RD3_bit = 1;                        //off hook relay on (Line Connect)
   }
  if (RA4_bit == 1)                    //STD is high (new number is ready in output of MT8870)
     {
       tone2[1] = Decode();
   switch(tone2[1]){
    case '0':                 //Number 0 selected
      Lcd_Out(1,1,"0");
      break;
    case '1':                //Number 1 selected
      RD0_bit = 1;
      Lcd_Out(1,2,"1");
      Lcd_Out(2,1,"Relay 1 Active");
      break;
    case '2':                //Number 2 selected
      RD1_bit = 1;
      Lcd_Out(1,3,"2");
      Lcd_Out(2,1,"Relay 2 Active");
      break;
    case '3':
      RD2_bit = 1;
      Lcd_Out(1,4,"3");
      Lcd_Out(2,1,"Relay 3 Active");
      break;
    case '4':
      RD0_bit = 0;
      Lcd_Out(1,5,"4");
      Lcd_Out(2,1,"Relay 1 Deactivate");
      break;
    case '5':
      RD1_bit = 0;
      Lcd_Out(1,6,"5");
      Lcd_Out(2,1,"Relay 2 Deactivate");
      break;
    case '6':
      RD2_bit = 0;
      Lcd_Out(1,7,"6");
      Lcd_Out(2,1,"Relay 3 Deactivate");
      break;
    case '7':
      Lcd_Out(1,8,"7");
      break;
    case '8':
      Lcd_Out(1,9,"8");
      break;
    case '9':
      Lcd_Out(1,10,"9");
      break;
    case '*':
      Lcd_Out(1,11,"*");
      break;
    case '#':
      Lcd_Out(1,12,"#");
      Disconnect();
      delay_ms(3000);
      Lcd_Cmd(_LCD_CLEAR);
      Lcd_Out(1,4,txt1);                 // Write text in first row
      Lcd_Out(2,1,txt2);                 // Write text in second row
      break;
    }
  }
}while(1);

}
 

Attachments

  • Schem.pdf
    65.6 KB · Views: 110
Last edited:

how can you detect if there's a ring ?
never mind it, I know already, the MCU will control the relay if there's a ring....

---------- Post added at 11:09 ---------- Previous post was at 10:41 ----------

Thanks luben111 . I make the PCB of this project and assembled and take best answer from that with a few changes that I attached in a new PDF file and the C code for use of other friends.:smile: the only problem is that the volum of beep sound is very low.:sad: I insert +5 on the RD6 pin of PIC for beep sound.
below is the code I written for this project(this code worked correctly but can be improved yet):

Code:
/*
* Author :
    Reza F
*/

//*----------------------------------------------
//Configurations and Functions
//*----------------------------------------------

// LCD module connections
sbit LCD_RS at RC4_bit;
sbit LCD_EN at RC5_bit;
sbit LCD_D4 at RC0_bit;
sbit LCD_D5 at RC1_bit;
sbit LCD_D6 at RC2_bit;
sbit LCD_D7 at RC3_bit;

sbit LCD_RS_Direction at TRISC4_bit;
sbit LCD_EN_Direction at TRISC5_bit;
sbit LCD_D4_Direction at TRISC0_bit;
sbit LCD_D5_Direction at TRISC1_bit;
sbit LCD_D6_Direction at TRISC2_bit;
sbit LCD_D7_Direction at TRISC3_bit;
// End LCD module connections

char txt1[] = "Reza F";
char txt2[] = "Tel Remote";
char i;                              // Loop variable
char tone[2];
char tone2[2];
char password[4];
char password2[4] = {'1','2','3','4'};
char txt[4];

void Move_Delay() {                  // Function used for text moving
  Delay_ms(500);                     // You can change the moving speed here
}

void Disconnect() {
      delay_ms(2000);
      RD3_bit = 0;                       //Disconnect - off hook relay off
}

char Decode() {
     if((RA0_bit==0) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '0';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==0) && (RA2_bit==0) && (RA3_bit==0))
      {tone[1] = '1';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==0))
      {tone[1] = '2';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==0))
      {tone[1] = '3';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==0) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '4';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==0) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '5';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==1) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '6';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==1) && (RA2_bit==1) && (RA3_bit==0))
      {tone[1] = '7';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==0) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '8';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==0) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '9';
      return tone[1];}
     else if((RA0_bit==1) && (RA1_bit==1) && (RA2_bit==0) && (RA3_bit==1))
      {tone[1] = '*';
      return tone[1];}
     else if((RA0_bit==0) && (RA1_bit==0) && (RA2_bit==1) && (RA3_bit==1))
      {tone[1] = '#';
      return tone[1];}
}

//*----------------------------------------------
//Main - Initialization
//*----------------------------------------------

void main() {

 CCP1CON = 0x00;                       // turn off comparators
 ADCON1 |= 0x07;                      // turn off analog inputs
 
 TRISC0_bit = 0;           //output - LCD
 TRISC1_bit = 0;
 TRISC2_bit = 0;
 TRISC3_bit = 0;
 TRISC4_bit = 0;
 TRISC5_bit = 0;
 PORTC = 0xFF;

 TRISA0_bit = 1;           //input - MT8870 and Ring
 TRISA1_bit = 1;
 TRISA2_bit = 1;
 TRISA3_bit = 1;
 TRISA4_bit = 1;
 TRISA5_bit = 1;


 TRISD0_bit = 0x00;           //output (Relays)
 TRISD1_bit = 0x00;
 TRISD2_bit = 0x00;
 TRISD3_bit = 0x00;
 
 TRISD6_bit = 0x00;           //output (BEEP)
 TRISE = 1;

 PORTD = 0;                  //Relays off (active high)

 RD6_bit = 0;                //Beep off

 i = 1;                              // Loop variable
 tone[1] = 0;
 tone2[1] = 0;
 
 Lcd_Init();                // Initialize LCD
 Sound_Init(&PORTD, 6);
 UART1_Init(9600);          // Initialize UART module at 9600 bps
 Delay_ms(100);
 
 Lcd_Cmd(_LCD_CLEAR);                // Clear display
 Lcd_Cmd(_LCD_CURSOR_OFF);           // Cursor off
 Lcd_Out(1,4,txt1);                 // Write text in first row
 Lcd_Out(2,1,txt2);                 // Write text in second row

 UART1_Write_Text("\r");
 UART1_Write_Text("\n");
 Delay_ms(1000);
 
//*----------------------------------------------
//Main - Body
//*----------------------------------------------
do{
  if(RA5_bit == 0)                      //Ring Detect
   {
    delay_ms(1000);
    Lcd_Cmd(_LCD_CLEAR);                // Clear display
    RD3_bit = 1;                        //off hook relay on (Line Connect)
   }
  if (RA4_bit == 1)                    //STD is high (new number is ready in output of MT8870)
     {
       tone2[1] = Decode();
   switch(tone2[1]){
    case '0':                 //Number 0 selected
      Lcd_Out(1,1,"0");
      break;
    case '1':                //Number 1 selected
      RD0_bit = 1;
      Lcd_Out(1,2,"1");
      Lcd_Out(2,1,"Relay 1 Active");
      break;
    case '2':                //Number 2 selected
      RD1_bit = 1;
      Lcd_Out(1,3,"2");
      Lcd_Out(2,1,"Relay 2 Active");
      break;
    case '3':
      RD2_bit = 1;
      Lcd_Out(1,4,"3");
      Lcd_Out(2,1,"Relay 3 Active");
      break;
    case '4':
      RD0_bit = 0;
      Lcd_Out(1,5,"4");
      Lcd_Out(2,1,"Relay 1 Deactivate");
      break;
    case '5':
      RD1_bit = 0;
      Lcd_Out(1,6,"5");
      Lcd_Out(2,1,"Relay 2 Deactivate");
      break;
    case '6':
      RD2_bit = 0;
      Lcd_Out(1,7,"6");
      Lcd_Out(2,1,"Relay 3 Deactivate");
      break;
    case '7':
      Lcd_Out(1,8,"7");
      break;
    case '8':
      Lcd_Out(1,9,"8");
      break;
    case '9':
      Lcd_Out(1,10,"9");
      break;
    case '*':
      Lcd_Out(1,11,"*");
      break;
    case '#':
      Lcd_Out(1,12,"#");
      Disconnect();
      delay_ms(3000);
      Lcd_Cmd(_LCD_CLEAR);
      Lcd_Out(1,4,txt1);                 // Write text in first row
      Lcd_Out(2,1,txt2);                 // Write text in second row
      break;
    }
  }
}while(1);

}

may be you can put transistor to amplify your beep ...
 
Last edited:


Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top