This project depicts how to wire a simple PIR sensor to the Particle Photon. Once the PIR sensor detects motion, it will report the event to thingspeak.com.
Instructions:Gather your parts and create an account on Thingspeak. Create a new channel on thingspeak.com and make the name for your channel "motion" and the Field 1 value "field1
". Enter metadata and tags, and check the box that says show status. Go to the "my channels
" tab, and select "private
". Copy your "Write API Key."
Go to your Particle Console, and create a new Integration. Select "Webhook," set the event name to "motion
", the URL to "https://api.thingspeak.com/update", and select your Photo under the "devices
" drop down menu. Click "advanced settings
" and select "form
". In the first box, create a parameter "api_key
" and paste the Write API Key that you generated from thingspeak.com into the value box. Add a new row and create a parameter "field1
" and set the value to "{{PARTICLE_EVENT_VALUE}}
". Once you are done, click "Create Webhook
".
Wire your device using the provided schematic, and load the sketch to your Photon using the Atom IDE from the Particle website. To verify that your device is working, Go to "Logs
" in your Particle Console and trigger the PIR sensor. If everything is working, you should see data appear in the logs and the number of entries in Thingspeak should increment accordingly.
What to do from here? In Thingspeak, you can create an App that interacts with the data you are reporting. You can tweet, update your custom App that leverages their API, etc. Now you have a real-time application!
Final Product:
Comments