Introduction: NeoPixel Clock

About: I'm retired, living in Queensland Australia with my wife. These are my hobbies, pretty much full time now. Isn't it great to retire and actually pursue your real interests!

*********************************************************************************************************

THIS IS AN ENTRY IN THE MICRO CONTROLLER CONTEST, PLEASE VOTE FOR ME

********************************************************************************************************

I built a NeoPixel infinity mirror some years ago while I was in Thailand and can be seen HERE.

I did it the hard way not using a Arduino but a stand alone micro processor, a PIC18F2550. This involved digging down into the registers and timings of the Micro to write the code, some of which contained assembly.

This is all great knowledge to have and has held me in good stead as it makes working with Arduino childs play. Most of the work has been done by the use of third party libraries whereas before I wrote my own library code.

This clock was designed to emit light out from the periphery onto the wall it is attached to using WS2812B individually addressable RGB LEDs spaced at 144 per meter. This gave me a clock diameter of 200mm, something I could make myself on my 3D printer.

It has a stunning effect, particularly at night or in a darkened room, light shines out about 500mm giving a total razzle-dazzle of over a meter diameter. The patterns are amazing.

The clock displays hours (blue), minutes (green), and seconds (red). Also displayed is the date on a 8 digit 7 segment display and the day of the week in a list form.

The clock is controlled by smartphone over WiFi using Blynk app and a local Blynk server running on a RPi 3.

The use of a local server for Blynk is optional and setting this up is not part of this instructable. The web hosted Blynk can be used after creating an account at www.blynk.cc and downloading the app.

There is a load of info on using Blynk on their website, so it is not part of this instructable.

At a later step in this instructable there is a QR code to scan, you will then have my app on your phone.

The app has controls for showing the clock or patterns (with LCD feedback on the app), the ability to set your time zone wherever you are in the world and get the time via an NTP server. It can also be set to sleep.

There is a Real Time Clock module with battery backup providing time/date functions to the Arduino.

The firmware on the NodeMCU-E12 in the clock can be updated over the air (OTA).

Now lets get started......

Step 1: Tools Required

A good soldering iron and solder

wire strippers

small wire cutters

small long nosed pliers

small saw for cutting vero board

sharp hobby knife

scissors

paper glue

Step 2: Electronic Parts Required

1 x NodeMCE-12E module from HERE

1 x RTC clock module HERE

1 x 8 digit 7 segment Max7219 module here

1 x DC power jack here

2 x level shifters (required as Arduino is 3.3v and RTC & 7 segment display is 5v) here

68 LEDs of a WS2812B 114/mtr LED strip here.

DC 5v 10A power supply here.

10kOhm 1/4W resister.

As required hook-up wire.

Approx 77mm x 56mm Vero board to assemble all the modules on and wire up.

I actually used a Adafruit level shifter for the RTC module I2c lines as it was supposed to be I2c safe !!

However I think most 3.3v to 5v bi-directional logic level shifters should work.

Cutting the LED strip wasted a LED as the pads for soldering both ends of the 60 LED strip were required and the pads are required on the 7 LED strip.

Step 3: Printed Parts

There are three 3D printed parts; the main clock body, the front cover and the battery cover on the back.

The battery cover could be omitted.

There is also a printed 'Mask' under the front cover with the days of the week on it. I printed this on ordinary paper. I have supplied a .dwg and a .dxf file of this.

There are 2 front covers available, one has no name on it, just in case you are unable to edit the part.

My 3D printer (0.4mm nozzle) had the following settings with Slic3r:

first layer height = 0.2mm

layers height = 0.2mm

bed temp = 60 C

nozzle temp = 210 C

vertical perimeters = 2

horizontal shells = 3

infill = stars rectilinear at 45 deg

no brim

no support material

It is strongly recommended that you have a bed levelling method

3D printed files and mask drawing here:

Step 4: Complete Assembly File

Below is a IGS file of the complete assembly for anyone wishing to modify the clock.

Step 5: Installing the Libraries

INSTALL ESP BOARDS

