Motion Enabled Clock

I am coming back to blogging after more than 2 years. In the meantime, I have acquired a taste for electronics hardware with Arduino and Raspberry pi. The advantage with open source hardware is that we can think up and create crazy products like Motion enabled clocks at home.

Why does one need a motion enabled clock? In my case, we do not like the tick tock sound of regular clocks and neither do we like the light from the digital clocks. But we do want to see the time when we wake up. Also, we try not to use alarm clocks and so it is all the more important to check the time when we wake up. How cool will it be to have a clock that lights up and shows the time when we wake up? This is the inspiration for this clock.

Parts needed:

Arduino – Uno, Adafruit 0.56 4 digit LED display, DS1307 Real Time Clock (RTC), PIR Motion sensor, button cell battery, Jumper cables, Breadboard

Connections:

The connections are very simple in this case. The power (+ or VCC and – or GND) from the LED, RTC and the motion sensor go to the 5V and the GND pins respectively on the Arduino.

The analog pins on the Arduino A4 and A5 go to the SDA (data) and SDC (clock) pins on the RTC and the LED respectively. The motion sensor sends its motion data on its data line which can be connected to any of the digital input pins on the Arduino (I chose 7). This pin will be referred to in the code.

Code:

When I connected all the parts, it looked like this.

Image-1-4

Upload the code into the Arduino, power it up and see if it works.

IMG_4954

Debugging:

Some of the challenges I faced in building the clock were:

1. The motion sensor is very sensitive and needs to be in a place where there is no motion during calibration. I had to power it on and immediately leave the room for about a minute or two for it to accurately detect motion. I have left some of my comments in the code which helped in debugging the motion sensing.

2. The PIR specs say that it operates between 3-12V and I connected it to the 3.3V pin of the Arduino and it just would not work. Changing the power to 5V did the trick.

Even though the clock is very cool, there are still some problems which I will be working on in the coming days.

1. It is still on the breadboard and I will solder it to a more permanent stripboard.

2. The bigger problem is the power consumption. Any typical clock will run for months on a button cell battery while an Arduino powered clock will drain a 9V 450mAH battery in a matter of hours. I will be working on a more power miser setup too.

References:

I referred to these posts in order to create my clock:

1. Dr. Monk guide to build an Arduino clock

2. Arduino playground sample on motion sensing

3. The specification document for the motion sensor shows how it works and is a useful guide to debug problems with the sensor.