Help on a project I'm working on
Sagid
Posts: 1
Hi,
I'm in need of a bit of help on a project that I'm working on and was wondering if anyone here can help. I'm trying to make a pill reminder. You know, something connected to a 7-day pill box and an alarm system that would sound and flash LEDs [noparse][[/noparse]possibly display a message on an LCD too] if the corresponding day's box is not opened on time. I'm using a parallax BS2p24 chip and all of the other parts that I'm using came from parallax as well. I've already written the code for the speaker and LEDs [noparse][[/noparse]I've determined the frequencies and "pause" times]. Currently I'm trying to get the timer portion set up. I'm using a DS1302 chip and I found some threads about it, but I was wondering if anyone knows if I am able to use the chip as an input for the controller. My idea overall is to have switches attached to each day's box and have the clock running so that for example, if the person was supposed to take the pill at 10:30am each day, then when 10:30 comes around on Sunday and the box isn't opened [noparse][[/noparse]switch would still be closed] then a "warning" alarm would sound but if the box was opened correctly [noparse][[/noparse]switch opened] then a "good job" alarm would sound. So you see, I need the clock to be an input for the controller so that the it would "know" what time it is and appropriately signal the alarm.
Please, any help that you can provide would be greatly appreciated.
I'm in need of a bit of help on a project that I'm working on and was wondering if anyone here can help. I'm trying to make a pill reminder. You know, something connected to a 7-day pill box and an alarm system that would sound and flash LEDs [noparse][[/noparse]possibly display a message on an LCD too] if the corresponding day's box is not opened on time. I'm using a parallax BS2p24 chip and all of the other parts that I'm using came from parallax as well. I've already written the code for the speaker and LEDs [noparse][[/noparse]I've determined the frequencies and "pause" times]. Currently I'm trying to get the timer portion set up. I'm using a DS1302 chip and I found some threads about it, but I was wondering if anyone knows if I am able to use the chip as an input for the controller. My idea overall is to have switches attached to each day's box and have the clock running so that for example, if the person was supposed to take the pill at 10:30am each day, then when 10:30 comes around on Sunday and the box isn't opened [noparse][[/noparse]switch would still be closed] then a "warning" alarm would sound but if the box was opened correctly [noparse][[/noparse]switch opened] then a "good job" alarm would sound. So you see, I need the clock to be an input for the controller so that the it would "know" what time it is and appropriately signal the alarm.
Please, any help that you can provide would be greatly appreciated.
Comments
Rick
The ds1302 is a pretty good time keeper and Chris Savage has a demo program which will exercise every aspect of the chip. I think the demo program is on the Resources section of the Parallax site.
One technique for a job such as yours is to just count minutes, starting at, say, Sunday at 12:01 AM. Seven days of minutes is 10080 minutes, so is an easy number to work with in a Word variable.
As time passes, you know that 10:30 each day will occur at 630 minutes on Sunday, 2070 minutes on Mon, 3510 minutes on Weds, etc, etc. Reset to zero on Saturday at 12 midnight and repeat.
You could also use the clock's ability to tell the day of the week and just watch for the appropriate time to roll around.
Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
The logic for checking if the pill has been taken isn't too rough. It might look something like this in pseudo-code:
If you get that, then you could extend it a bit by setting custom times for each day, or lighting an LED that corresponds to the correct day's pill compartment:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php