You will need the Arduino IDE. Installing this is not part of this instructable but can be downloaded from HERE.

Once the Arduino IDE is installed, if not already done, you will need to copy/paste the text below to the text box under File>Preferences - Additional Boards Manager URLs:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Restart the IDE.

After you have done this go to Tools>Board>Boards Manager. Let it finish updating and you should see ESP8266 community version in the list of installed boards.

INSTALL LIBRARIES

Installing all Libraries in your Documents/Arduino/Libraries folder as usual apart from those installed by board manager.

After installing libraries, restart Arduino IDE, go to Sketch> Include Library> Manage Libraries, let it finish updating, you should see your new libraries in the list.

RTClib - available here
Adafruit_NeoPixel - available here

HCMAX7219 from here

Blynk - available here. follow installation instructions CAREFULLY.

All the other 'includes' in the NeoPixelClock file are either installed by the Board Manager or are packaged with the Arduino IDE install.

Step 6: Installing the Firmware

At this stage it is a good idea to wire everything together on a bread board for testing purposes.

Check all wiring carefully before connecting the 5v power supply and/or the USB cable.

Navigate to your Sketch folder Documents>Arduino.

Create a folder "NeopixelClock".

put the below .ino file into the folder.

Open the Arduino IDE.

Set the IDE to display line numbers, go to File>Preferences and tick the "Display Line Numbers" box, click OK.

Connect your NodeMCU board to a USB port.

Go to Tools>Board and select NodeMCU 1.0 (ESP-12E Module)

Go to Tools>Port and select the port your board is connected to.

INSTALL OTA FIRMWARE

To use OTA updating you first have to burn a special piece of firmware onto the NodeMCU.

go File>Examples>ArduinoOTA>BasicOTA.

a program will load in the IDE, fill in the part for ssid with your routers SSID. You can see this name if you hover your mouse over the WiFi icon in the system tray.

