DCF77 Module stops working with when i add adafruit 7 segment display

hi guys,

I am in a middle of a project and have a problem with DCF77 module.

I have 2 adafruit 7 segment displays connected and everything works like a charm, i get dcf77 signal in 2 minutes on average, everything syncs and works. As soon as i add 3rd 7 seg display, dcf77 stops synchronizing.

Here is my code, i have commented out some parts for troubleshooting but the code doesnt seem to be a problem.

#include "TimeLib.h"
#include "DCF77.h"
#include "Wire.h"
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
#include "RTClib.h"
#include "Adafruit_Sensor.h"
#include "Adafruit_BME280.h"

#define DCF_PIN 2           // Connection pin to DCF 77 device
#define DCF_INTERRUPT 0    // Interrupt number associated with pin
#define PIN_LED 22         // LED signalin that the DCF77 signal has been aquired
#define PIN_LED2 23         // LED (red) signaling loss of signal. Trigers every hour at :00 to update the signal status
#define PIN_LED_monday 24    // LED on if monday
#define PIN_LED_tuesday 25    // LED on if tuesday
#define PIN_LED_RTC_online 26 // Led on if RTC is online and battery OK
#define PIN_LED_RTC_offline 27 // Led on if RTC is offline or battery dead

#define SEALEVELPRESSURE_HPA (1013.25)

DCF77 DCF = DCF77(DCF_PIN,DCF_INTERRUPT, false); // "false" is used for ELV DCF77 receivers as they have inverted signal


Adafruit_BME280 bme;
RTC_DS3231 rtc;

Adafruit_7segment display1 = Adafruit_7segment();
Adafruit_7segment display2 = Adafruit_7segment();
Adafruit_7segment display3 = Adafruit_7segment();
Adafruit_7segment display4 = Adafruit_7segment();
Adafruit_7segment display5 = Adafruit_7segment();
Adafruit_7segment display6 = Adafruit_7segment();
Adafruit_7segment display7 = Adafruit_7segment();

int _hours;
int _minutes;
int _seconds;
int _days;
int _months;
int _years;
int WeekDay =0;
int DOW;             // day of week 


float _temp; 
int roundtemp;

float _pressure; 
int roundpressure;

float _humidity; 
int roundhumidity;

int tensofdegrees, singledegrees, millidegrees;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

int hours, minutes, tensofhours, tensofminutes, tensofseconds, seconds, days, tensofdays, months, tensofmonths, years, tensofyears, hundredsofyears, thousandsofyears; 
unsigned long lastupdate = now();
unsigned long currenttime = now();



//==============================================================================
// SETUP
//==============================================================================

void setup() 
{
  Wire.begin();
  DCF.Start();
  
  Serial.begin(9600);
  

  pinMode(PIN_LED, OUTPUT);
  pinMode(PIN_LED2, OUTPUT);
  pinMode(PIN_LED_monday, OUTPUT);
  pinMode(PIN_LED_tuesday, OUTPUT);
  pinMode(PIN_LED_RTC_online, OUTPUT);
  pinMode(PIN_LED_RTC_offline, OUTPUT);

  display1.begin(0x70);
  display2.begin(0x71);
  display3.begin(0x72);
  display4.begin(0x73);
  display5.begin(0x74);
  display6.begin(0x75);
  display7.begin(0x77);

  
  rtc.begin();
  if (! rtc.begin()) {
    Serial.println("RTC is NOT running.");
    } else {
    Serial.println("RTC is running.");
    DateTime now = rtc.now();
    setTime(now.unixtime());  //Set system clock from ds3231 once.
    }

/*
    if (!bme.begin(0x76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
  */
  
}


int update = 0;


//==============================================================================
// LOOP
//==============================================================================


