20103 views|92 replies

693

Posts

7

Resources
The OP
 

Beacon navigation sound positioning and recognition - analysis of sound source positioning algorithm [Copy link]

 
 

1. Analysis of TDOA (Time Difference Algorithm) Principle

A commonly used method for sound localization ( time difference method ): the position of an unknown node ( sound module ) is calculated by measuring the time difference between the sound signal reaching two different anchor nodes ( sound receiving modules ) . The principle is shown below:

Where r12 represents the distance difference between the unknown node and anchor node 1 and the distance difference between the unknown node and anchor node 2 ; r23 represents the distance difference between the unknown node and anchor node 2 and the distance difference between the unknown node and anchor node 3 ; Assume that the coordinates of the three anchor nodes and the coordinates of the unknown node are :

Anchor node 1: (x1, y1)

Anchor node 2: (x2, y2)

Anchor node 3: (x3, y3)

Unknown node coordinates : (x0, y0)

The time when the unknown node reaches the anchor node is t 1 , t 2 and t 3 , then the distance difference between the unknown node and the anchor node is :

r 12 =r 1 -r 2 =c * t 1 -c * t 2 =c(t 1 - t 2 )

r 23 =r 2 -r 3 =c * t 2 -c * t 3 =c(t 2 - t 3 )

In the above formula, c is the speed of sound propagation in the air, which is generally 340m/s. From this, a set of hyperbolic equations can be established , as shown below:

The location of the unknown node ( the intersection of r12 and r23 ) can be obtained by solving the hyperbolic equations mathematically .

The distance between r 12 and r 23 is calculated based on the time difference and the speed of sound propagation. How to measure the time differenceΔT1 =t1- t2, ΔT1 =t2- t3 ? It depends on the beacon sound emission device.

However, the positioning accuracy and anti-interference ability of this method cannot reach the highest level and still need to be optimized.

2. Analysis of the actual application scenarios of H car models and beacon sites

Beacons are guided mainly by chirp sounds and RF signals. Chirp signals are discontinuous spectrum signals like the quacks of ducks. chirps声音_鹰短尾_ 啁啾03.mp3 (520.69 KB, downloads: 84)

The beacon venues are as follows:

The car model uses a H car model with Mecanum wheels. The size of the car model does not exceed 30cm square. It is assumed that a linear microphone array is installed. The microphone array can be found in Sound Localization - Microphone Array . Suppose the car model we build is like this:

The above algorithm can be used to lock the position of the sound source. The more control algorithm of the Mecanum wheel is the inverse motion algorithm. The linear microphone array can control the steering of the car. The RF signal can be used by the receiver to fit the distance to control the speed of the car.

3. TDOA ( Time Difference Algorithm ) Program Code

Please click on the video to see the positioning effect of linear microphone array using the above algorithm TDOA (time difference method): Linear microphone array positioning effect

