In this example we will connect the Grove PIR (passive infrared) Sensor to your Arduino to detect movement. When movement is detected, a LED will light up and an email is sent out to notify you.
This example is part of the arduino-sdk and can be found in the examples folder. If you already ran the basic example on the previous page, you have everything installed to get started right away!
In your Arduino IDE under File > Examples > ATT_IOT open the
motion-sensor example sketch
Simply hit the upload icon in the Arduino IDE. This will save the sketch, compile it and upload it to your Arduino.
If all went well, a PIR asset and LED asset are created under your device in AllThingsTalk Maker. Wave your hand in front of the pir sensor and see if the value changes.
Alternatively, you can also open the Tools > Serial monitor of the Arduino IDE. This can be very useful when debugging your own sketches.
- Make sure you select the correct COM port to listen (under Tools > Port )
- When the monitor is open, make sure the Baud rate is set to 9600
We will create two automation rules.
Please check the Smart doorbell example for a similar notification rule.
Upon running the example, all needed assets are created. We can now use those to create a pinboard to visualise them.
If you chose a (historical) chart, make sure you have Data Storage turned on!