• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
Previous Next

How to use Caller ID Module with Arduino

Posted by: , January 31, 2015

[vc_row][vc_column][vc_column_text]图片1

 

In this tutorial, we show how to use LinkSprite caller ID module with Arduino. The chipset used on this module HT9032D. When someone is calling  (the calling telephone must not be private number), the caller ID module will output the caller ID through the  serial port (TTL level) in the format of  hexadecimal data. The packet includes date/time/phone number, etc.  The package will consist of bytes showing call coming, which shows ox55 for more than ten times, then followed by  ox04, after which will be bytes represent data length/date/time/phone number/BCC.[/vc_column_text][vc_tour][vc_tab title=”Items List” tab_id=”1422713031-1-25″][vc_column_text]

  • Arduino UNO  x1
  • Caller ID Module  x1
  • LCD1602 A Shield  x1
  • Screw Shield  x1(If it is LCD1602 B Shield,don’t need it)
  • Male – female jumper wires  x3

图片2[/vc_column_text][/vc_tab][vc_tab title=”Wire diagram ” tab_id=”1422713031-2-38″][vc_column_text]Call ID Module +5V  –>  Arduino 5V

Call ID Module GND  –>  Arduino GND

Call ID Module RXD  –>  Arduino RXD

 

图片3

图片4[/vc_column_text][/vc_tab][vc_tab title=”Test code” tab_id=”1422714581726-2-9″][vc_column_text]

#include <LiquidCrystal.h>
#define LCD_BACKLIGHT_PIN 10
LiquidCrystal lcd(8, 13, 9, 4, 5, 6, 7);

static int Ht9032_flag=0;
static int Ht9032_i=0;
static char Ht9032_code[25];
static int Ht9032_codeleng=0;
char SBUF0 = 0;

void setup()
{
  pinMode(10,OUTPUT);
  digitalWrite( LCD_BACKLIGHT_PIN, LOW ); 
  delay(200);
  lcd.begin(16, 2);
  lcd.clear();
  digitalWrite( LCD_BACKLIGHT_PIN, HIGH); 
  lcd.setCursor(0,0);
  lcd.print("Test Code V1.0"); 
  lcd.setCursor(0,1);
  lcd.print("Waiting Caller..");

  Serial.begin(1200);
  delay(100);
}

void loop()
{
  Ht9032_get();
}

void Serial_display()
{
  for(int i=1;i<Ht9032_codeleng+1;i++)
  {
    Serial.print(char(Ht9032_code[i]));
    Serial.print("/");
  }
}

void lcd_display()
{
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("DATE:");
  lcd.print(char(Ht9032_code[1]));
  lcd.print(char(Ht9032_code[2]));
  lcd.print('/');
  lcd.print(char(Ht9032_code[3]));
  lcd.print(char(Ht9032_code[4]));
  lcd.print(" ");
  lcd.print(char(Ht9032_code[5]));
  lcd.print(char(Ht9032_code[6]));
  lcd.print(':');
  lcd.print(char(Ht9032_code[7]));
  lcd.print(char(Ht9032_code[8]));

  lcd.setCursor(0,1);
  lcd.print("NO.:");

  for(int i=9;i<Ht9032_codeleng+1;i++)
  {
     lcd.print(char(Ht9032_code[i]));
  }
}

void Ht9032_get()
{
  while (Serial.available() > 0)  
  {
  Serial.flush();
  SBUF0 = Serial.read();  
  switch(Ht9032_flag)
  {
    case 0x00:if (SBUF0==0x55)  
               {
                 Ht9032_flag=0x01;
                 Ht9032_i=0x01;
               }break;

    case 0x01:if (SBUF0==0x55) 
               {
                 Ht9032_i++;
               }                        
               else
               {
                 Ht9032_flag=0x00;
                 Ht9032_i=0x00;
        }
               if(Ht9032_i==0x0a)
               {
                 Ht9032_flag=0x02;
                 Ht9032_i=0x00;
               }break;

    case 0x02:if(SBUF0==0x04) 
          {
                Ht9032_flag=0x03;
              }
              else if(SBUF0==0x80)
              {
                Ht9032_flag=0x03;
               }break;

     case 0x03:Ht9032_codeleng = SBUF0; 
               Ht9032_i=0;
               Ht9032_code[Ht9032_i++]=Ht9032_codeleng;
               Ht9032_flag=0x04;                                        
               break;

    case 0x04:Serial.print(Ht9032_code[Ht9032_i-1],HEX);
              Ht9032_code[Ht9032_i++]=SBUF0;  
              if( Ht9032_i > Ht9032_codeleng+1 ) 
         {  
                //Serial_display();
                lcd_display();
            Ht9032_flag=0x00;
        Ht9032_i=0x00;                              
          }
              else
              { Ht9032_flag=0x04; }
          break;
     default:break;
   }
  }
}

[/vc_column_text][/vc_tab][vc_tab title=”Run test” tab_id=”1422714582617-3-2″][vc_column_text]1. First finish the connection of the wire according to the wire diagram.

2. Then copy the test code to Arduino IDE, then download the code

图片5

3. If someone is calling, it will show the data,time and phone number, the effect will show below:

图片6图片7[/vc_column_text][/vc_tab][vc_tab title=”Download file ” tab_id=”1422715137030-4-9″][vc_column_text]Type I caller ID using the HT9032[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]

Share!
Tweet

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors