For this project I needed to automate a part of my daily life. Initially, I wanted my phone to keep track of whether or not my wallet was in a designated spot by using a metal touch sensor. However, I shifted my idea to be more active, in that it would do more than display "wallet here" or "wallet not here."
To make my project fit the theme of automation in my daily life, I made it a tracker, which would text my mom that I was out of the house if my wallet was not in it's spot for more than 10 minutes.
BreakdownThis circuit uses two bread boards, a photo resistor, a 330 ohm resistor, a laser emitter and particle argon. Connect the wires as depicted, and then test to see if your values are correct with a serial monitor like tera term and the print lines in the code. Proper analog values should be about 0 when the photoresistor is covered, and hover in the double digits when a light is shined on it. Specific values will change depending on how bright your environment is, because the photoresistor responds to all light, not just the light from the laser.
In the code, you can set a custom length of time for your wallet to be missing before your text is sent. For more instruction on this refer below to the timing tracking section.
In the code there is also a line that publishes an event "Alert."
This is triggered so that it can be received in IFTTT and send the text once the wallet has been missing for the designated time.
Once you have your wiring, code, and IFTTT setup, you can begin the construction of a dock to slide your wallet in. To start with, I cut out some cardboard from an amazon box and cut a made with a pen to put my photoresistor through, I also made an additional slit on the bottom for a better fit.
Next you'll need something to prop up your breadboard with the photoresistor. I took an old block of foam my brother had discarded from another project, and cut out a spot for my breadboard to slide into.
Next, I slid my breadboard in, taped the photo resistor in place, rearranged my wires and photoresistor spots so they aligned with the laser, and added additional cardboard + a rubber band for extra wallet stability and so that the wallet wouldn't lean on the photoresistor and reposition it.
My code keeps track of how long the wallet is missing by tracking the delays used in the loop section of the code.
At the top of my code I define the following variables
int delayTime= 200;
int minuteMarker=0.5; //put how many minutes you want to pass before the alert gets sent here
//I want mine to go off after 30 seconds, so I put 0.5, or half of one minute
int timer= (minuteMarker*60000)/delayTime;
bool missingAlert = false;
int missingTime = 0;
delayTime describes the delay between each loop of my code. This can remain unchanged but its important to the calculations so I define it here incase someone would want to change it.
minuteMarker is the amount of minutes the user wants to pass while the wa;;et is missing before a text message is sent. I have mine set to.5 for half a minute, or 30 seconds.
missingTime is a variable that gets 1 added to itself each time the code loops and is set to 0 when the wallet is present.
timer is a variable that checks when the alotted time has passed by multiplying minuteMarker by 60000 (the amount of milliseconds in a minute), and then dividing it by how frequently the code is looped. When timer=missingTime, the alert is published and the particle code is sent.
Design Changes Over TimeAt first my initial plan was to tape a strip of aluminum foil on my wallet, and use a metal touch sensor to tell whether or not it was in it's spot, however the touch sensor ended up being not consistent and responsive enough for what I need. I would have to touch it at a certain angle or for longer to get a response, so instead, I then made the decision to use a laser tripwire type of setup as some of my peers have done before.
My initial idea for a tripwire was to make a box, but while working on the project I had the idea to make a vertical dock, kind of like a nintendo switch. this was more convenient for me and allowed open observation of all parts of the project.
Comments