RFPM2 – calibration

The RF Power Meter 2 (RFPM2) stores calibration constants in a file located in the (SPIFFS) file system in the microcontroller flash.

The WiFi credentials are stored separately at the default location in the flash.

Calibration constants

The AD8307 outputs a voltage from zero to about 3V for inputs from around -90 to +15dBm. The nominal output has a slope of 25mV/dB and intercept of -84dBm.

A starting point for RFPM2 calibration constants is intercept=-84 and slope=0.129.

Modules such as that used here may have pots to adjust the gain and offset of the output. Adjust the gain so that the maximum output voltage is a little lower than 3.3V (the maximum ADC input), say 2.7V.

Clip 194

The response of the AD8397 has some ripple in the transition between log amp stages. The log cell ranges are 14.3dB, so min error repeats every 14.3dB. My own practice is to calibrate at -62 and -5dBm input as they fall approximately on the mid line of the ripple trend (4 cycles of the error curve).

So, note the values for intercept and slope used in the running configuration (they are reported in the text log at startup), and write down the displayed reading for inputs -62 and -5dBm.

Example log showing calibration values in use.

Sketch size: 337488
Free size: 2805760

Mounted file system
Reading config file
Opened config file
{"hostname":"rfpm201","vref":3.3,"avg":3,"slope":0.129,"intercept":-84}
Parsed json
Connecting...
rfpm201 connecting to banksia

WiFi connected.
IP address: 
192.168.0.86
Hostname: 
rfpm201
Starting UDP
Local port: 8888
waiting for sync
Transmit NTP Request
pool.ntp.org: 13.55.50.68
Received NTP response

Enter the current values into the Slope – intercept calibration constants calculator as in the example below. Use the values from your own log, or the cfg.json file in your data directory.

Calculate the new calibration constants, and enter them into the cfg.json file in the data directory, connect the MCU to the PC and in the Arduino IDE, go to tools / ESP8266 Sketch Data Upload to creat a new SPIFFS image and load it to the MCU.

After upload, the log shows the new startup values.

Check the calibration with the new cal data. If it needs some fine adjustment, use the same calculator but starting with the current values and observed measurements.

Don’t touch the pots on the AD8307 module, otherwise you have to go through the process for the changed output conditions.