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.

URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sensor

Status
Not open for further replies.

redwan_3e

Newbie level 4
Joined
Nov 3, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,355
URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sensor

I Want to Make a Distance Measurement & Indication System Using Ultrasonic Sensor (TS601-01). It Should Consist of A LCD Screen to Display Distance & LED With 1 Green & 1 Red. Green LED Should Always Be Lighten Up When the Car (toy) Containing The Sensor is in Safe Distance (> 5 CM), But When The Car with the Sensor reaches in Critical Distance (<= 5CM) Then The Red LED Should Be Lighten Up. Also, RED LED Should Be Engaged With 1 Beeper Which Will Start Beep Until Red LED Offs & Green LED Lighten Up.

This Whole Process Should Be With 1 MCU (PIC 16f877 or AtMega32) With 2 System(2 Sensor, 2 Green, 2 RED Indicator-- 1is On Front side of Toy Car & Another One is In Back Side)

Will You Please Help Me Providing The Code With Proteous Schemetic?? I NEED THIS WITHIN 15-01-13 (Tuesday) . PLEASE Consider This POST As an URGENT ONE. :)

Thank you in Advance.
 

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

This forum is to guide who have started something... no one will provide you the ready made material
Please don't repeat
 

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

This forum is to guide who have started something... no one will provide you the ready made material
Please don't repeat

Sorry Brother. May Be I Couldn't Make you understand. Actually I've Started electronics & micro controller based Project developed At least before 3 years. this project is also partially done(only distance measurement+show distance) with HC sr04 (4-pin) sensor. But need to do it with 3-pin ping sensor.
This Subjects/stuffs are not Newer rather much more older to me. Don't Consider this Redwan as Newbie.

Thank you very much for response.
:)
 

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

You calculate the time between transmission and reception of the ultrasonic waves and convert it to distance.
 

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen



Brother, I Have Observed It Earlier. Yes Its Pretty Useful. But The Sensor Part is ome Made & Have Only 2 Pins For Operation. But TS601-01 Is 3 Pinned Sensor having GND,VDD & 1 Pin For Sensing . Actually, I'm Having Problem With This One Because Its Not Showing Me Distance When The Sensor is Plugged in With The Ckt. Rather When the Sensor is not Inserted, LCD Displays Garbage Value & not- synchronized Data!! Its Really Harrasing Me More Because I Cant Understand Whether the Sensor is Ok or not as its manufacturing country is china & of rarely used, so may be some defects with sensor.. :-/ :-/
 

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

Can you give me the link for your sensor. Do you have a datasheet of your sensor? If yes, post it.
 

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

Can you give me the link for your sensor. Do you have a datasheet of your sensor? If yes, post it.

here is the datasheet brother. The Sensor I Have In My Hand, Have No Sign of VDD/GND/Sense Marking on The Hardware , Whereas, HC sr04 has indication on the Hardware board of Pin Configuration..so, Still I Have Confusion, If My Sensor Has Different Pin Configuration or have the conventional One?? :-/ :-/
 

Attachments

  • TS601-01.pdf
    124.2 KB · Views: 58

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

On the PCB of the sensor there will be markings like + and -. See if any pin is connected to the track which has + marking, that is the Vcc pin.

See this link **broken link removed**

See the picture and the dimension picture. Observe the holes on the PCB of the sensor. They are showing the Front View of the Sensor with pins below. If they were showing the back view of the sensor then the holes would be opposite in the dimension picture.

So in the Front View the pins from Left to Right are GND, +5V, and SIG
 
Last edited:

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

On the PCB of the sensor there will be markings like + and -. See if any pin is connected to the track which has + marking, that is the Vcc pin.

See this link **broken link removed**

See the picture and the dimension picture. Observe the holes on the PCB of the sensor. They are showing the Front View of the Sensor with pins below. If they were showing the back view of the sensor then the holes would be opposite in the dimension picture.

So in the Front View the pins from Left to Right are GND, +5V, and SIG

No Brother, There IS No MArking On The Sensor...NOT A SINGLE Mark Even Without Sensor Model Number...:(
Yes, I'm Also Using This Segmentation,U have Decribed Above. But Alas, No Outout..But I'm Pretty Much Sure About The Correct Circuit Diagram. I Think Now, I've to Go For Another Kind of Sensor For Execution. :S :S
 

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

Can you post your code?

Sample Code Is Something Like This:


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
 
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
 
unsigned tOld, tNew;
char edge = 0;
char capture = 0;
unsigned tword;
int distance;
 
//Functions
void interrupt();
 
 
//main function
void main() {
 
  int no1,no2;
  char display[7];
  char display1[7];
  Lcd_Init();                        // Initialize LCD
  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
 
  TRISC = 0;        // assign PORTC as output
  TRISC.B2 = 1;     // RC2 must be input
  T1CON = 0x1;      // Timer1 ON, internal clock Fosc/4
  INTCON.GIE = 1;   //Enable Global Interrupts
  INTCON.PEIE =1;   //Enable Peripheral Interrupts
  PIE1.CCP1IE = 1;  // enable interrupt capture
  TRISD=0;
  PORTD=0;
  CCP1CON = 0x04;   // Capture mode every falling edge
 
  Lcd_Out(1,1,"   Measure the    ");
  Lcd_Out(2,1," distance  using  ");
  Delay_ms(1000);
  Lcd_Out(1,1,"   Ultrasonic     ");
  Lcd_Out(2,1,"     Sensor       ");
  Delay_ms(1000);
  Lcd_Cmd(_LCD_CLEAR);
  Delay_ms(500);
 
  Lcd_Out(1,1,"Distance is:");       //Display Charactors on the LCD
 
 while(1){       //Start never ending while loop
 
  if(capture){
  PIE1.CCP1IE = 0; // disable interrupt while processing
  capture = 0;     // clear flag
 
  // Calculate length of pulse from rising edge to rising edge
  tword = ~tOld + tNew+1;
  // tword contain length of pulse in micro second
  distance=tword /58.2;      // 29.1 us = 1cm
 
  Lcd_Out(2,1,distance);
 
  Lcd_Out(2,11,"c");
  Lcd_Out(2,12,"m");
  
  
   if (distance>=5) {  //MODIFIED
     PORTD = 0xf0;
     }
   else if (distance<5) { //MODIFIED
     PORTD = 0x0f;
     }
 
 
 
  PIR1.CCP1IF = 0; // clear CCP flag
  PIE1.CCP1IE = 1; // enable interrupt
 
 }
 
}// End of while
 
} // End of main
 
void interrupt() {
 
if(PIR1.CCP1IF==1){          //Check CCP1 enterrupt
 
if(!edge){
tOld = (256*CCPR1H)+CCPR1L; // keep starting value
edge = 1;
PIE1.CCP1IE = 0;            // disable interrupt for change
CCP1CON = 0x05;             // Capture mode every rising edge
PIE1.CCP1IE = 1;            // Enable interrupt capture
 
}else{
tNew = (256*CCPR1H)+CCPR1L; // Keep ending value
capture = 1;                // Complete capture, set a flag
edge = 0;
PIE1.CCP1IE = 0;           // disable interrupt for change
CCP1CON = 0x04;            // Capture mode every falling edge
PIE1.CCP1IE = 1;           // Enable interrupt capture
 
}
 
PIR1.CCP1IF = 0; //Clear CCP flag
}
}

 
Last edited by a moderator:

Re: URGENT!!: Distance Measurement System Using PIC 16f877 & TS601-01 Ultrasonic Sen

Using an oscilloscope, what signal do you see on the SIG pin?

Keith
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top