💬 Smart Alarm Clock
-
@dbemowsk said in 💬 Smart Alarm Clock:
In this approach, whichever button you press, the resistor values, being in series, add up giving you a different voltage on your analog pin. With your approach, you use different resistor values on each switch which gives you your different voltage. My approach is only slightly different than yours. I am just wondering if there is an advantage one way or another.
I guess it is useful in the case when user pushes more than one button ?
-
@dbemowsk said in 💬 Smart Alarm Clock:
In this approach, whichever button you press, the resistor values, being in series, add up giving you a different voltage on your analog pin. With your approach, you use different resistor values on each switch which gives you your different voltage. My approach is only slightly different than yours. I am just wondering if there is an advantage one way or another.
I guess it is useful in the case when user pushes more than one button ?
@Nca78
exactly correct.I originally went with the same resistor value so that it was easy. But then when I thought about how many button combinations I wanted (thinking about a real clock where you hold down the alarm set button then press the hour button) I went with different values.
My implementation still isn't perfect, since I'm a bloody amateur... lol. I think 1 or 2 of the combinations I never got working.
But for the most part it accomplished what I wanted... provided many buttons and combinations on a single input pin, since I was quickly running out of them
-
I found a library online.... #include <AnalogMatrixKeypad.h>
I made some modifications (although I can't quite remember what they were), I think about the number of buttons, or combinations, or target values.
But generally the library provided the 1 wire, resistor ladder and debouncing functionality I needed
-
I found a library online.... #include <AnalogMatrixKeypad.h>
I made some modifications (although I can't quite remember what they were), I think about the number of buttons, or combinations, or target values.
But generally the library provided the 1 wire, resistor ladder and debouncing functionality I needed
@micah Picking resistor values based on the number of switches you have shouldn't be too terribly difficult. You ar just creating a voltage divider circuit. When pushing multiple buttons, you just have to look at the resistor values for the buttons you have and calculate out the parallel resistance. Then you just have to figure out the analog value for any key combinations you want to use and create IF or Switch/Case statements to perform your logic.
-
So, I didn't look the sketch over for this, but I am planning on building one of these and I have some questions. Does this show in 12 hour or 24 hour format? If it is 12 hour, how do you indicate AM or PM? Also, do you have a way of indicating that alarms are set? I may add some LEDs for these features.
-
Here is my start on this. No speaker yet and I haven't added the LEDs for AM/PM and alarms, but that will come.

I will need to make a bunch of modifications to the sketch. Mainly because I am using a different RTC module (DS1307). It is one that I have had laying around in my parts bin for years. I get a bunch of compile errors when I try to include the RTC library for this module.

Here is the board layout so far.

-
So, I didn't look the sketch over for this, but I am planning on building one of these and I have some questions. Does this show in 12 hour or 24 hour format? If it is 12 hour, how do you indicate AM or PM? Also, do you have a way of indicating that alarms are set? I may add some LEDs for these features.
@dbemowsk
To use a 24 hour clock switch the following boolbool Screen_HourFormat24 = false;I think I used the colon to signify that an alarm was set, I think I flashed it on and off. in the Update_Screen method
if ((Alarm1_Enabled) && (!Keys_ShowAlarmOnScreen)){ if(Screen_ClockPoint)ledScreen.point(POINT_ON); else ledScreen.point(POINT_OFF); } else ledScreen.point(POINT_ON); -
@dbemowsk
To use a 24 hour clock switch the following boolbool Screen_HourFormat24 = false;I think I used the colon to signify that an alarm was set, I think I flashed it on and off. in the Update_Screen method
if ((Alarm1_Enabled) && (!Keys_ShowAlarmOnScreen)){ if(Screen_ClockPoint)ledScreen.point(POINT_ON); else ledScreen.point(POINT_OFF); } else ledScreen.point(POINT_ON);@micah said in 💬 Smart Alarm Clock:
To use a 24 hour clock switch the following bool
I wasn't necessarily saying that I wanted to switch to 24hr format. I was wondering if you had a way of indicating AM and PM when in 12 hour format.
@micah said in 💬 Smart Alarm Clock:
I think I used the colon to signify that an alarm was set, I think I flashed it on and off. in the Update_Screen method
I see, so when it is blinking there is an alarm and when it is on solid there is not. I may add a different alarm indicator..
One other question on this. I see you have 5 buttons on your switch panel. What were your planned uses of those 5 buttons? I didn't see anything documented on that.
-
Another thing that I've thought of is removing the RTC module completely since we can query the time from the server periodically.
This would save components and pins, but it would limit the clock to only working with the controller, whereas the current design allows it to run independently
-
:-D Wow, what an amazing design.