void loop() 
{

if(minute() == 0) { update = 0; } //check every hour (at xx:00 minutes) to start a new cycle, it only resets the LEDs to update signal status
if (update ==0)                          // when the dcf77 signal is not established yet
  {
   digitalWrite(PIN_LED2, HIGH);
   digitalWrite(PIN_LED, LOW);
  }

time_t DCFtime = DCF.getTime(); // Check if new DCF77 time is available
  if (DCFtime!=0)
  {
    Serial.print("DCF77 signal received and time updated! - @ "); 
    setTime(DCFtime);
    rtc.adjust(DCFtime);  //Set ds3231 from system  clock.
    lastupdate = now();
    currenttime = now();
    digitalWrite(PIN_LED, HIGH); // turns on LED that shows signal has been received and clock updated
    update = 1;
    }  

  if (update ==1)
  {
   digitalWrite(PIN_LED2, LOW);  // LED2 (red) turns off when signal is successfully received
 
  }

    
show_displays();

}


//==============================================================================
// SHOW DISPLAYS
//==============================================================================



void show_displays(){


// Day Of The Week LEDs
    
     if (DOW == 5) {
     digitalWrite(PIN_LED_monday, HIGH); //monday
     } else {
      digitalWrite(PIN_LED_monday, LOW); //monday
     }
     if (DOW == 6) {
     digitalWrite(PIN_LED_tuesday, HIGH); //tuesday
     } else {
      digitalWrite(PIN_LED_tuesday, LOW); //monday
     }


// if RTC is disconnected a red LED will turn on, otherwise yellow LED is on.

    if (! rtc.begin()) {
    digitalWrite(PIN_LED_RTC_offline, HIGH);
    digitalWrite(PIN_LED_RTC_online, LOW);
    } else {
    digitalWrite(PIN_LED_RTC_offline, LOW);
    digitalWrite(PIN_LED_RTC_online, HIGH);
    }





//=============================
// DATE & TIME
//=============================
    

  DateTime now = rtc.now();
 
  _hours = now.hour();
  _minutes = now.minute();
  _seconds = now.second();
  _days = now.day();
  _months = now.month();
  _years = now.year();
  DOW = now.dayOfTheWeek();
 

  // define time and date
  hours = _hours % 10;
  tensofhours = _hours / 10;
 
  minutes = _minutes % 10;
  tensofminutes = _minutes / 10;
 
  seconds = _seconds % 10;
  tensofseconds = _seconds / 10;

  days = _days % 10;
  tensofdays = _days / 10;

  months = _months % 10;
  tensofmonths = _months / 10;

  years = _years % 10;
  tensofyears = (_years /10)%10;
  hundredsofyears = (_years /100)%10;
  thousandsofyears = (_years /1000)%10;

  
  // define each digit - 0 is the first left, 2 is decimal dots.
  
  display1.writeDigitNum(0, tensofhours);
  display1.writeDigitNum(1, hours);
  display1.writeDigitNum(3, tensofminutes);
  display1.writeDigitNum(4, minutes);
  display1.drawColon(true);
  display1.writeDisplay();
  
  
  display2.writeDigitNum(0, tensofseconds);
  display2.writeDisplay();
  display2.writeDigitNum(1, seconds);
  display2.writeDisplay();
  

  display3.writeDigitNum(0, tensofdays);
  display3.writeDigitNum(1, days,true);
  display3.writeDigitNum(3, tensofmonths);
  display3.writeDigitNum(4, months,true);
  display3.writeDisplay();

  display7.writeDigitNum(0, thousandsofyears);
  display7.writeDigitNum(1, hundredsofyears);
  display7.writeDigitNum(3, tensofyears);
  display7.writeDigitNum(4, years);
  display7.writeDisplay();
  

}

Any thoughts would be highly appreciated.

Many thanks,
Alek

Please post a schematic of your project with and without the added display

Unfortunately i do not have a schematic, perhaps a photo could help.
Basically, i have external 5V power supply that feeds to arduino mega as well as all other components, SCL and SDA from mega go to breadboard and then all displays are connected to those.

2 LEDs on the left, yellow and red, signal DCF reception and sync.

Is it possible that more displays create some sort of interference?

Please see photo.

many thanks,
Alek

Unfortunately i do not have a schematic

