Introduction: Cover It. Timer With Vibrating Alarm (TfCD)

Picture of Cover It. Timer With Vibrating Alarm (TfCD)

As a prototype for a wearable we have made a bracelet with a timer and a vibrating alarm. the alarm can be turned off by covering a LDR sensor. The idea behind this prototype is that it can be integrated in a (smart)watch. Initially the idea was to deactivate the alarm with an accelerometer, shaking the arm would have turned off the alarm. With no accelerometer at hand a LDR was used to show the principle and interaction. This instructable was inspired by other instructables.

Step 1: Step 1: Components

Picture of Step 1: Components

For this prototype the following components are used:

  • Arduino (in this case Duemilanove but uno or another arduino would also work)
  • Breadboard
  • 7 segment display
  • LDR
  • Transistor P2N2222A
  • DC Motor
  • Diode 1N4148
  • 4,7 KOhm resistor
  • 3x 220 Ohm resistors
  • Jumper wires

Step 2: Step 2: Assembly

Picture of Step 2: Assembly

Assemble the components as shown in the picture. when you extend the wires of the LDR and motor you can place them on a bracelet.

The 7 segment display is connected as follows

  • a = pin 2
  • b = pin 3
  • c = pin 4
  • d = pin 5
  • e = pin 6
  • f = pin 8
  • g = pin 9

One of the COM pins should be connected to the ground via a 220 Ohm resistor and the other COM pin should be connected to the VCC also via a 220Ohm resistor.

the 3rd 220 Ohm resistor is used for the motor.

and the 4,7 KOhm resistor is for the LDR.

Step 3: Step 3: Programming

Copy the following Code to Arduino:

int a = 2; //For displaying segment "a"
int b = 3; //For displaying segment "b"

int c = 4; //For displaying segment "c"

int d = 5; //For displaying segment "d"

int e = 6; //For displaying segment "e"

int f = 8; //For displaying segment "f"

int g = 9; //For displaying segment "g"

int LDR = A0; //LDR

int LDRValue = 0;

int tril = 12; // motor

void setup() {

pinMode(a, OUTPUT); //A

pinMode(b, OUTPUT); //B

pinMode(c, OUTPUT); //C

pinMode(d, OUTPUT); //D

pinMode(e, OUTPUT); //E

pinMode(f, OUTPUT); //F

pinMode(g, OUTPUT); //G

pinMode(LDR,INPUT); //LDR

pinMode(tril,OUTPUT); //motor



void displayDigit(int digit) {

//Conditions for displaying segment a

if(digit!=1 && digit != 4)


//Conditions for displaying segment b

if(digit != 5 && digit != 6)


//Conditions for displaying segment c

if(digit !=2)


//Conditions for displaying segment d

if(digit != 1 && digit !=4 && digit !=7)


//Conditions for displaying segment e

if(digit !=1 && digit !=3 && digit !=4 && digit!=5 && digit!=7 && digit!=9)


//Conditions for displaying segment f

if(digit != 1 && digit !=2 && digit!=3 && digit !=7)


if (digit!=0 && digit!=1 && digit !=7)

digitalWrite(g,HIGH); }

void turnOff() {







digitalWrite(g,LOW); }

void loop() { LDRValue = analogRead(LDR);

int i;

for( i=9;i>0;i--) { displayDigit(i); delay(1000); turnOff();

if (i <= 3)


else digitalWrite(tril,HIGH);


if (LDRValue < 500)


digitalWrite(tril,HIGH); } } }

Open the Serial Monitor to check the values of the LDR, to define the threshold that fits your environment, adjust "if (LDRValue < 500)" to your threshold.

Step 4: Step 4: Testing

The motor starts vibrating when the countdown reaches 3 and when the LDR is covered the motor stops again.


DIY Hacks and How Tos (author)2015-12-17

Great alarm design.

About This Instructable




More by ccjhage:Cover it. Timer with vibrating alarm (TfCD)
Add instructable to: