Clear all

Arduino, DS3231 RTC, 64x132 OLED, NeoPixel LEDS

3 Posts
3 Users
New Member
Joined: 6 months ago
Posts: 3
Topic starter  

Here goes, my first post in any forum.  

I have been messing with Arduinos for some time now with most all sketches created by others and modified to my needs as required.  I am in need of help or guidance to finish a project that has a deadline of one month from now.  I have a Clock designed for my grand daughter (8 yrs old), her birthday is next month, and the clock is working great using an Arduino Mega (ran out of resources on the nano), a DS3231 RTC, a DIYMore 64x132 2.42" OLED configured for I2C and 132 NeoPixel LEDs for show.  I have borrowed several sketches and made the display show what I want and causes the LEDS to put on a show at the minute (rainbow effect) and hour (not yet determined) with 12 LEDS for Hours, 60 for minutes and 60 for seconds. I have 3D printed the clock enclosure ready to go.

Now the issue: My son wants the clock to have an alarm.

I have spent the last 2 weeks looking into various sketches to incorporate but can't seem to wrap my mind about the issue. 

I am almost at the point of including a separate Nano (AKA: 2 masters) and tiny 32x132 OLED to run just that function, with the capability to talk to the RTC only once at power up to get the date and time info.

While I was typing this I took a 3 hour break and downloaded some alarm code.  It compiles fine but doesn't work properly. Goes directly to setup screen but the buttons don't do anything. I went thru the file and made changes that I thought would help it out but with the same results.  

I am open for any suggestions. A programmer I am not but I am starting to understand more and more.  Repetition is the only thing that makes it stick in my mind and then only as long as I am fiddling with coding. I'll forget this if I stop for any appreciable length of time.

If you want to see the code I currently have I'll try to upload it.


Thanks for any help in advance.

I will still try to find something that I can plug in.


Noble Member
Joined: 1 year ago
Posts: 2111


First, welcome to the forum !

Implementing an alarm shouldn't be too difficult. You're already checking the time since you have to display it, so checking if the clock time matches the alarm time should be easy.

You'll probably need to add a buzzer to the clock internals so that you can sound an audible alarm when appropriate.

Probably the trickiest part will be to actually SET the alarm in the first place because clocks don't usually come with a keyboard or a lot of buttons to facilitate selection of a time. Somehow, you'll need to provide a means for your clock to enter a new mode where it displays a valid time which can be adjusted forwards and backwards quickly and then store that time with a flag to indicate whether the user wants to execute the alarm or not (maybe they just wanted to set the time but didn't really want the alarm function).

How complex the setting of the time will be depends on how specific your son wants the time. If, for instance, he's happy with even hours, then you can blast through the display very quickly and set the alarm hour quickly. If he wants a full hour, minute and second time then you'll have to spend a lot more time scrolling through the times.

If you have enough room to add a keypad such as 


you might be able to glue it onto the back of the clock and use it to read the desired wakeup time directly. You could also use one of the buttons to signal that you want to enter a time and another to cancel or erase the current alarm time.

I hope this gives you some ideas about how to proceed and get this made inside your deadline.

I was kidnapped by mimes.
They did unspeakable things to me.

Noble Member
Joined: 3 years ago
Posts: 1549


If you want to see the code I currently have I'll try to upload it.

Ok. Assuming you are using the Arduino IDE for writing code? Right mouse click the text and choose Select All. Right click the text again and choose save as HTML.

Now within your forum post hit the Enter keys a few times to create some lines in the text to insert the code text. In the menu bar on the left of the smiley emoji there is a ; with an { and an } on either side. Holding the mouse over it should show the text, Source Code. Click the icon and a Source code window will appear.



Right click between two of the p's as shown below to set the cursor position and choose Paste.



It might also help to attach an image of your project, see bottom icons with a paper clip image and the text Attach Files.

The more information the easier it is for anyone to make suggestions or provide code.

A solution might be some buttons so you can select a mode and increment up/down as done with digital clocks in cars to set current time or set an alarm time.

To enlarge any image in a post, right click image and select Open Link in New Window.