The Arduino UNO is small, but if you require your project to be in a small enclosure, the UNO might be way too big. You could try using a NANO or MINI, but if you really want to go small, you go tiny, Attiny to be precise.
They are quite small, cheap chips (basically small Arduinos) and can be programmed in the Arduino IDE, however you might notice that there is no USB connection. So how do we program it???
Attiny Programmer (using Arduino UNO) – [Link]