LowPowerLab Forum

Hardware support => Moteino => Topic started by: john k2ox on September 25, 2013, 09:50:48 AM

Title: Freq drift vs Temp
Post by: john k2ox on September 25, 2013, 09:50:48 AM
QuoteModifyRemoveI collected some data today.  Using two Motes I tuned them to the same frequency at room temp.  One of them simply sent its temperature every second.  The other received it and printed it along with the contents of the AFC register.  I cut/pasted the serial mon data into Excel for the graph.

In the attached plot you can see at 22 deg C(room temp) the freq error is zero.  At -5C its 5.4KHz high.

I need to cool it down some more to get the critical data where the frq starts to come down again.  The full range plot will look like an 'S' laying sideways. Time for a little CO2.

After all the data has been captured it will be a simple matter of taking two or more motes at the same temp and doing a simple software calibration (kinda like pairing w/ BT) to get them all on the same freq and then use the temp readings correct the drift.

If all goes well, we should really be able to narrow the RX bandwidth to extend the range.  Every time you half the BW its like doubling the tx power.   

BTW I found a big error in my readTemp() function.  I'll post the fix.
Title: Re: Freq drift vs Temp
Post by: john k2ox on September 25, 2013, 09:52:14 AM
Here it is.
Title: Re: Freq drift vs Temp
Post by: john k2ox on September 25, 2013, 10:12:44 AM
Sorry.  I accidentally removed this topic and had to re-create it.  DOH

BTW.  The radios are much much better than I thought w/ respect to drift.   The absolute accuracy is the error at room temp + the drift can add up to more than 10KHz.  Worse case one radio goes high the other low, you get 20K.  I'm hoping to get that to about 1KHz.

Anyway, the 'pairing'.  I don't like that term, the 'Freq Cal' would work something like this.

1.  Two Motes,  One mote(slave) listens to the other(ref) in a one time cal mode and stores the val of the FEI
register to eeprom.  From then on it is always added to the desired freq.

2. Lots of Motes.  Same as above using the same reference(best).  Cal new motes with other cal'd motes(errors accumalate with the generations).

3. Expensive way.  Use a freq counter at 915, or on the clock out pin 32MHz/n.  Store to coef to eeprom.

4. Check with Felix.  Maybe he could provide cal'd radios as an add-on service.  ???

Title: Re: Freq drift vs Temp
Post by: englund on September 26, 2013, 05:38:01 AM
Hmm, is it possible for you to provide example code for calibration, I'm not quite sure how to translate you text into code :)

Any guesstimation when you can post the readTemp() function fix?
Title: Re: Freq drift vs Temp
Post by: john k2ox on September 26, 2013, 11:33:30 AM
Here you are.  If you're using my lib stick these in there or use the function in your sketch(remove the RFM69NEW::).


in the header file

#define COURSE_TEMP_COEF   161 // close cal coeff,  user can fine tune the returned value in the function call

int readTemp(int calFactor = 0);  //fuction prototype in header


in the cpp file

int RFM69NEW::readTemp(int calFactor)  //je  returns centigrade
 {
  writeReg(REG_TEMP1, RF_TEMP1_MEAS_START);
  while ((readReg(REG_TEMP1) & RF_TEMP1_MEAS_RUNNING));
  return COURSE_TEMP_COEF + calFactor - readReg(REG_TEMP2);  // bytes don't hv neg #s
 }   
Title: Re: Freq drift vs Temp
Post by: englund on September 27, 2013, 05:26:24 AM
Thanks!