Si4703 read date & time

Hi,
anybody can help me showing code to read RDS information about time and date?
Thanks
Paolo

What is an Si4703 ?

SI4703 FM is a Breakout Board, http://www.instructables.com/id/Use-Si4703-FM-Breakout-Board-on-Arduino-Uno/

Sparkfun has an example that can listen to RDS data. Try that first. Then you can parse it to pick out the date and time if it is there.

For my Radio receiver with RDS decoding using Si4703 breakout module project I did try out the time decoding, and found the results be very disappointing at least in Estonia. Most radio stations that even broadcast time have it incorrect.

That said, you can pick up the code from GitHub - mastmees/silicon_radio: Software for Si4703 breakout board based radio , and in the rdsdecoder.cpp add the code fragment below. it converts time to string, but just calculates data values, because I took the entire thing out after seeing how useless it was:

  case 8: // 4A (clock)
     int16_t offset=(rdsd&0x3f);
     if (offset&0x20)
       offset=0-(offset&0x1f);
     offset*=30; // positive or negative number of minutes
     int16_t min=(rdsd>>6)&0x3f;
     int16_t hrs=(rdsd>>12)|(rdsc&1<<4);
     char *s=time;
     *s++=(hrs/10)+'0';
     *s++=(hrs%10)+'0';
     *s++=':';
     *s++=(min/10)+'0';
     *s++=(min%10)+'0';
     *s='\0';
     int32_t day=(rdsc|((int32_t)(rdsb&0x1f)<<16))>>1;
     min+=hrs*60; // minutes we are into UTC day
     // adjust for local time
     min+=offset;
     if (min<0)
     {
       day-=1;
       min=60*24-min;
     }
     else {
       if (min>=60*24) {
         min-=60*24;
         day+=1;
       }
     }
// Y' = int [ (MJD - 15 078,2) / 365,25 ]
// M' = int { [ MJD - 14 956,1 - int (Y' × 365,25) ] / 30,6001 }
// D = MJD - 14 956 - int ( Y' × 365,25 ) - int ( M' × 30,6001 )
// If M' = 14 or M' = 15, then K = 1; else K = 0
// Y = Y' + K
// M = M' - 1 - K × 12
     int32_t yp=((float)day-15078.2)/365.25;
     int32_t mp=((float)day-14956.1-(int32_t)(yp*365.25))/30.6001;
     int16_t d=day-14956-(int32_t)(yp*365.25)-(int32_t)(mp*30.6001);
     int16_t y,m;
     if (mp==14 || mp==15) {
       y=yp+1;
       m=mp-1-12;
     }
      else {
       y=yp;
       m=mp-1;
     }
     y+=1900;
     break;
1 Like