Arduino freeze wordclock | WS2812b - RTC - Button code

Dear all,

I'm really enthusiastic about Arduino and Coding it, but still quite a noob... I have a problem, which I'm almost certain is due to my code: The Arduino is freezing (at random moments).

Type of project:
Creating a word clock, similar to: https://www.instructables.com/Arduino-Word-Clock/

I'm using WS2812B led strips to light the letters. Because of the distance in between the letters (50mm), I need to use the 60 leds/m variants (distance = 16mm in between the LEDs) and only light up 1 out of every 4 (4 * 16 = 52mm)

Type of Arduino:
NANO 33 IoT (real one, no Alibaba fake)

components in use:
Powerbank 5V (20.000ma) + WS2812B Led strips + RTCDS3231 + Radar RCWL-051 + Push buttons + LDR sensor

The problem(s)

  1. The Arduino/system freezes after random moments of time when it's turned on. Sometimes after 20 minutes, sometimes after 5 hours or so. The LEDs are still on, but all sensors/buttons stop working and the time isn't updated anymore.
    If I turn the power down and back up again, the time is updated (on most occasions) but will not continue to run (stands on the same time forever..)
  2. If I want to adjust the time, I can add about 3/4 minutes or hours before the Arduino freezes. Also, when it's connected to my PC, the connection is lost.

On both occasions described above, I need to connect the Arduino to my PC, hit the reset button, and upload the example blink sketch simultaneously to have it working / available again.

What I'm trying to accomplish

  • Stable running word clock so I can mount it to my wall forever..
  • With the buttons I want to be able to adjust the color of the letters (Pin 9, via multiple pre-sets) and the time (pin 2 and 3)
  • The LDR sensor should set the right brightness to the letters, matching the surrounding room brightness
  • The motion sensor should turn the LEDs off after 30 minutes of no movement, saving power of the power bank

I already tried to learn as much as possible from examples and reading/searching for other codes, but after many frustrating nights, I can't find my way out, unfortunately..

Any help is really appreciated, you will be my hero :cowboy_hat_face:

Any tips on optimizing the code are welcome as well, I'm still trying to learn as much as possible.. (string of I (min.&hours) is really, really long for example)

Link to code: Wordclock_Code_V2.ino - Google Drive

Thank you in advance! :upside_down_face:

Post your code, in code tags.

Post a pic or 2 or 3 of your project.

Post a schematic.

You might want to correct this: "Powerbank 5V (20.000ma)" that will not come close to operating your system. You might want to go through your power calculations again. At full brightness each of the RGB LEDs draws approximately 50 mA.With out a schematic, not a frizzy thing I cannot give you a definitive answer. Note: as you state your Powerbank capacity it will not even power one LED.

I took a look into this instructable-project.

hm - lot's of things to do. Somewhere inbetween there is code.
The file can be downloaded "from above"

Well the best thing is if you post exact that code that you uploaded into your arduino-nano
You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

best regards Stefan

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.