INTERACTIVE INTERNET CLOCK

17K14442

Intro: INTERACTIVE INTERNET CLOCK

Today, I would like to share how to make an internet clock with interaction effect by P2.5 RGB LED MATRIX 64x64. This clock not only displays the time but also interacts with our motion. It simulates the LEDs as particles of sand and when we interact with clock matrix, particles of sand will move as if they were affected by gravity. Time and motion data are collected and controlled by a MPU6050 (Accelerometer + Gyro) and NODEMCU-32S.

Let's get started.

STEP 1: PARTS LIST

Main parts are listed as below:

STEP 2: WIRING DIAGRAM

Input Connector (PI) and Output Connector (PO) of P2.5 RGB LED Matrix 64x64 is labeled in the above picture.

And the wiring diagram between ESP32 (NODEMCU-32S), P2.5 LED MATRIX 64x64 and MPU6050 are shown in the table below.

STEP 3: SOLDERING WORKS

This P2.5 RGB led matrix 64x64 has a dimension Width x Length = 16 x 16cm. All the components, wires can be soldered on a double-side copper prototype PCB 9x15cm. With my instructable, after finishing soldering, we can plug this PCB into PI and PO of P2.5 RGB LED MATRIX 64x64, like a Shield. In the future, it have enough space to add some extra components on this PCB board.

  • Marking and drilling a hole on the Double Side Prototype PCB at the power supply position of the RGB LED Matrix

  • Soldering female header at PCB bottom for connecting from ESP32 to Input Connector (PI) and Output Connector (PO) of RGB LED Matrix 64x64. Tip: In order for all wires can go through easily under PCB, I have stacked 8 pin "RECTANGULAR FEMALE HEADER" on the 8 pin "ROUND FEMALE HEADER". After soldering, we can use super glue to attach them tightly together.

  • Soldering female headers at PCB top for NODEMCU-32S and MPU6050, then soldering the circuit following the previous step

*** TOP view of PCB after soldering

*** BOTTOM view of PCB after soldering

  • Plug NODEMCU-32S and MPU6050 on the PCB

  • Plug PCB female headers to Input Connector (PI) and Output Connector (PO) of RGB LED Matrix 64x64, then plug 4 wires power supply from PCB to led matrix.

  • Cover the back side of RGB LED Matrix by White Acrylic Plate

  • Done

STEP 4: PROGRAMING

My program is referenced to the following sources:

Libraries are used in my program:

You can download full code of interactive internet clock at my GitHub.

NOTES:

  • MPU6050 connect to ESP32 NODEMCU-32S by following pins:

*** SDA (MPU6050) - GPIO27 (NODEMCU-32S)

*** SCL (MPU6050) - GPIO26 (NODEMCU-32S)

mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_4G, MPU6050_ADDRESS, 27, 26))
// SDA - GPIO27 and SCL - GPIO26
  • As mentioned from Dominic Buchstaller (PxMatrix's author), some panels have a slow multiplexer and only a partial image is displayed. To remedy this we can add some delay to the multiplexing function to set the time in microseconds that we pause after selecting each mux channel
setMuxDelay(uint8_t mux_delay_A, uint8_t mux_delay_B, uint8_t mux_delay_C, uint8_t mux_delay_D, uint8_t mux_delay_E);

My Chinese friend bought for me this P2.5 RGB LED MATRIX with a very cheap price from Taobao (about RMB66.5). After applying this function, it worked perfectly otherwise my led matrix can't show anything.

display.setMuxDelay(0,1,0,0,0);

  • You can adjust the time offset to your timezone
#define NTP_OFFSET    25200 // This is Vietnamese Time Zone
  • You can change the font for numbers and strings
#include <Fonts/FreeSansBold9pt7b.h>
#include <Fonts/FreeSansBold12pt7b.h>
#include <Fonts/FreeSansBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>
  • The "CLOCK" in the middle of led matrix is defined as an obstacle
imgWrapper.setCursor(0, 26);
imgWrapper.setFont(&FreeSansBold9pt7b);
imgWrapper.setTextColor(myWHITE);
imgWrapper.print("CLOCK");

And this obstacle "CLOCK" is displayed on the led matrix as following codes below and we can change it by replacing the "CLOCK" string to other strings or images.

display.setCursor(0, 32);
display.setFont(&FreeSansBold9pt7b);
display.setTextColor(myWHITE); 
display.print("CLOCK");
  • In order clock matrix can interact exactly with motion, we should double-check actual position of MPU6050 on the PCB to see how it correlates with coordinates of the matrix led. Base on this, we can adjust the programing code accordingly.

STEP 5: SOME TESTINGS

On instructables website and GitHub, we have lots of amazing led projects and I have tested them on my 64x64 led matrix, such as:

  • GRAVITY EFFECT by Brian Lough and Daniel Porrey.

  • TETRIS CLOCK by Brian Lough and MORPHING DIGITAL CLOCK by HariFun.

  • We can add some more components on 9x15cm PCB, specifically, I soldered 2 x MSGEQ7 for adding 2 channels spectrum analyzer function to the led matrix board. It's great, I can play on this led matrix in my free time.

STEP 6: FINISH

Thank for your watching!

Please LIKE and SUBSCRIBE to my YouTube channel.

27 Comments

I made it but my pixels don't move, they are just scattered across the screen. I checked the circuit and there are no gyroscope errors. Help, what did I do wrong? I’m answering my own question) you need to put two files in the folder with the sketch.

Gute Arbeit
danke
Grüß
Alex
Hi Alex,
was ist das für ein Board? Kann man das kaufen? Oder das Layout irgendwo herunterladen?
Hallo,
sory lange Zeit war ich nicht online, ja bitte E-mail

grüse
Alex
Hello,
my question is how can I put the Spanish time in the line NTP_OFFSET 25200.
Thank you
Hi.
I wanted to add some code to turn the display off overnight (say 10pm to 7am). I can write the code fine with the only problem in getting the display to turn off and on by command. I tried using the command display.display(0) to turn it off and display.display(10) to turn it back on without luck.
Any insights you have to get this working are appreciated.
Thanks,
Chad
Hi,

Rewrite of original post.... first I wanted all the grains to reset position every 30 seconds which I couldn't get to work so instead I ended up having gravity flip flop every 15 seconds by making adjustments to the ay values with the changes to the code described below. I also designed a backing plate using Fusion 360 that can be 3D printed with integrated "grips". I have posted it to thingiverse at:
https://www.thingiverse.com/thing:4546407

I defined a global variable:
int CHK = 1; // Flip Flop pixels

in void pixelTask I added/edited the following:
//
// NEW CODE BEGINS TO FLIP FLOP GRAVITY EVERY 15 SECONDS
//
int16_t ax, ay, az;
if (CHK == 1) {
ay = (-accelY - 1000) / 256; // to grain coordinate space ORIGINAL 11500 then 11750
}
if (CHK == 0) {
ay = (-accelY - 5000) / 256; // to grain coordinate space ORIGINAL 11500
}
//
// END NEW CODE
//

ax = (-accelX + 2750) / 256; // Transform accelerometer axes
//ay = (-accelY + 11750) / 256, // to grain coordinate space ORIGINAL 11500
az = abs(accelZ) / 2048; // Random motion factor

in loop() I added the following:
//
// Flip flop grains every 15 seconds so when clock is sitting vertical, it keeps things looking interesting...
//
if (secondStr == "00" || secondStr == "30") {
CHK = 1;
}
if (secondStr == "15" || secondStr == "45") {
CHK = 0;
}
//
// END NEW CODE
//

Hi,
I just finished with my build and I have one question. I need to adjust the gyro calibration. When sitting flat, my pixels want to go up and to the left. How do I go about making adjustments so that when the panel is sitting horizontal, the pixels are floating about like in the beginning of your video?
Thanks!
Hi ctbaker71,
As mentioned in my post, in order clock matrix can interact exactly with motion, we should double-check actual position of MPU6050 on the PCB to see how it correlates with coordinates of the matrix led. Base on this, we can adjust the programming code accordingly. Please check below image for my led matrix. In your case, you can adjust at these codes: int16_t ax = -accelX / 256 ay = -accelY / 256You can swap accelX/ accelY or change their values from negative (-) to positive (+).
Hope this helps!
Thanks for the reply, your response makes perfect sense. I will adjust the code, double check my sensor placement and update my response with the results.

UPDATE:
I ended up doing incremental changes until I got to values that worked well which I have copied below. Thanks again for your help!

int16_t ax = (-accelX + 2750) / 256, // Transform accelerometer axes
ay = (-accelY + 11500) / 256, // to grain coordinate space

Servus,

ich habe extra 64x64 P2,5 bestellt aber funhtioniert nicht, ich habe alle möglichkeit probiert. Kann eine Kollega mir helfen oder laufende Skizze ..?
Could this work with Raspberry Pi? (I am very new to this kind of thing and have only used Arduino once a few years back) Great Instructable! :)
Thanks for answering! I'll check it out. Keep up the good work!
Hi @Abnormalful. Thanks and wish you success with Raspberry Pi.
Hallo Emphijali,

Ich Brauche LED-Matrix 64x32 Sketch, wo kann Ich finden ?
danke

Alex
Can I buy this already made??
Hi Jarvis. I only have one led matrix board so I cannot sell it to you. Sorry!
AMAZING! it look's so good
More Comments