DIY WIFI Arduino ESP8266 Advent Calendar

0

My wife and I bought an advent calendar from Amazon. We decorated it. It did the trick. But, it wasn’t high tech enough. I had a goal to change that, and this is what I came up with. The whole thing is powered by an ESP8266 (D1 Mini) and neopixel leds (75 of them). I wanted the calendar to automatically show what day it is so our 3 yr old daughter could easily see what advent she gets to open. The ESP8266 connects to a time server over wifi to get the current date. The current day blinks white, and the other days twinkle green and red. Christmas day fades in and out green and red.

But why tell you about it, when I can show you. Here is what it looks like.

What you will need

You are going to need some wire for splicing, a soldering iron and soldering skills, solder, zip ties, and some heatshrink. A lot of this you can improvise on with what you have around. You will also need.

An ESP8266 development board like one of these.

The advent calendar itself.

And some Neopixels (WS2811) You will need 2 strands as you need 75.

Wiring it up

You need to position 3 pixels per bag. 1 on each side, and 1 in the middle. Below is a wiring diagram to show you how to string the leds. The leds are individually addressable. Each one has a Din and Dout. You need to have the esp8266 connect to the first Din in the strand, and the Dout at the end of each strand to connect to the Din of the next strand. You will need to solder some wired from the end of one strand to the next strand. Be sure you use thick enough wire, as the leds need a good current source.

Wiring up Advent Calendar

Wiring up Advent Calendar

Connecting to the ESP8266

The Wemos and Node MCU boards have a different pinout than what works with Arduino. We are going to be using the Arduino Pin 4, which is pin 2 on the Wemos and Node MCU. Hook this pin to the DIN of the first LED of the strand (bottom right). You may be able to use the 5v directly from the boards, or you may need a secondary power source for 5v. I used the 5v pin on the Wemos D1 Mini and it worked fine. Since most of the lights are off most of the time, the total current consumption stays well under 500ma.

The Program

We are going to use Arduino to program this with the ESP8266 addon. There are instructions to install it on their github.

We are also going to use the following libraries. I will not go into installing libraries in this tutorial. Google is your friend.

Adafruit_NeoPixel – Github
Time – Github

And here is the code. It is long, but it does a lot. Be sure to add your WIFI credentials to it.

 

Now just upload the code, and you should be good to go. The code includes the Over the Air updating requirements, so you should be able to make changes and update over the air.

If you have any questions, please feel free to leave them in the comments. Enjoy.

Share.

About Author

I love to tinker, code, and create electronics. I primarily focus on Raspberry Pi (and other linux SBCs) and Arduino (and other microcontrollers that run on the Arduino platform).