Positioning algorithm code:

 if(INT1==1&&INT2==1&&INT3==1)
			   {
				
					printf("TimeDelay1=%.8f\t",TimeDelay1);
					printf("TimeDelay2=%.8f\t",TimeDelay2);
					printf("TimeDelay3=%.8f\t",TimeDelay3);
			/**************声源模块距离接受模块2最远时算法如下*********************/
					if(TimeDelay2>TimeDelay1&&TimeDelay2>TimeDelay3)
					{
						printf("接受模块2最远\n");
						d1=(TimeDelay2-TimeDelay1)*V;
						d2=(TimeDelay2-TimeDelay3)*V;
						printf("d1=%f\t",d1);
						printf("d2=%f\t",d2);
						A=4*(pow(d2,2)-pow(d1,2)-pow(a,2));
						printf("A=%f\t",A);
						B=4*(d2*pow(a,2)-pow(d2,3)+d1*pow(a,2)-pow(d1,3));
						printf("B=%f\t",B);
						C=pow((pow(a,2)-pow(d2,2)),2)-pow((pow(a,2)-pow(d1,2)),2);
						printf("C=%f\t",C);
					     X1=(-B+sqrt(pow(B,2)-4*A*C))/2.0*A;
						 X2=(-B-sqrt(pow(B,2)-4*A*C))/2.0*A;
											 	
						 if(X1>0)
						 { 	printf("X1=%d\t",X1);
						   sin=(pow(X1,2)+pow(a,2)-pow((X1-d1),2))/(2*a*X1);
						   printf("sin=%f\t",sin);
						   cos=(pow(X1,2)+pow(a,2)-pow((X1-d2),2))/(2*a*X1);
						   printf("cos=%f\t",cos);
						   x=X1*cos;
						   y=X1*sin;
						 }

						 if(X2>0)
						 {		
						    printf("X2=%d\t",X2);
						 	sin=(pow(X2,2)+pow(a,2)-pow((X2-d1),2))/(2*a*X2);
							printf("sin=%f\t",sin);
						    cos=(pow(X2,2)+pow(a,2)-pow((X2-d2),2))/(2*a*X2);
							printf("cos=%f\t",cos);
						 	x=X2*cos;
						    y=X2*sin;
						 }
					}
			 /**************声源模块距离接受模块2最近时算法如下*********************/
			  	if(TimeDelay2<TimeDelay1&&TimeDelay2<TimeDelay3)
					{
						printf("接受模块2最近\n");
						d1=(TimeDelay1-TimeDelay2)*V;
						d2=(TimeDelay3-TimeDelay2)*V;
						printf("d1=%f\t",d1);
						printf("d2=%f\t",d2);
						A=4*(pow(d2,2)-pow(d1,2)-pow(a,2));
						printf("A=%f\t",A);
						B=4*(d2*pow(a,2)+pow(d2,3)+d1*pow(a,2)+pow(d1,3));
						printf("B=%f\t",B);
						C=pow((pow(a,2)-pow(d2,2)),2)-pow((pow(a,2)-pow(d1,2)),2);
						printf("C=%f\t",C);
					    X1=(-B+sqrt(pow(B,2)-4*A*C))/2.0*A;
						X2=(-B-sqrt(pow(B,2)-4*A*C))/2.0*A;
//						 printf("X1=%d\t",X1);
//						 printf("X2=%d\t",X2);					 	 
						 if(X1>0)
						 {		 
						   sin=(pow(X1,2)+pow(a,2)-pow((X1+d1),2))/(2*a*X1);
						   printf("sin=%f\t",sin);
						   cos=(pow(X1,2)+pow(a,2)-pow((X1+d2),2))/(2*a*X1);
						   printf("cos=%f\t",cos);
						   x=X1*cos;
						   y=X1*sin;
						 }

						 if(X2>0)
						 {	 
						 	
						 	sin=(pow(X2,2)+pow(a,2)-pow((X2-d1),2))/(2*a*X2);
							printf("sin=%f\t",sin);
						    cos=(pow(X2,2)+pow(a,2)-pow((X2-d2),2))/(2*a*X2);
							printf("cos=%f\t",cos);
						 	x=X2*cos;
						    y=X2*sin;
						 }
					}
			 	 /**************声源模块距离接受模块1最近 接受模块3最远时算法如下*********************/
				  if(TimeDelay2>TimeDelay1&&TimeDelay2<TimeDelay3)
				  {
				    printf("接受模块3最远\t");
				  	d1=(TimeDelay2-TimeDelay1)*V;
				    d2=(TimeDelay3-TimeDelay2)*V;
					printf("d1=%f\t",d1);
					printf("d2=%f\t",d2);
			   	    B=4*(d2*pow(a,2)+pow(d2,3)+d1*pow(a,2)-pow(d1,3));
					printf("B=%f\t",B);
					A=4*(pow(d2,2)-pow(d1,1)-pow(a,2));
					printf("A=%f\t",A);
					C=pow((pow(a,2)-pow(d2,2)),2)-pow((pow(a,2)-pow(d1,2)),2);
					printf("C=%f\t",C);
					X1=((-B)+sqrt(pow(B,2)-(4*A*C)))/2.0*A;
					X2=((-B)-sqrt(pow(B,2)-(4*A*C)))/2.0*A;
									 
					
					if(X1>0)
					{		
					    printf("X1=%d\t",X1);	
					    sin=(pow(X1,2)+pow(a,2)-pow((X1-d1),2))/(2*a*X1);
						printf("sin=%f\t",sin);
					    cos=(pow(X1,2)+pow(a,2)-pow((X1+d2),2))/(2*a*X1);
						printf("cos=%f\t",cos);
						x=X1*cos;
						y=X1*sin;
					}
					 if(X2>0)
					 {	printf("X2=%d\t",X2);
					 	sin=(pow(X1,2)+pow(a,2)-pow((X1-d1),2))/(2*a*X1);
						printf("sin=%f\t",sin);
					    cos=(pow(X1,2)+pow(a,2)-pow((X1+d2),2))/(2*a*X1);
						printf("cos=%f\t",cos);
						x=X2*cos;
						y=X2*sin;
					 }
			   	   }
				/**************声源模块距离接受模块1最远 接受模块3最近时算法如下*********************/
					if(TimeDelay2>TimeDelay3&&TimeDelay2<TimeDelay1)
				  {
				  	printf("接受模块1最远\t");
				  	d1=(TimeDelay1-TimeDelay2)*V;
				    d2=(TimeDelay2-TimeDelay3)*V;
					printf("d1=%f\t",d1);
					printf("d2=%f\t",d2);
			   	    B=4*(d2*pow(a,2)-pow(d2,3)+d1*pow(a,2)+pow(d1,3));
					printf("B=%f\t",B);
					A=4*(pow(d2,2)-pow(d1,1)-pow(a,2));
					printf("A=%f\t",A);
					C=pow((pow(a,2)-pow(d2,2)),2)-pow((pow(a,2)-pow(d1,2)),2);
					printf("C=%f\t",C);
					X1=(-B+sqrt(pow(B,2)-4*A*C))/2.0*A;
					X2=(-B-sqrt(pow(B,2)-4*A*C))/2.0*A;
										 
					
					if(X1>0)
					{  	printf("X1=%d\t",X1);
					    sin=(pow(X1,2)+pow(a,2)-pow((X1+d1),2))/(2*a*X1);
						printf("sin=%f\t",sin);
					    cos=(pow(X1,2)+pow(a,2)-pow((X1-d2),2))/(2*a*X1);
						printf("cos=%f\t",cos);
						x=X1*cos;
						y=X1*sin;
					}
					 if(X2>0)
					 {	printf("X2=%d\t",X2);
					 	sin=(pow(X1,2)+pow(a,2)-pow((X1+d1),2))/(2*a*X1);
							printf("sin=%f\t",sin);
					    cos=(pow(X1,2)+pow(a,2)-pow((X1-d2),2))/(2*a*X1);
							printf("cos=%f\t",cos);
						x=X2*cos;
						y=X2*sin;
					 }
			   	   }
		  printf("横坐标X=%f\t",x);
		  printf("纵坐标Y=%f\t",y);
	                 INT1= INT2=INT3=0;
					 TimeDelay3=TimeDelay2=TimeDelay1=0;
					 Flag=0;
			   }

