Vibrating Watch to Remind Wearer Not to Waste Time
by AccidentalRebel in Circuits > Wearables
4349 Views, 22 Favorites, 0 Comments
Vibrating Watch to Remind Wearer Not to Waste Time
Everyone knows that time is both fleeting and limited. And yet we still forget this simple truth and continue to waste time on unimportant things.
I created a watch that would vibrate every 5 minutes to constantly remind me to not waste precious time procrastinating. This watch is different from a traditional watch as it only informs the wearer on the passage of time instead of the current exact time.
I now wear this watch all the time and it has improved my daily productivity. I hope that this instructable would also help you in making better use of your time.
Note:
- This instructable was inspired by the Vibrating Timekeeper instructable. I have improved upon the design to meet my specific needs for this project.
Prepare Parts and Tools
Here are the parts and tools that you'll be needing for this project. Some are optional and their use will be explained throughout this instructable.
Electronic parts:
- ATTiny85
- Disc vibrating motor (Or any kind of vibrating motor, look for low powered ones)
- CR2032 Battery (Or any kind of coin cell battery)
- 1N4001 Diode (Or any other general purpose diode)
- PN2222A Transistor (Or any kind of general purpose NPN transistor)
- 47 Ohm Resistor (1/4 watts)
- 100 Ohm Resistor (Optional)
Misc parts:
- Coin cell battery holder
- Breadboard
- Perfboard
- Connecting Wires
- Slide switch
- Crimp wire terminal (Optional but recommended)
-
8 pin chip socket (Optional but recommended)
Tools:
- ATTiny85 Programmer using Arduino (Or other programmers if you have them)
- Multitester
- Wire stripper
- Soldering iron
- Soldering wire
- Double sided tape
Build the Circuit on a Breadboard
Build the circuit by following the diagrams and the images above. Take special note of the orientations otherwise the circuit might not work correctly. Be sure to check out the annotations on the image above for more information about specific details.
Once you finish building it, you would notice that nothing would happen. This is because the ATTiny85 has not been programmed yet. We will be dong this on the next step.
Explanation of the circuit:
- The ATTiny85 sends out a signal on Pin 5 to the NPN transistor (Q1) which acts as a switch that makes the current flow through the motor.
- Resistor (R1) lowers the voltage for the motor so that the strength of the vibrations is lower.
- Resistor (R2) lowers down the voltage a bit for the transistor's base.
- The diode (D1) acts a flyback diode that protects the circuit from a voltage spike as a result of power being cut from the motor.
Tips for this step:
- I personally prefer cutting down wires so that they are flat on a breadboard. This makes the board look cleaner and easier to visually debug if there are any problems.
Note:
- Note that on the picture of the breadboard I've built you may notice that the slide switch is missing. I forgot to add it when I took the picture. This is okay though as the circuit would still work without it.
Program the ATTiny85 With an Arduino
Before the circuit could work we need to program the ATTIny85 using a programmer.
If you don't have a programmer yet you can easily make one by following one of these instructables: one is a breadboard version if you want to have a programmer quickly. The other one is in the form of an arduino shield which is more permanent for future use. Any of the two will work.
Copy the code below and upload it using your programmer:
#include #include #include #include const byte motorPin = 0; volatile unsigned long wdCounter = 0; // Volatile tells compiler to reload each time instead of optimizing unsigned long motorDuration = 500000; unsigned long waitDuration = 0; unsigned long wdCounterTarget = 75; unsigned long timeDelayStarted = 0; bool isInDelay = false; void setup () { pinMode ( motorPin, OUTPUT ); ADCSRA = 0; // Turn off the ADC startMotorSequence(); // Run the motor once on startup sleepNow(); } void loop () { if ( wdCounter == wdCounterTarget ) { // Check if counter has reached target. wdCounter = 0; timeDelayStarted = micros(); isInDelay = true; // Now in delay mode } // Continue to loop until enough time has passed to reach waitDuration if ( isInDelay && micros() - timeDelayStarted >= waitDuration) { startMotorSequence(); // Run the motor sequence wdCounter = 0; isInDelay = false; // End delay mode } if ( !isInDelay ) { sleepNow(); } } void startMotorSequence() { digitalWrite( motorPin, HIGH ); _delay_us(motorDuration); // Blocking function delay digitalWrite ( motorPin, LOW ); } void sleepNow () { set_sleep_mode ( SLEEP_MODE_PWR_DOWN ); // set sleep mode to Power Down. The most energy efficient setting. power_all_disable (); // Turn power off to TIMER 1, TIMER 2, and Serial Interface noInterrupts (); // Turn off interrupts as a precaution. Timed sequence follows resetWatchDog (); // Reset watchdog, making sure every flag is properly set sleep_enable (); // Allows the system to be commanded to sleep interrupts (); // Turn on interrupts. Guarantees next instruction is executed sleep_cpu (); // Goodnight, ATTiny85 sleep_disable (); // Returns here after Watchdog ISR fires. power_all_enable (); // Turn on power to TIMER1, TIMER 2, and Serial Interface } void resetWatchDog () { MCUSR = 0; // Clear various "reset" flags WDTCR = bit ( WDCE ) | bit ( WDE ) | bit ( WDIF ); // Allow changes, disable reset, clear existing interrupt WDTCR = bit ( WDIE ) | 1 << WDP3 | 0 << WDP2 | 0 << WDP1 | 0 << WDP0; // 4s timeout wdt_reset (); // Reset the watchdog using the parameters } ISR ( WDT_vect ) { wdt_disable(); // Disable the watchdog timer wdCounter++; // Increase the watchdog firing counter. }
Once the code is successfully upgraded, plug the ATTiny85 chip back on the breadboard. The vibration motor should start to vibrate for around 0.5 seconds. It would then count down for roughly 5 minutes and then vibrate again.
Explanation of the code:
- To lower power consumption, the code makes use of the ATTiny85's watchdog timer to do a countdown until the next time it needs to vibrate. Note that this is not what the watchdog timer is intended to be used for, but it has been used by many to have low powered (yet inaccurate) delays. More info here if you don't know what it is.
- The circuit needs to vibrate every 5 minutes or 300 seconds. So the watchdog uses 4 second intervals and triggers 75 times (4*75=300). Note that if the delay is to be changed then the computations need to be changed as well.
- Other parts of the code is straightforward, when the countdown is finished. The motor is triggered for 0.5 seconds and then the countdown is restarted by triggering the watchdog.
Tips for this step:
- If there are uploading errors make sure to double check the connections of your programmer. To help with troubleshooting, just copy the error code from Arduino and search for the answers.
- If there are any unexpected behaviors make sure that there were no changes to the code you downloaded.
- If there are still problems, consider uploading a simple blink circuit just to test if your programmer is working as intended.
- If the motor is not vibrating or it is vibrating continuously, make sure to double check your connections from the previous step. You can also try to cut off the power and turn it on back again using the slide switch to restart the program.
Get a Watch Case
Find a watch case that will house your circuit. You need a lot of room as you'll be fitting all of the components in the breadboard in it except the wires. You can also 3D print your own case, if you prefer.
On my end, I used a broken kids watch that has a lot of room inside. I removed all the existing components, hollowed it out, and tried to estimate if the space is enough for everything to fit in it.
Tips for this step:
- To help approximate if your circuit will fit the case, try and build the circuit found on the next step without soldering the components and then fitting the circuit inside.
- At the very least, you'll need a size that would not be smaller than your CR2032 battery.
Prepare the Perfboard Layout
Use a ruler to measure the dimensions of the available space inside your chosen case. Cut off a piece of perfboard based on these measurements.
The diagram/layout from the images above is the same circuit from that we did using the breadboard only made more compact. It has 10 holes horizontally and 6 holes vertically. This is the smallest version of this circuit that I can come up with. If this layout does not fit your chosen case then you may need to change the layout on your own, or find a bigger case.
Tips for this step:
- Bend the legs of the components as seen in the images to keep them in place before you start soldering.
- If the board is a tight fit sanding down the sides of the board with sandpaper is also an option.
Solder the Components in Place
Now it's time to start soldering. This should be straightforward provided that you follow the circuit diagram.
Here's an instructable in case you don't know how to solder yet.
Note:
- The first image showing the circuit diagram above is using a top down view. Which means, if you'll be soldering the components from below, the orientation would be flipped as seen on the second image. It's easy to get confused!
Tips for this step:
- Solder the component in place first before cutting the legs off. This helps in keeping them in place while soldering
- Make sure to check the continuity of the connections with a multimeter as you go along.
- If you don't want to use too much solder, you could use the legs of the components you recently cut off for straight lines as seen in the image above.
Connect the Battery and the Switch
To be able to connect the battery with our circuit we first need to use a battery holder. We could use the battery holder we had when we did the circuit on a breadboard but that might not fit in your chosen case.
One solution is to attach the end of a wire to a crimp wire terminal as seen in the first image above. Make two of them and then have them in contact with the positive and negative sides of the battery and wrap them using an electrical tape.
Solder the wires to the circuit and to the slide switch. Be sure to test out the circuit by triggering the slide switch. Just like last time, the vibrating motor should run for 0.5 seconds signifying that your connections are correct and working.
Tips for this step:
- Use a multimeter to check if the end of your wires is getting a voltage reading out of the battery.
- Make sure to double check that your contacts are firmly in place.
Note:
- The crimp wire terminals help in making the contact points larger and are easier to secure in place.
- If you don't have crimp wire terminals, just stripping off the end of the wire and using that as contact would still work.
- You may have noticed that the slide switch is on the negative wire of the battery. This would still work no matter if it is on the positive side or the negative side. I did the latter because it makes sense when placed inside my own watch case.
Place the Circuit in the Case and Cover It Up
Test the circuit that you built to see if everything is working fine. Then carefully place your circuit to your chosen watch case, secure the components in place with double sided tape.
Cover it up, add a watch strap, put it on, and you are done!
Tips for this step:
- Don't forget to paint your watch case before you add your circuit. I chose color black because pink is not really my style.
- Use the thick and soft kind of sticky tape, especially for securing the sticky motor in place. I find that it's more able to withstand the vibrations and keep the motor in place.
Final Notes
Here are some final notes about the project. It's quite a lot but are important if you want to know why I made certain decisions in this project. It also includes notes on how to modify and improve the circuit to your own preferences:
- The code is optimized to use as little power as possible. More info on how I did it here.
- The watch I'm currently wearing right now has been running for 2 weeks already (At 2019-03-26, I'll update this statement whenever I can). I am hoping that the watch will last for a minimum of 3 months.
- The R1 100 ohm resistor is used to lower down the current passing through the vibrating motor. This makes the motor weaker but saves battery life. If you feel that the vibration is too weak while inside your chosen case, you can remove this resistor and replace it with a wire.
- I have mentioned in one of the steps that the delay between vibrations is "roughly" 5 minutes. This project relies on the ATTiny85's internal clock for timing which is not very accurate (Believe me, I tested it). Expect an offset of 100ms to 1s every 5 minutes but this will depend on the current temperature of the room and current voltage of the battery. Don't be bothered by this though. I found that accuracy does not matter too much. Remember, that this project tells us the passage of time, and not the current exact time. If it still bothers you, consider adding an external crystal to the circuit.
- The 5 minute wait time can be changed by modifying the code. Only do this if you understand the code and you know what you are doing. To those confident enough, check out the variables waitDuration and wdCounterTarget, and also line 71 where the watchdog timeout is set.
- Be sure to check out the Github repository for the latest version of this code just in case there are updates or improvements.
- Finally, check out and follow the project page. I have a lot of improvements planned for this project like making the watch smaller using SMD components and adding an external crystal for more accurate timings. So keep an eye out for that.
If you have questions and comments feel free to leave a comment below!
Enjoy your new watch and savor every precious second!