Do you have a pencil, paper and a camera ?

perhaps a photo could help.

Not really

Ok, quick schematic attached. Basically, i am chaining SCL/SDA for displays (and eventually BME280 sensor)

Everything works, all displays work and show correct information, i had BME280 sensor connected as well, 6 displays in total, everything works great but no DCF77 sync, then when i remove all but 2 displays, i get DCF77 sync again...

many thanks,
Alek

2020-06-06 11.29.36.jpg

Annotation 2020-06-06 115239.jpg

So, have you tried different combinations of two I2C displays and determined that any two work and three does not?

If so, the pull-up resistors on the displays may be too low - you would need to disable them on one.

How much current does each display use and what is the voltage between 5V and GND with 1, 2 and 3 of them connected ? How much current is the external power supply rated to provide ?

Thanks Paul, looks better that way!

Alek

UKHeliBob:
How much current does each display use and what is the voltage between 5V and GND with 1, 2 and 3 of them connected ? How much current is the external power supply rated to provide ?

External power is 5.15V, measured on breadboard rail after all connected displays: 4.98V. Not sure about how much current each display draws but external power supply is rated at 2400mA and 12W. Anyway, i think i will not exceed rated output, this shhould not go over 1000mA in any case...

Paul__B:
2020-06-06 11.29.36.jpg

Annotation 2020-06-06 115239.jpg

So, have you tried different combinations of two I2C displays and determined that any two work and three does not?

If so, the pull-up resistors on the displays may be too low - you would need to disable them on one.

No, i did not, will try that now. Not sure i would be able to disable a resistor on backpack of the display...

Many thanks agaian,
Alek

ok, after testing each display, this is what i have.

I have left the large display connected and paired it with one smaller display at a time, they all worked and DCF synced with any combination except one... with each combination i got sync after 2-3min and with one of the small displays no sync after 10min, so i've put that one aside. Now, i have connected all working displays together and again, no sync...

Running out of ideas.

One interesting thing though, i have 1 large and 4 small displays connected at the moment, they all have different pins shorted to get different addresses BUT, first large displays shows HH:MM, second smaller display shows seconds and remaining 3 displays ALL show YYYY... even though only one of them has all 3 pins shorted for 0x77 address thats assigned to YEAR in the code, while other two have 0x73 and 0x74 address. These two should show sensor values which is disconnected and code commented out at the moment.

Is this normal behavior?

Thanks,
Alek

hi again,

tried everything, 2 power supplies, one for board and DCF and one for displays, tried disconnecting status LEDs on the breadboard... conclusion is clear now, it all works fine with up to 3 displays, anything above that and the DCF does not work.

So the problem seems to be I2C bus and too many devices connected. i have connected RTC, BME280 sensor, and then displays. So it looks like RTC and BME280 with up to 3 displays is fine, more displays and DCF stops syncing.

Adafruit backpacks have 10k pull-up resistors but my knowledge of what it means and how it works, stops here.

Any ideas would be great.

Thanks,
Alek

ok, desoldered a few pull-up resistors and some displays now work with DCF and some dont... i have removed that tiny "solder plate" from the circuit, does that matter? Not sure if you know what i mean, there are 2 solder bases for those micro resistors, i have removed one of them by removing the resistor...

Now, once i remove pull up resistor, should i short those the connection or just leave it as is?

Many thanks,
Alek

The signal sent by the DCF transmitter is 77.5 kHz. and it could be affected by things like the display multiplexing cycle, switch mode power supplies and such like.

I have made one using a Conrad module and a 4 digit LED display. It now sits near several other clocks (Nixie, VFD, etc. etc.). It very seldom gets a usable signal and I am 400kM or so away from the transmitter.

Which DCF77 receiver module are you using ? Some come with larger ferrite rod antenna options.

hey 6v6gt,

i am as well some cca 400km away from Frankfurt, and get clear signal all the time but this is now killing me.

I have removed ALL pull-up resistors from all displays, the only one in the chain is on BME280 sensor... still no luck.

