Step 1 is to get your Funhouse set up in the Adafruit IO WipperSnapper page. Follow the instructions in the previously mentioned Quickstart guide to do this.
In addition to the built-in LED that we set up from the Quickstart guide, we'll also want to get the PIR motion sensor set up within WipperSnapper.
- Name the sensor
- Select "PIR Sensor" for the PIR Sensor pin
- choose the "On Change" option for the return interval. This means that the sensor will ping out data only when it is triggered (aka when Cujo the turtle moves)
- Your WipperSnapper page should now look something like this (click on image to enlarge)
- Ignore the "triggers" and "dashboard" for now, we'll create those next!
Create a Feed for the PIR sensor
Now that the FunHouse is connected to WipperSnapper and the PIR sensor and LED are set up, it's time to create a feed. Why? The sensor data needs a home. When the sensor is tripped, we want to send a message to this new feed documenting that movement was detected at a given time.
- In the top pane, click "Feeds"
- Then click "view all"
- Create a new feed group and call it "WipperSnapper" or whatever you'd like
Set up the Actions
Now that we have a home for our data, we need to point the data to that home when certain events happen. Now it's time to define those events with actions. Here are the actions we'll create:
- Send a message "Turtle moved!" to the motion sensor feed each time the sensor has been activated.
- Send a message "Turtle is still" to the motion sensor feed when there is no longer any movement.
- Set the LED to ON when the sensor is triggered
- Set the LED to OFF when the sensor is not triggered.
Note: Triggers were renamed to Actions.
- In the top pane, click "Actions"
- Then click "view all"
- Click "New Action" in the top left of the page
- Choose "Reactive Action"
First up we want to send a message "Turtle moved!" to the motion sensor feed each time the sensor has been activated.
- If
motion sensor
isgreater than
Comparison Value
0
- Then
publish a message to
Motion sensor activated?
feed withTurtle moved!
- Hit save
Create another reactive action for when the turtle is still:
- If
motion sensor
isless than
Comparison Value
1
- Then
publish a message to
Motion sensor activated?
feed withTurtle is still.
- Hit save
Create two more reactive triggers for the LED:
- New action: If
motion sensor
isgreater than
Comparison Value
0
- Then
publish a message to
built in led
feed with1
- Hit save
- New action: If
motion sensor
isless than
Comparison Value
1
- Then
publish a message to
built in led
feed with0
- Hit save
Why create LED actions?
This lets us know if the motion sensor is properly working when in the calibration step which is coming up soon.
Next up we'll set up the dashboard so we can get some visual feedback on the data.
Text editor powered by tinymce.