Blynk.begin/ commands causing issues with RTC

I am trying to use Blynk to communicate with Arduino Bluefruit LE module which is communicating with an RTC and a 7-Segment display. As long as Blynk.begin is used i2c communication does not work. allows communication with LED display but not with RTC. I don’t have access to code at the moment. Will include later.

1 Like

Could you please help me understand your response? “RTC widget requires server”? I have included a copy of my code. If I run Blynk.begin() my 7-segment does not update the time. It shows the uploaded time but it doesn’t change.

#define BLYNK_PRINT Serial

#include <Wire.h>
#include "RTClib.h"
#include <Adafruit_GFX.h>
#include <BlynkSimpleSerialBLE.h>
#include <Adafruit_BLE.h>
#include <Adafruit_BluefruitLE_SPI.h>
#include "Adafruit_LEDBackpack.h"
#include <SPI.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "a76ec85955784a44b9c87213db6eefeb";

#define BLUEFRUIT_SPI_CS               8
#define BLUEFRUIT_SPI_IRQ              7
#define BLUEFRUIT_SPI_RST              4    // Optional but recommended, set to -1 if unused
#define BLUEFRUIT_VERBOSE_MODE         true

#define TIME_24_HOUR      false //set RTC to function in 12 hour time

// Create ble instance, see pinouts above

RTC_DS1307 rtc;
Adafruit_7segment matrix = Adafruit_7segment();

/************TIME VARIABLES*********************/
int hours = 0;
int minutes = 0;
int seconds = 0;
int years = 0;
int months = 0;
int days = 0;

void setup() {

  ble.factoryReset(); // Optional
//  Blynk.begin(auth, ble);

void loop() {

  if (!TIME_24_HOUR) {//Below sets displayed time as 12 hour time

    if (hours > 11) hours -= 12; //subtract 12 hours from displayed "Time" when it exceeds 11
    if (hours == 0) hours += 12; //set 0 as midnight hour and add 12 hours to displayed "Time"
  // Check if it's the top of the hour and get a new time reading
  // from the DS1307.  This helps keep the clock accurate by fixing
  // any drift.
  //  if (minutes == 0) {
  // Get the time from the DS1307.
  DateTime now =;

  // Now set the hours and minutes.
  hours = now.hour();
  minutes = now.minute();
  seconds = now.second();
  years = now.year();
  months = now.month();
  days =;

  boolean drawDots = true;
  //    matrix.setCursor(x, 0);
  matrix.writeDigitNum(0, hours/10);
  matrix.writeDigitNum(1, hours%10);
  matrix.writeDigitNum(3, minutes/10);
  matrix.writeDigitNum(4, minutes%10);
  //  };

Exactly as it states. Using the RTC widget gets it’s time from the Blynk Server, thus requires you to be connected to the Blynk Server (Cloud or Local)… App ↔ Server ↔ Hardware This is the normal way using WiFi, GSM & USB, but Bluetooth and BLE links are direct to the device App ↔ Hardware, thus no server and no RTC.

I also edited your post to include the required formatting of your code… please use this method in the future, Thanks.

I think he’s using a hardware RTC, not the widget, so it should work :slight_smile:


There is a delay and code in your loop() part. Check the PushData example on how to use timers to run code. Blynk will suffer bad connection and weird behaviour if you use your code like this.

Good point @Lichtsignaal I formatted his code, but didn’t have the time to read it back then.

@Ardie as Lichtsignaal suggested, get rid of the delay() command and try moving everything else out of the main void loop() except; Put all of that code into it’s own loop and install a timer to run that loop every second.

@Gunner Thank you for the tips. I did give these a try and unfortunately they did not solve the issue. However, I did stumble across the solution. Apparently, the Blynk.begin(auth, ble); command is looking for a Bluetooth connection and does not go beyond this piece of code until a connection is made. I just happened to connect to the Bluefruit LE board before uploading and the RTC and 7-Seg display both worked properly.

Yes, this is the normal procedure… the same with WiFi, ethernet and even USB. Although with WiFi based devices like the ESP8266 (possibly the others as well, but unsure), one can use Blynk.config() to allow the sketch to run even without Blynk connection.