-
1Get the Parts
See this BOM on FindChips if you are building the easy breadboard prototype version.
-
2Download Arduino IDE
The latest version of the Arduino IDE is recommended. Get it from arduino.cc.
-
3Download the firmware source file
Install git and clone the GitHub repository by issuing
git clone <a target="_blank" rel="noopener noreferrer" href="https://github.com/LightningStalker/Med-Timer.git">https://github.com/LightningStalker/Med-Timer.git</a>from within your sketchbook folder or download the ZIP file from the GitHub. Either way, you should end up with a folder namedMed-Timerinside your sketchbook folder. The sketchbook folder is a directory namedArduino, either in your home directory on Linux machines, or inside theDocumentsfolder on Windows and Mac OS. -
4Compiling and Uploading
Now start up Arduino IDE and
Med-Timershould appear in theSketchbookin theFilemenu. If not, just go toFile -> Openand locate the place where you cloned/unzipped it in the step above. Open upMed-Timer.inoor click onMed-Timerin the sketchbook. Customize the timers and alerts under where it saysmorning dose. This should be fairly obvious if you have experience with Arduino sketches. If not, arduino.cc has everything you need to get started. See more about this further down in theCustomizationsection.The rest is obvious if you're familiar with Arduino. Plug in the Arduino USB and it should be automatically detected in Arduino IDE. Select your board under
Tools -> Boardand click the blue arrow ➡ button to upload orSketch -> Uploadand your timer should be ready. -
5Switch and Buzzer
Plug the Arduino into a breadboard and attach the buzzer to A4 and GND. Attach a switch to A12 and GND.
-
6Code Customization
All input and output pins are interchangeable, of course, by modifying the appropriate lines of code. Pin D13 is used by the Arduino's onboard LED, however and use of other pins is recommended.
The time delay
hours(),minutes(), andseconds()wrapper functions for thedelay()function are provided for convenience. Use them to set intervals between doses.Sometimes 2 or more different medicines are taken at differing intervals. The
errorvariable has been provided for this purpose. Thealert()function returns anunsigned longof how many seconds it has been running. In case the alert is not noticed for several minutes, this accumulating time value may be stored inerrorand subtracted from subsequent calls to time delay functions.In the example POC, 2 medicines are taken in the morning at the same time before starting the timer. One is to be taken every 4 hours, and another to be taken once more again in 5 hours. If after running the 4 hour timer and calling
alert(), that alert is then not noticed for 30 minutes, the 5 hour medicine will be delayed by that 30 minutes if a 1 hour timer is simply slated to run after the call toalert(). Thus, storing the runTime ofalert()inerrorand subtracting it from the delay of the next timer ensures that the 5 hour medicine is indeed taken at the 5 hour mark.The Timer library eliminates this problem and offers increased simplicity, possibly at the price of increased memory usage.
The Lightning Stalker
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.