Fill in the password with your network password (usually written on the bottom of the wireless router.

Now upload to your NodeMCU board via USB.

When completed, press the reset button on the NodeMCU board.

INSTALL THE NEOPIXELCLOCK FIRMWARE

Go to File>Sketchbook>NeoPixelClock and open the NeoPixelClock file.

Fill in your 'auth', 'ssid' and 'pass' should be at line 114.

Note; how to get the authority token is explained in the next step

You can also set your local Time Zone at line 121, this can be any 1/4 hour between -12 and +14 as per time zones around the world.This can also be set in the app if you prefer. It's currently set for Queensland, Australia.

At line number 332 you must set the IP address for your local server if you are using it.

A note on the local server port. Due to a recent update to the Blynk software the port is now 8080 not 8442.

If you are using the new updated software change this.

Or if using the Blynk web server, comment line 332 and uncomment line 333.

That's all the editing that needs to be done.

Now upload this to your NodeMCU board via USB.

.

When this has uploaded successfully, disconnect the USB cable from the board.

You will see under Tools>Port a new port (looks like an IP address), select this as your port to communicate with the NodeMCU for future updates that you may do.

If all went well the clock should start, if not press the 'reset' button on the NodeMCU module.

Note: I have noticed that sometimes it doesn't start first time, I found unplugging the power supply and re connecting works most times. I am working on a solution for this failure to boot properly.

Step 7: Smartphone App

To start using it:

1. Download Blynk App: http://j.mp/blynk_Android or http://j.mp/blynk_iOS if not already installed.

2. open the app or sign in, if new you will need to make an account.

NOTE, this is not the same as the online account.

3. Touch the QR icon in the app at the top and point the camera at the QR code above, or open the link below -

http://tinyurl.com/yaqv2czw

4. an authority code should be sent to your nominated email, which you should put into the Arduino code where stated in a later step. If you press the nut icon you will be able to email again if needed.

As mentioned before you should create an account online at www.Blynk.cc. before doing this.

Forgive me for vagueness, I can't test this as I already have the app and I don't use the web server.

Step 8: Building the Vero Board Assembly

I decided to put all the boards and modules onto a piece of vero board.

This keeps everything neat and tidy.

The schematic can be seen in the .pdf file below.

The headers on the board were removed after testing, I wired all the peripherals directly to the vero board as there wasn't enough room for the headers and associated connectors.

Sorry I didn't take any photos of the underside of the board, but it should not be to difficult to figure it out. You may even improve my layout. Keep the Vero board the same size otherwise it will not fit the 3D printed base.

With the logic level shifters the LV (+3.3v) goes to 3.3v on any of the 3v pins on the Arduino module, the HV (+5v) goes to VIN pin on the Arduino board.

All Grounds come from any/all the Arduino GND pins and should be all linked together to avoid loops.

Wire up using something like 26 gauge insulated single core wire, PTFE insulation would be good as it doesn't melt.

Check all your wiring carefully 2 or 3 times.

Go over it with a multi-meter set to continuity check, check all Gnds are connected back to the VIN GND.

Check all +5v connections on the RTC module, the two level shifter modules HV pins and the VIN +5v pin on the NodeMCU module.

Good idea to check all other wiring too.

Step 9: Clock Assembly

Once you have printed the parts clean off any flashing and lumps and bumps with a sharp hobby knife.

Because I only had blue and black filament I painted the insides of the LED cavities with silver model paint.

This I think should help reflect the light better and also help prevent bleeding of light through the walls to adjacent cavities.

The vero board assembly needs to be wired up:

to the LED strip +5v, Gnd and DIN from the vero board assembly.

to the 7 segment display from the vero board assembly.

to the DC jack from the vero board assembly.

A wire to the separate 7 way LED strip (DIN) from the end (number 60) of the main 60 way LED strip (DOUT).

I only soldered the data out (DOUT) from the end ( LED number 60) of the 60 way LED strip, the +5v and Gnd for the 7 way LED strip I wired from the vero board assembly.

to prevent shorts, I placed a small piece of thin card between the beginning and end of the 60 way LED strip as they were very close.

Measure and cut all wires to appropriate lengths, I added 5 or 6mm to provide a little leeway.

I did not remove the sticky tape backing paper from the LED strips, this would have made it difficult to put into the base and very difficult to remove if need be.

I found the strips fit nice and snug, push then all the way to the bottom of the cavity.

Place the Vero board assembly in the cavity, there are stand-offs to keep it off the bottom by 2mm.

Put the 8 way 7 segment display in the cavity there are stand-off posts for mounting this.

The DC jack fits in it's cavity snug, solder the wires to this on the inside of the tags. Remove the side tag if you wish.

All the wires should be neatly laid into the provided cavities.

Finally pass the power jack from the power supply through the hole and ease it into the DC jack, push the cable into the groove provided underneath.

Check all your wiring carefully 2 or 3 times.See wiring diagram below.



Step 10: Fitting the Front Cover to Finish

The base block has several small pegs protruding up on the outer ring, these should align with the holes in the front cover.

The paper mask should be printed in black, cut out and glued to the front cover with something like a glue stick.

The holes will be punched through the paper when it is, with the front cover, pressed onto the base.

We're all set to go, plug it in, the clock should start automatically, if it doesn't, as I found out several times, unplug the power and plug back in again.

If you have no battery in the RTC module you will need to set the time and date.

Do this with the app, set the time zone with the up/down control then press the 'SET NTP TIME' button.

You will see in the app terminal if it succeeds or not, if not try again.

When DONE is display the Clock button can be pressed and the clock should run and display time, date and day on the week.

Patterns can be run by pressing the Patterns button, this can be interrupted at any time by pressing the Clock button or the Patterns button again.

Brightness of the clock LEDs and the 7 segment display can be adjusted for brightness with the associated sliders.

All LEDs can be turned of by pressing the clock Off button.

Hang it on the wall and the light will shine outwards onto the wall, particularly beautiful in a darkened room.

Any questions I will be only to pleased to try and answer.

ENJOY and don't forget to vote for me.

*********************************************************************************************************
THIS IS AN ENTRY IN THE MICRO CONTROLLER CONTEST, PLEASE VOTE FOR ME ********************************************************************************************************