Dear Ladies and Gentlemen,

I'd like to let a LED blink base on the time of the day. So I took Wemos D1 mini and a WS2818B shield and a RTC DS107 Shield for the before mentioned ESP8266 model.

Based on my observation, I can let the LED blink on its own without starting the initialization of the RTC. As soon as I initialize the communication with the DS1307 shield, the LED shield won't translate any commands toward the desired behavior (e.g. the LED won't blink anymore).

What am I doing wrong?

I'm using the Ardunio IDE to program the D1 mini.

I stacked the shields and kept an eye on the pins to be sure I did wire everything the right way.

Libraries in use:
RTC: https://github.com/Makuna/Rtc
LED: Adafruit NeoPixel


#include <ESP8266WiFi.h>

// RTC
#include <RtcDateTime.h>
#include <RtcUtility.h>
#include <Wire.h> // must be included here so that Arduino library object file references work
#include <RtcDS1307.h>
RtcDS1307<TwoWire> Rtc(Wire);

// LED
#include <Adafruit_NeoPixel.h>
#define PIN        D2
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ400);

int DELAYVAL = 1000; // Time (in milliseconds) to pause between pixels

void setup() {




void loop() {

  pixels.clear(); // Set all pixel colors to 'off'
  pixels.show();   // Send the updated pixel colors to the hardware.
  delay(DELAYVAL); // Pause before next pass through loop

  pixels.setPixelColor(0, pixels.Color(0, 150, 0));
  pixels.show();   // Send the updated pixel colors to the hardware.
  delay(DELAYVAL); // Pause before next pass

void setupRtc () {


  RtcDateTime compiled = RtcDateTime(__DATE__, __TIME__);

  if (!Rtc.IsDateTimeValid()) 
      if (Rtc.LastError() != 0)
          // we have a communications error
          // see https://www.arduino.cc/en/Reference/WireEndTransmission for 
          // what the number means
          Serial.print("RTC communications error = ");
          // Common Causes:
          //    1) first time you ran and the device wasn't running yet
          //    2) the battery on the device is low or even missing

          Serial.println("RTC lost confidence in the DateTime!");
          // following line sets the RTC to the date & time this sketch was compiled
          // it will also reset the valid flag internally unless the Rtc device is
          // having an issue


  if (!Rtc.GetIsRunning())
      Serial.println("RTC was not actively running, starting now");

  RtcDateTime now = Rtc.GetDateTime();
  if (now < compiled) 
      Serial.println("RTC is older than compile time!  (Updating DateTime)");
  else if (now > compiled) 
      Serial.println("RTC is newer than compile time. (this is expected)");
  else if (now == compiled) 
      Serial.println("RTC is the same as compile time! (not expected but all is fine)");

  // never assume the Rtc was last configured by you, so
  // just clear them to your needed state

void setupLed () {


void setupWifiConnection () {
  WiFi.begin("some ap", "some password");

  while (WiFi.status() != WL_CONNECTED)

  Serial.print("Connected, IP address: ");

  • Can you check, if and where the code gets stuck? You can do this by inserting serial prints at several positions to track down the exact problem location
    – chrisl
    Commented Oct 5, 2020 at 20:38
  • please describe what you observe ... add the description to your post, not to comments ... it looks like setupRtc should be generating some output to the serial monitor
    – jsotola
    Commented Oct 5, 2020 at 21:58

1 Answer 1


According to your code, you’ve connected the Neopixel to D2. The RTC is an I2C device, so it’s also connected to D2. How is that supposed to work? The Neopixel isn’t an I2C device.

Move the Neopixel to a different pin that’s not used by anything else - so not D1. Try D3. Update your code to use D3. There may be other issues but at least you won’t be trying to use the same pin to talk to two very different devices.

  • 1
    Absolutely correct. What I oversaw was the fact the Neopixel LED shield is no I2C device. As suggested I wired the pin to D3 and it worked right away. Thank you @romkey.
    – owi
    Commented Jan 29, 2021 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.