Have you ever been busy at school or at work and wanted to know when the mail arrived at your house? Or maybe the weather is bleak and you wonder in your nice warm house, "Did the Mailman come?" This mailbox notification sensor was designed for the purpose of receiving notifications from your smartphone that your mailbox has been opened, either through SMS text or Gmail. Also, due to school project requirements, the sensor publishes data to Thingspeak and Ubidots in order to show graphs/trends of the voltage of the reed switch.
SetupThe setup of the first circuit board took the shortest amount of time during the project. Using a specific door switch setup mentioned in the credits below, a circuit was constructed that would flash an LED bulb when the magnetic reed switch was separated from its magnetic field. Two 220-ohm resistors were implemented, and the D0, WKP, and GND pins were connected to the magnetic reed switch by three wires. The function of the first circuit board was to capture data from the magnetic reed switch and publish it to Thingspeak, the specific IFTTT If/then sequence, and Ubidots.
The second particle was left isolated with no outside attachments. The main function of this Photon was to subscribe to the data taken from the first Photon and then use that data to publish a Webhook to Twilio for a SMS notification.
TwilioThe ultimate goal for this IOT project is to receive an SMS notification with a phrase “Your Mail Has Arrived”. In order to do this, a Twilio account should be created, giving the user credentials and a new phone number. Data published through the webhook is imported to that Twilio phone number, and the Twilio phone number sends an SMS text to the preset smartphone phone number with the coded phrase.
ThingspeakA critical portion of the project is to graph a certain aspect of the system. The voltage travelling through the magnetic reed switch was chosen to be portrayed in Thingspeak. The coding on this took some time, but if the library widget “Thingspeak_WriteVoltage.ino” is implemented into the code, it translates smoothly into the graph. Publish Thingspeak on each if/then scenario to display various reactions that occur. The picture below displays the graph obtained from the magnetic reed switch. Every time the switch’s magnetic field is separated, the graph “carrot-tops” to its maximum voltage and then back to “0” volts.
https://thingspeak.com/channels/195557
The code used to base the mailbox notification sensor code included a format that would publish the results to Ubidots, so it was implemented along with the other applications to receive the data. Two variables were created in one specific event, and the app was pasted into the code to display the voltage of the magnetic field of the reed switch.
The IFTTT application is one of the most user-friendly apps you can use. Once you set up an account, there is an option for an “if”, in which you chose the application for the “if” event, and there is an option for a “then”, in which you chose a different application for the “then” event. The IFTTT takes both applications and syncs them together under a specific “if/then” scenario. Use the link between the “Particle” app and the “Gmail” app to send an email to your Gmail account when the Particle publishes a specific if/then situation.
This video shows a detailed format of the Particle Photon’s process:
· This video shows the real application of the device:
Comments