This annoying alarm clock project - lack of inputs.

Just kidding.

I'm having fun.

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.

Could you not use this library to add more input buttons?

Is that easy enough to do?

Yes, if you write the clock Arduino code accordingly.

but I am wondering about the practicality of it.

Practical enough, maybe over kill for something that is hardly ever done though.


six shooter,

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.

Digging around, I have struck another avenue.

What is this "SPI bus for Ethernet"?

In the docs for the shield it says these pins are "shared" with SPI BUS (Ethernet shield)

If I am not using an ethernet shield, can I use these pins?

And what can they do: Input/Output?

Doing some looking myself, but wanted to ask here anyway.

What is this "SPI bus for Ethernet"?

I have no idea, do you have a reference?


Instead of an entire other 'duino, why not a simple IO expander chip, like the MCP23S17 or similar? Control it through SPI (or I²C for the MCP23017) and add 16 more IO lines to the 'duino.

"Instead of an entire other 'duino, why not a simple IO expander chip, like the MCP23S17 or similar? Control it through SPI (or I²C for the MCP23017) and add 16 more IO lines to the 'duino."

As the I2C is already used for the EEPROM, I don't know if I can have the two chips on the same bus.
But the SPI is free as far as I know.
What kind of chip can plug into that bus?

That sounds like a good idea.

I'll look into that myself as well, but thought I would ask anyway.

I don't know if I can have the two chips on the same bus.

You can have as many chips as you like on an I2C bus within reason, as long as the addresses are different.


I've looked at this link:

But I can't see the link to download the library.

(Am I going blind that quickly?)

SPI is already built in. You don't need to download anything.

SPI has a buit-in library

Thanks folks.

What I have done is bought an MCP23017 chip.

That uses the I2C bus and that's what I shall use.

Having said that, the SPI bus pins are now "free" for me to use - which is kind of ironic.
The "lack of inputs" (and outputs) is nearly resolved with those two pins being usable.


For the sake of "future proofing" the project, I shall install the MCP chip.

Good choice :slight_smile:

What about using an infrared remote?
The sensor and remotes are cheap an it only uses a single Arduino pin.
There is a great IR library that makes the software side easy.

--- bill

The "problem" with Wi-Fi, Bluetooth, IR, what ever:

I need another "remote sending device".

It is an ALARM CLOCK, it would seem slightly over the top for what it is doing.

And, it would need batteries. Typically one day they would be flat, and I won't be able to turn off the alarm, or something.

It isn't quite a SIMPLE alarm clock. It has a few other functions/features as well which makes it handy to have.

I am curious about these other functions/features, if you don't mind sharing.

How many buttons do you plan on having on the clock in the end to cover all your functions/features?


That's an interesting question.

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.

That isn't the problem just now.

It is more: Getting the buttons acessable from the outside of the box.

So I don't want to put the 6 buttons on the "outside" when I may need another 'n' buttons.

I am thinking of going for broke and putting enough to leave some available for expansion.

Also more outputs.