måndag 13 februari 2017

POWER METER



This power meter is now finished. A port is LTC5532 and port B and C is classic AD8307. I make my own PCB for this, today you can by AD8307 from Ebay sold for a few dollar.





I connected a LCD display and Encoder. Draw 5V from Arduino Uno to all tree PM boards. Output from A to A0, B to A1 and C to A2.
Then little sw doing the work.

LTC5532 can’t find a formula so I use my generator for input and read levels by ADC and put a table on my serial port than past in to the code, like this.

if(u0>3.4604)
  P1 = 8.0;
else if(u0>3.3822)
  P1 = 7.8;
else if(u0>3.3040)
  P1 = 7.6;
…………..
else
  P1= -21.2;

Then port A is working.
Port B and C. use my generator put in 0dBm and -40dBm read the level in V0 – V40/40 = x V/dB around 23 – 37 mV/db, put it in the code.

if(port==1)   //Cal Port B
{
   for(int i=0; i<10; i++)
     a1 = a1 + analogRead(A1);
   u1= a1/10;
   u1 = 5.0 * u1 /1023;
   pmSet.cal1 = u1;
}
 
To get stabile values I average 10 times.

P2 = (u1 - pmSet.cal1)/0.0242  + pmSet.atten[1] + freqComp[1][pmSet.freq[1]];

pmSet.cal1 = u1 att 0dBm input, calibrated in menu.
pmSet.atten = attenuation infront off power meter 0 – many dB integer values, set in menu.
freqComp[1][pmSet.freq[1]] = freq compensation set in code, measurd by generator @ 0dBm on varying frequencys (16 pcs.).
double freqComp[3][16] = {{0,0,0,0.3,0,-0.2,-0.1,-0.4,0.1,2.9,1.4,4.0,3.8,6.7,12.5,10.4},…….

Unit can be set dBm or W, in menu. Convert to W
if(pmSet.unit == 1) //Unit W
{
  P2 = pow(10,(P2-30)/10); 
}

Jumping over to new project, magnetic compass and PA 1296 MHz, stay tuned.


Inga kommentarer:

Skicka en kommentar