Where I am now stuck is the whole idea of controlling the alarm clock and the devices connected.
The "old way" of doing it with switches becomes annoying if I want to change how things work.
Getting it all computer controlled makes life a whole lot easier to configure things, but at this point I am stuck with the User input side of things. The display is good enough for what I want.
I have an Arduino UNO - or equivilant. So it isn't "blessed" with all the extra IO lines.
There in lies the problem: Input.
Although the shield has the buttons to set the time, etc - which are accademic once the time is set - I do need access to one of them to clear the alarm. Uless I modify the code to accept "any" key which would include the extra ones I want to add.
So there in is the problem.
What I COULD do - this is thinking WAY outside the box at this stage - is get yet another MINI Arduino and hook up a "keyboard" to it. Then with 4 wires - power and signals (maybe 6 is hardware handshaking is better but I notice there are no RTS/CTS lines, so I am not sure how important they are.) - and the button presses are done on that and the data sent serially to the main board..
Is that easy enough to do?
I know the Arduino has TX/RX lines - and I would have to check that they aren't used already - and so in theory it could be done, but I am wondering about the practicality of it.
I shall look at the link and see what I can make of it.
Yes, to a point. But this "alarm clock" - or the OLD one - has worked for 25 years.
I am accustomed to it and as it has died, I thought it would be good to bring it up to date with what it can do.
It isn't quite a SIMPLE alarm clock. It has a few other functions/features as well which makes it handy to have.
Alas the box has also kind of killed me - the original box was "huge" by comparrison. This one is (about) 14 cm wide, 50 cm deep and 10 cm high. PLASTIC.
The older box was 60 x 60 cm x 8 cm aluminium.
Sure it had extra holes which never got used, but it was the first and was destined for greater things.
The new one won't be quite as grandios but will (I hope) have better functionallity.
So that is where I am at now.
I have just finished putting it all in the box, and only need to get the user inputs going. So for the sake of learning while doing it, I am just looking at the practicallity and all that. the way things are going I probably shall have to go with that but I am still looking for other ways of doing it.
Originally I was confused to what to do, but after a lot of bashing my head against the wall and studying the code, I have "learnt" that the EXISTING 6 buttons can be used for different things depending on what the program is doing.
So though they are "scroll buttons" for menus, ENTER and ESCAPE, I have used 5 of those 6 for other things when the clock is displaying.
When the clock was showing, ANY key would excape back to the menu.
That was a severe waste of 5 buttons.
So now, ONLY the ESCAPE key exits the clock.
The other 4 buttons (up, down, left and right) do other things.
I have a "spare button" which is the ENTER one.
Alas the big problem is WHERE these buttons are. As I have a PHI-2 shield, and a LCD ontop of this, the buttons are back from the front of the panel. So they are not visible.
Sure I can put longer thingies on teh buttons so they extend past the front panel and so I can get to them when the unit is mounted in the box.
So really there aren't that many buttons to "put on it". But initially I was confused knowing about this "trick" I since learnt.
As I do'nt like to waste things learnt, and I researched the MCP 23017 which will givev me more I/O I am going to install it anyway as the beauty with this project is that it ca grow easier than the older one I had which if it "grew" mean more wires, a lot more electronics and the linke. This only needs a few more lines of code to do things.
I have bigger ideas for it once I get the next couple of problems resolved.
I did upload a couple of piccies, but can't find them now.
You could also have 4 distinct functions per button (simple push, double, long, extra-long).
Also, if you are looking for compactness, you can replace (hardware-wise) 2 simple buttons with a rotary encoder. Which rotary encoder could also have another push button by itself.
Or, you could use a piezo sensor and program it to detect all kinds of knocks or pressures. With only one input you could have a lot of inputs.