The code runs in KEIL5, C language. If you need a complete project, please leave your email address to communicate and learn together.

This post is from Innovation Lab

Latest reply

Senior, I would like to see your complete project and learn from it. My email address is hekuan88888@163.com  Details Published on 2024-5-5 16:11
 
 

1

Posts

0

Resources
2
 

Master, I am a newbie this year, please guide me: rshjh@qq.com, thank you!

This post is from Innovation Lab
 
 
 

2

Posts

0

Resources
3
 

God, I’m a newbie this year, please guide me: 761490193@qq.com, thank you!

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
4
 

Hello, I want to learn your code. If it is convenient for communication, can you send me a copy of your project? This is my email address 319024367@qq.com

This post is from Innovation Lab
 
 
 

2

Posts

0

Resources
5
 
Can you give me the complete project?
This post is from Innovation Lab
 
 
 

2

Posts

0

Resources
6
 
My email address is 2634655801@qq.com
This post is from Innovation Lab
 
 
 

3

Posts

0

Resources
7
 
Boss, can you send me some engineering tutorials? 874818045@qq.com, thank you .
This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
8
 
Boss, can you send me the complete project? My email address is 1873619703@qq.com.
This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
9
 

Thank you for sharing. My email address is 865439320@qq.com. I hope you can send me a project for exchange and study. Thank you.

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
10
 

Can you send me the complete code project? 2090147256@qq.com Thank you

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
11
 

Hello, I want to learn your code. If it is convenient for communication, can you send me a copy of your project? This is my email address 285619046@qq.com

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
12
 

Can you discuss this with me? My email address is 56672035@qq.com. My recent project is also stuck on this issue. Thank you for your guidance.

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
13
 

Hello, I have also been studying the sound source positioning of the beacon group recently. Thank you very much for your ideas. I hope to communicate and learn with you. Thank you! mi985211211100c@163.com

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
14
 

Senior, I want to learn this sound positioning, my email is 1776111872@qq.com

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
15
 

I would like to ask, does the "unknown node" in the text refer to the beacon location, and is the "anchor node" the microphone location? If so, why do we need to calculate r12 and r23?

This post is from Innovation Lab

Comments

The "unknown node" refers to the beacon location, and the "anchor node" is the microphone location. The coordinates of the beacon are solved by r12 and r23  Details Published on 2020-3-13 09:42
 
 
 

183

Posts

12

Resources
16
 

Thanks for sharing the core algorithm. I will learn it first.

This post is from Innovation Lab
 
 
 

1

Posts

0

Resources
17
 
Hello, can you share the complete project? 2591081434@qq.com, if you are interested in communication, you can also add me as a friend
This post is from Innovation Lab
 
 
 

693

Posts

7

Resources
18
 
Posted by No. 11 on 2020-3-12 20:30 I would like to ask, does the "unknown node" in the text refer to the beacon location, and is the "anchor node" the microphone location? If...

The "unknown node" refers to the beacon location, and the "anchor node" is the microphone location. The coordinates of the beacon are solved by r12 and r23

This post is from Innovation Lab
 
 
 

2

Posts

0

Resources
19
 
Hello, senior, my email address is 1964624254@qq.com, thank you, I really need your complete project
This post is from Innovation Lab
 
 
 

2

Posts

0

Resources
20
 

Senior, hello, I really need your complete project, my email address is 1964624254@qq.com, thank you

This post is from Innovation Lab
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list