0
\$\begingroup\$

I am trying to use the AD 8302 phase detector chip to obtain phase angle between antenna's receiving a RF signal due to the vertical separation of the antennas. I want to use the phase angle to calculate the distance from the transmitter to the receiving antennas that are placed on an upright wooden platform. These antennas have a vertical separation of 5 ft from each other. I use RF SMA cables to connect to the phase detector and have stripped each end to create antennas.

The transmitter operates on 433 MHz and its the generic transmitter/ receiver pair. The phase detector gives me phase output in terms of Volts that has a range of 30mV to 1.8 V. In the data sheet this range represents 180 degrees to 0 degrees. The outputs from the phase detector chip go into the arduino and that is how I make the calculations for the distance as well as the angle.

I have calculated antenna lengths (reception antenna's using SMA cable) for Quarter Wavelength.

These are the relevant links: Chip: http://www.analog.com/media/en/technical-documentation/data-sheets/AD8302.pdf

Transmitter/Receiver: https://www.amazon.com/UCEC-XY-MK-5V-Transmitter-Receiver-Raspberry/dp/B017AYH5G0/ref=pd_lpo_vtph_147_bs_t_1?_encoding=UTF8&psc=1&refRID=CTNNV120F5GWXTBJ6K2G

This is to calculate antenna length using a piece of wire: http://www.csgnetwork.com/antennagenericfreqlencalc.html

I am not able to obtain the correct phase angle needed to calculate the distance from the transmitter to the antennas.

PIC_1 is the structure and PIC_2 is the transmitter. PIC_1 is the structure PIC_2 is the transmitter

This is the code for the transmitter:

#define rfTransmitPin 12  //RF Transmitter pin = digital pin 12
#define ledPin 13        //Onboard LED = digital pin 13

void setup(){
  pinMode(rfTransmitPin, OUTPUT);     
  pinMode(ledPin, OUTPUT);    
}

void loop(){
  //for(int i=4000; i>5; i=i/800){
    digitalWrite(rfTransmitPin, HIGH);     //Transmit a HIGH signal
    digitalWrite(ledPin, HIGH);            //Turn the LED on
    //delay(2000);                           //Wait for 1 second

   // digitalWrite(rfTransmitPin,LOW);      //Transmit a LOW signal
   // digitalWrite(ledPin, LOW);            //Turn the LED off
   // delay(i);                            //Variable delay
 // }
}

This is the code for the Receiver:

//#define rfReceivePin 8  //RF Receiver pin = Analog pin 0
#define vmag A1 
#define vphs A0
#define ledPin 13        //Onboard LED = digital pin 13
//int vphs = 0;
//int vmag = 1;
unsigned int data = 0;   // variable used to store received data
unsigned int DATA = 0; 
unsigned int data1 = 0;
unsigned int DATA1 = 0;

const unsigned int upperThreshold = 70;  //upper threshold value
const unsigned int lowerThreshold = 50;  //lower threshold value

String angle="Angle:";
String mag="Vmag:";
String dis="Distance";


void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(vmag,INPUT);
  pinMode(vphs,INPUT);
  analogReference(DEFAULT);
  Serial.begin(9600);
}

void loop(){
  data = analogRead(vphs);    //listen for data on Analog pin 0
  data1 = analogRead(vmag);
  //data=analogRead(rfReceivePin)
  /*Serial.println(((data)/10)*2);*/
  /*DATA=*/
  Serial.print(angle);
  Serial.println((((data)/10)*2)-40);
  Serial.print(dis);
  Serial.println((5/tan(data)));
  delay(500);

  /*DATA1*/
  Serial.print(mag);
  Serial.println(((data1)/30)*2);

  delay(500);
  //Serial.println(6/tan(DATA*(180/3.14)));

 /* if(data>upperThreshold){
    digitalWrite(ledPin, LOW);   //If a LOW signal is received, turn LED OFF
    Serial.println(data);
  }

  if(data<lowerThreshold){
    digitalWrite(ledPin, HIGH);   //If a HIGH signal is received, turn LED ON
    Serial.println(data);

  }*/
}

Please do help.

\$\endgroup\$
  • 1
    \$\begingroup\$ "I am not able to obtain the correct phase angle" is like saying to the doctor that you are ill and nothing else, please send me a cure. \$\endgroup\$ – Andy aka May 12 '18 at 8:44
  • \$\begingroup\$ How do you avoid ambiguity in the distance computation? \$\endgroup\$ – analogsystemsrf May 12 '18 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.