Morphing Digital Clock

18,937

305

85

Published

Introduction: Morphing Digital Clock

A quick video about this project. I have since implemented a way to set timezone.

Thanks to the work of the Arduino and ESP8266 community, this cool clock is a surprisingly easy to build!

  1. Just two main components: Display (obviously) and a WiFi MicroController
  2. No soldering required
  3. No programming skill required, code is provided!

Let's get started!

Step 1: Parts List

Although I've included links to where I bought my parts, these parts can be easily purchased from other vendors all around the world.

  • P3 64x32 RGB LED Matrix $20
  • NodeMCU 32MB ESP8266 WiFi Microcontroller module $2.18
  • Female to Female 20cm Dupont jumper wires $0.85
  • Micro USB Data/Sync cable and 5V phone charger wall adapter (I had these and didn't have to buy it)
  • 5V 2A MINIMUM Power Supply (I had this and didn't have to buy it) $7.95
  • Solderless Female barrel connector to connect the Power Supply to the display power cable.

IMPORTANT:

  • Some USB cables are designed just for power delivery (charging) -- these are ok to power the finished clock, but to upload code to the ESP we will need a data/sync USB cable.
  • The P3 RGB Matrix has over 6000 LEDs. For this clock, we will never turn all of them at once, so 2 Amp is more than sufficient. However, if you plan on doing more with the display and have all LEDs set to white, the recommended power supply is 8 Amp minimum.

Step 2: Wiring Summary

There are a lot of wires, but don't worry. All we're doing is connecting one pin to another.

Just take your time. Double check each connection before and after you plug it in.

Make sure the wires are fully inserted so they would not accidentally come undone. They are quite snug when fully inserted.

Step 3: ESP Wiring

First, let's put jumper wires on the ESP. Don't worry if your wire colors are different than mine. Which pair of pins are connected by each wire is what is important.

Do NOT connect the ESP to your PC YET. We need to complete all wiring before we power anything up.

We are using pins D0 through D8 and two GND.

We can skip the 3V pin because the ESP will be powered via the USB port.

We also skip the Transmit and Receive pins because we will communicate to the ESP via USB or WiFi.

Step 4: Matrix Wiring Part 1

Next, take the other end of the jumper wires we've just hooked up to the ESP and plug them into the matrix.

Again, the chart includes the colors of the wires that I used, but of course your colors might be different.

What is important is that you connect the ESP pins to the matrix as shown in the table.

The matrix is NOT symmetrical, there is a left/right, up/down. Please note the white arrows.

Connectors on my matrix are not labeled, so I've added a photo with labels. Your matrix might be slightly different. These resources discuss other board versions in great detail:

Step 5: Matrix Wiring Part 2

Second set of jumper wires connect the left connector to the right connector of the matrix.

Third photo shows the right side of the matrix.

Step 6: Power Wiring

The display power cable were designed for screw terminals.

You could cut off the solder lug and strip the wire, but I opted to bend the prongs and use additional heat shrink tubing to ensure that there are no exposed metal. Whatever you do, make sure the wires make good contact, securely attached and insulated.

Obviously Red wire should be connected to (+) and Black wire to (-)

Plug the other end to the display, again noting polarity: Red goes to VCC and Black goes to GND.

If your cable is designed to simultaneously power two displays, it does not matter which one you connect to your one display. It is however VERY IMPORTANT that you do not reverse the red(+) and black(-)

If you haven't already, now is a good time to double check to make sure all the jumper wires are are connected to the correct pins (before we apply power).

Check polarity of the power cable AGAIN, make sure that PLUS and MINUS are NOT REVERSED!

Hey, we're done with wiring! But don't plug it in YET!

Step 7: Install Arduino IDE

To upload the code to the ESP, you will need the Arduino software and a few libraries:

Follow installation instructions on the Arduino website.

Arduino has done so much for the maker community, so you should contribute to Arduino, but it is optional.

Click "Just download" to download without contributing.

Step 8: Install Libraries

Once installed, launch the Arduino IDE then:

  • Click the Sketch menu > Include Library > Manage Libraries...
  • Search and install the latest version of the following libraries:
    • AdaFruit Gfx library
    • PxMatrix by Dominic Buchstaller
    • ArduinoJSON version 5.13.2 by Benoit Blanchon
    • WiFiManager by Tzapu
    • DoubleResetDetector by Stephen Denne aka Datacute

IMPORTANT:
Notice that at the time of this writing, ArduinoJSON version 6.x beta does not work with Morph Clock. Doing so causes compile errors. Make sure you specify version 5.13.2 when you install/update ArduinoJSON.
Thanks to user lmirel for noticing this.

Step 9: Install ESP8266 Support

We also need ESP8266 support

  • Close Manage Libraries, but stay in Arduino IDE
  • Go to File > Preferences
  • Click the icon to the right of Additional Board Manager URLs
  • Paste this URL on a separate line (sequence does not matter).
    • http://arduino.esp8266.com/stable/package_esp8266com_index.json
  • Click Ok to get out of Preferences
  • Navigate to: Tools > Board xyz > Board Manager...
  • Search for 8266
  • Install esp8266 by ESP8266 Community.

Step 10: Install CH340 Driver

The last thing to install is the device driver so our PC can talk to the ESP.

Download and install the driver for your computer from the bottom of the manufacturer's driver page.

If you need help, there is a nice tutorial on how to install Arduino Nano CH340 by samuel123abc. The same CH340/CH341 that is on the NodeMCU ESP is on the Arduino Nano clone.

Step 11: Upload the Code

We're almost there...

  1. Download and unzip the latest Morphing Clock code.
    • (see picture above if you're unfamiliar with github)
    • Unzip the downloaded zip file then double-click MorphingClock.ino
  2. Compile and Upload
    • Before we plug in the NodeMCU to your PC via the Micro USB cable, have you double-checked your wiring? :-)
    • Make sure that the pins of the NodeMCU are not being shorted by any metal objects on your desk while the NodeMCU is on.
    • When you plug in USB, you should hear the usual "ding" as Windows recognize a USB device being plugged in.
    • Setup the options in Arduino IDE > Tools as pictured
      • Your COM port might be different.
      • I had to change Flash Size to 4M(1M SPIFFS) your ESP might be different.
    • Click the Upload button as pictured. This will take some time (about a 30 seconds), and there will be warnings, but it will eventually upload to the NodeMCU.

Troubleshooting:

  • If the upload fails because it could not connect, make sure you choose the port where the ESP is plugged into under Tools > Port.
  • If there is no enabled option under Tools > Port
    • Make sure you've installed CH340 driver (see previous step)
    • Make sure you are using a data/sync cable. Test it by connecting your phone and PC with that cable. If you could see files on the phone from the PC, then you have a good data cable.
  • If the compile fails before it tries to upload, scroll up in the black background window and then slowly scroll down and note the first error it reports. If you cannot figure out what it's saying, post that first error and I will try to help. There will be some warnings - those are OK, they do not stop the compile.
  • if you get a JSON-related error when compiling, use JSON library version 5.13.2 instead of the latest version (6-beta) -- Thanks lmirel !

  • If the compile succeeded, upload succeeded but the clock does not work, open serial monitor in Arduino IDE, press reset on the ESP. If the errors are a bunch of hex numbers, try changing the Flash Size to 4M(1M SPIFFS) and reupload.
  • If the error is in English, it should tell you what it's having trouble with. Post what it says if you need help deciphering what it's trying to say :-)

Step 12: Configuration

Once the upload is completed, you should see the word: "Connecting" on the display.

The ESP is trying to connect to your WiFi to fetch the current time. However, it doesn't know the password to your WiFi Access Point (AP) yet.

  • Press the reset (RST) button on the ESP twice in a row about one second apart.
  • The display will show you AP: MorphClk,Pwd: HariFun, and 192.168.4.1.
  • At this time, the ESP is acting as WiFi access point named MorphClk with password HariFun.
  • Go to your computer/phone to change your WiFi connection from your normal WiFi to MorphClk.
  • To switch WiFi, on Windows, the icon is on bottom right corner, on a Mac it's on top right.
  • You might see a warning saying that your phone cannot find the Internet. It's OK. Your phone is now connected JUST to the ESP and the ESP is not connected to the Internet (yet).
  • Using a web browser on your computer/phone, visit 192.168.4.1, this is a website being served by the ESP.
  • Tap "Configure WiFi" and select YOUR WiFi access point and enter your WiFi password. It will then save that information in permanent storage so you will never to enter it again.
  • This is also where you choose timezone
    Use this website to find the TimeZone offset for your location. Don't forget to enter the minus sign.
  • Enter Y in the 24Hr field to show hours in military format, or enter N if you prefer to 12 hour format. I do not yet have an AM/PM indicator. Maybe you could add that feature and share how you did it?
  • Don't forget to switch your computer/phone back to your normal WiFi access point or you will not have internet access.

Step 13: All Done!

Well, that's it!

All that's left is to make a pretty case for it.

You no longer need the computer/phone. You can use any phone charger to power the ESP.

Please let me know if you see anything that I could improve on this instructable. I will do my best to answer questions too.

If you build this, please click the "I Made It" button and show off your version. Have fun making!

Clocks Contest

This is an entry in the
Clocks Contest

4 People Made This Project!

Recommendations

  • Oil Contest

    Oil Contest
  • Clocks Contest

    Clocks Contest
  • Water Contest

    Water Contest

85 Discussions

Hi. Greetings from South Africa. Thanks for the detailed walk through.

Ive built as per instructions but seem to have got stuck. It seems to upload without a hitch. If I leave the serial monitor on 115200 I get Hex garbage but if I change it to 74880 baud I get this when I push the reset:

ets Jan 8 2013,rst cause:2, boot mode:(3,2)
ets_main.c

I don't get any action on the LED panel and it doesn't seem like the WiFi hotspot is active.

2 more answers

Sorry you're having problems. I think I've seen that issue before.
Please click the screenshot of the Tools menu on step 11. Make sure your Flash Size is set to 4M(1M SPIFFS). Let me know how it goes.

Hi. I did see that before I messaged you. Ive tried both flash sizes. My menu looks like yours except I'm on Com 5. Im very new at the ESP stuff so maybe some other newby mistake.

0
user
B0SC0

Question 8 days ago

I am trying to compile on win 7 pro pc with arduino 1.8.5

Any help would be appreciated.

Shows installed library

http://arduino.esp8266.com/stable/package_esp8266c...

This is the first set of errors:

Exception 0xc0000090 0x0 0x0 0xf2712
PC=0xf2712

syscall.Syscall12(0x7631103d, 0xa, 0x12918c60, 0x127ea000, 0x0, 0x0, 0x1, 0x400, 0x127af400, 0x0, ...)
/home/jenkins/go/src/runtime/syscall_windows.go:196 +0x4a
syscall.CreateProcess(0x12918c60, 0x127ea000, 0x0, 0x0, 0x1, 0x400, 0x127af400, 0x0, 0x1277d330, 0x1277d2dc, ...)

16 more answers

I tried the suggestions, but still had the same problem.

I have now tried on my laptop and it is compiling there okay.

Now I have uploaded the sketch and I get to AP: MorphClk,etc.

I reset the 8266 but I never see the access point.

Tried several times using my laptop and phone. It just doesn't show up in the wireless network scan.

Any help?

Sorry you are having issues. :-(

So this is what I see in the serial monitor of Arduino IDE, when I press reset twice.

Double Reset Detected

*WM: SET AP STA

*WM:

*WM: Configuring access point...

*WM: MorphClk

*WM: Invalid AccessPoint password. Ignoring

*WM:

*WM: AP IP address:

*WM: 192.168.4.1

*WM: HTTP server started

At this time, you should be able to see the MorphClk as a WiFi access point from your phone/computer. How does the debug messages compare to yours?

EDIT:
I've just looked up the datasheet for the ESP-12 that is on the NodeMCU. It only supports 2.4MHz WiFi networks. :-( On my home access point, it supports both 2.4 and 5.8, so I was able o see the 2.4MHz access point from the NodeMCU, but not the 5.8Mhz network. Do you have a 2.4MHz AP enabled for the NodeMCU to find?

Yes, I have both 2.4 and 5.8ghz.

I do receive "HTTP server" started as shown above.

I scan and refresh my wifi search(phone and laptop), but still no MorphClk.

It almost seems like the wifi on the 8266 is not working.

I am using this 8266 from amazon:

RobotDyn - 1 PCS - Compact NodeMCU V3 Lua WIFI module integration of ESP8266 + extra memory 32Mb flash, USB-serial CH340G

Both blue leds on it are lit.

Also, my display is showing only every other row when lit and part of the text is missing ex; MorphCl (no k showing) and 192.168.4. (1 not showing).see pic

CameraZOOM-20180715132816511.jpg

The garbled display is likely due to loose wire or wiring error.
As for the WiFi issue, I'm stumped as you are. The only thing I could think of is maybe your USB port cannot supply enough power for the WiFi on the ESP?
You could try powering the ESP with a phone charger. We won't be able to see debug messages, but maybe that would allow it to become an AP?

Okay, this is what I have done so far.

Tried powering 8266 with 5vdc 1@amp adapter. no change

Display is powered with 5vdc@2.6amp adapter. no change

Checked wiring for the 15th time, everything looks good after switching over to another new panel Same results as before.

Uploaded example of wifi ap server. Worked as it should. Positive now that wifi is okay on the 8266.

Uploaded pixeltime. Same problem with display as before.

Also noticed that your password is only 7 characters long, If I to try to add the network manually , connect button is grayed out because it needs an 8th character.

I added the 8th character and was able to enable the connect button. but still no go finding MorphClk.

So, my question is : why would you have the program ignore the password if it is wrong and continue. Doesn't this negate the security of having a password?

Summary:

I know the 8266 is working in accepting sketches.

I know the wifi is working from the access point example sketch.

I know that the http server is started.

I know it's highly unlikely two displays having the same problem.

So, I am at a total lost here.

Has anyone here got this working?

Bosco,
I'm stumped too.

Yes, member Mocraft has successfully made it.
https://www.instructables.com/member/mocraft/

I saw Mike Rankin has made three of them!
https://twitter.com/mikerankin/status/101754492962...

I presume you changed the HariFun password in the code to make it 8 characters, right? I think the WiFiManager uses AP password to protect from unauthorized settings change, and it will continue with the existing settings if invalid credentials were given.

If I recall correctly, I fixed some cosmetic and sync bugs after I publish the instructable, but the link to github should point to latest code in shared branch. I've also pulled those changes to master branch. At any rate, it's probably a good idea for you to pull latest code from github, just in case you do not have latest version.
https://github.com/hwiguna/HariFun_166_Morphing_Cl...

Already tried. no change.

  • AdaFruit Gfx library
  • PxMatrix by Dominic Buchstaller
  • WiFiManager by Tzapu
  • DoubleResetDetector by Stephen Denne aka Datacute.

Can you tell me what version of the libraries you are using?

Can you tell me what version of the libraries you are using?

AdaFruit Gfx library 1.1.5

PxMatrix by Dominic Buchstaller 1.0.0

WiFiManager by Tzapu 0.12.0

DoubleResetDetector by Stephen Denne aka Datacute. 1.0.2

Good luck!

  • AdaFruit Gfx library 1.2.5
  • PxMatrix by Dominic Buchstaller 1.2.0
  • WiFiManager by Tzapu 0.12.0
  • DoubleResetDetector by Stephen Denne aka Datacute 1.0.2

I don't have good news for you :-(

I updated my AdaFruit gfx and PxMatrix to same version as yours.
Mine still works :-(
I noticed that right after the upload, although it connected to my WiFi AP fine, it did not show time (just two colons). Pressing reset once fixed it.


You said the example sketch was also garbled. I wonder if you have a bad wire?!
Do you have a multimeter to test it?

If you could, compare my setup pics with your setup.

Maybe we can find the problem that way.

By the way, I do appreciate all the time you are spending on helping me.

Morph1.jpgMorph2.jpgMorph3.jpgMorph4.jpgMorph5.jpgMorph6.jpgMorph7.jpgMorph8.jpgMorph9.jpgMorph10.jpgMorph11.jpgMorph12.jpgMorph13.jpg

Well Bosco! I think we finally made progress!
I managed to break the graphics by removing all my zip except for the four you showed. Alas the network code STILL works. I had to press the reset twice after the upload was completed, but as you can see MorphClk AP showed up and I was able to connect to it.
I will continue digging into your other screenshots and see if I can figure out why the last character does not fit anymore.

Clipboard01.pngClipboard02.png

ok. I managed to "fix" the font issue by going back to "PxMatrix_LED_MATRIX_for_Adafruit_GFX-1.0.0"
I did this by removing "PxMatrix_LED_MATRIX_library" from this path (NOT the AppData where the zip files are):
C:\Users\hwiguna\Documents\Arduino\libraries

So it appears that Dominic added a feature so now the text will go to next line if it hits right of screen. Unfortunately for me, what used to fit on one line no longer does. EDIT: I've fixed this on github.

I still don't know why you're having WiFi AP issues though. Maybe you can backup the libraries folder I mention above and run with minimal libs?

update 2:

This is what is in my lib folder(see pic).

Removing those two arduino folders and the arduinojson folder results in errors compiling,so I put them back.

appdata folder remains the same as before(pic above).

Morph14.jpg

Hmm, that's odd... shouldn't we see AdaFruit GFX library there?
I'm not on my PC now, but I don't think I had Arduino_xyz directories either...