I got it working with 5 displays, RTC and BME280 but after adding one more display it did not work, now it does not work with more than 3 displays again. I have not changed the code just moving the wires trying to figure it out.

Yes, i am thinking more and more that it could be frequency, no more ideas.

I have ELV DCF, inverted signal, small ferrite, perhaps 50-60mm. Interesting thing is, whatever i do, i get signal and sync, EXCEPT when i add more displays, frustrating!

Thanks,
Alek

Also, before i got adafruit 7 segment with backpack i made a test rig with 14 single digit 7 segment modules, each one with one 74hc595, LOTS of wires... and everything worked fine, i would get sync every minute.

hi all,

just to let you know i have solved a problem with grove I2C hub.

6 displays, RTC and BME280, DCF77 syncs after less than 2 minutes.

Many thanks everyone for help!

Alek

hi all,

The problem is back and so am i :slight_smile:

This is now really frustrating considering strange behavior of the rig.

So with all the displays connected and pull-up resistors removed from all displays, i got it working, and it worked for 2 days... then it stopped and it did not work for a day. Then i added UNO board with Udo Klein's superfilter and output filtered DCF signal it to MEGA board with displays, not working.

Then i tried to output non-inverted signal from UNO and changed statement on MEGA sketch from "false" for inverted DCF signal to "true" for non inverted... it worked!!! It kept working for a few hours when i wanted to switch power supply... on power back on it did not work again, with the SAME power supply?! After this, no matter what i try it does not work.

So to sum up:

  1. i have a clean and strong DCF signal at all times, UNO with superfilter locks on a signal after a minute or so and it keeps it locked all the time. To eliminate DCF reception problem i have connected another module to another board and kept it running simultaneously, it had the clean signal and sync at all times

  2. I have removed all pull-up resistors from all 7 displays on MEGA board with the DCF sync problem but still have 2 devices with pull-up, RTC and BME280.

  3. MEGA board with displays behaves strange as i get a DCF sync randomly, after random time of reset/ power off and power on... no sketch or wiring has been changed, same configuration of everything, sometimes work and sometimes it does not.

  4. I have tried replacing MEGA board with a new one, same thing.

  5. ALL I2C devices on the same bus using Grove i2c hub, all wirec connected, i am not using external power for i2c.

  6. Tried with factory power supply on barrel jack, tried external 5V on 5V pin... no change

  7. All I2C devices work flawlessly all the time, displays are showing all the data, no hickups at all, RTC works, sensor works... never had a single issue with any of the I2C devices.

Now, if the displays were a problem, why would it work for hours at a time until i restart the board and then it stops working? Should it not be either it works or it doesnt? Could it be board internal pull-up problem? Could it have anything to do with on board ceramic oscillator instead of quartz?

Could it be the fact that i have 7 seg displays, RTC and BME sensor all on the same bus? But then again, how else could i link them...

Should i use decoupling on I2C? I've read somewhere that i should, but not sure how or what value of caps...

Any help or suggestion would be highly appreciated.

many thanks,
Alek

Have you an explicit ground connection between the Uno and the Mega or are you relying on a common power supply to provide this. If it is the latter case, then changing power supplies could be the cause of your problem.

In any case, it always good to have your own ground connection between the 2 devices.

Does the Uno give any indication (lashing leds, Serial monitor output etc.) that shows it is handing a valid time sequence over to the mega ?

What is the approximate length of wires on your I2C bus.

Thanks for your reply! To answer your questions:

  • I do NOT have a common ground between UNO and MEGA
  • UNO and MEGA are using separate power supplies. other than DCF output from UNO to MEGA, they are not connected in any other way.
  • I do not have any indicator that UNO is outputting signal except when the MEGA board syncs on random occasion
  • I2C cables are cca 15cm long from the I2C hub to displays and RTC/sensor. From MEGA to I2C hub i have 4 wire each cca 10cm long.

Many thanks again,
Alek

  • I do NOT have a common ground between UNO and MEGA

A common ground may work wonders here.