Overview
It’s hard to tell when a room on another floor, or across the building is occupied or vacant. At Adafruit we have a popular meeting room however sometimes it’s being used and if you want to have a meeting, you have to wait or go somewhere else. How handy would it be if we had a public dashboard to view if the room is occupied? Using an Adafruit FunHouse board, a infrared PIR sensor, and AdafruitIO WipperSnapper, we can make it happen.
Additionally, in the bonus section, you can install a status light to add a layer of visibility to the room’s occupancy status.
Prerequisite Guide:
WipperSnapper is an interface for Adafruit IO, Adafruit's incredibly easy-to-use IoT platform, designed to turn any WiFi-capable board into an IoT device without programming a single line of code.
If you've never used WipperSnapper, click below to read through the Quickstart WipperSnapper guide before continuing.
Other materials needed:
- A piece of cardboard sized 2" x 7" or larger. The thicker cardboard the better. This will be used to mount the PIR sensor.
- A box cutter
- A pen or pencil
- A mat to cut cardboard on
- Single-sided scotch tape or similar
- Double-sided tape OR thumb tacks
Parts for the status light (optional):
For the lighting connections to the Stemma relay, you can choose:
Which will require:
OR keep things simple with:
Page last edited March 08, 2024
Text editor powered by tinymce.
Add the PIR Sensor
The Passive infrared (PIR) sensor recommended in this guide detects movement from up to 20 ft. away. It's beefier than the smaller PIR sensor usually suggested for use with the FunHouse. This sensor comes with a 1-foot cable to connect to the FunHouse. The FunHouse has a built-in port for a PIR sensor but you will not use that due to the fact that this PIR sensor needs at least 5V to operate and the PIR sensor input on the FunHouse only provide 3.3V. Do not fear, however, because a Stemma cable can be used to connect to one of the Stemma ports on the FunHouse which gives the sensor the 5V it requires to function.
Wago Connectors
The PIR sensor cable ends have a smaller than ideal wire gauge (thickness) and will not be able to plug directly into the Stemma cable. These handy Wago wire snap block connectors can be used to connect the PIR wires to the FunHouse Stemma port. These handy little blocks make it easy to connect two wires of different gauge thicknesses without any soldering.
- Plug the white cable connector onto the PIR sensor.
- The orientation should be such that the red cable goes on the 5V+ side and the black cable lines up with the GND side.
- Start with the black GND cable from the sensor.
- Take a Wago block and pull up on one of the orange levers to open the connection.
- Insert the exposed wire end of the black GND cable.
- Close the lever of the Wago block to lock in the wire.
- Make sure the wire itself is latched onto and not the wire outer wrap by turning the block over.
- Repeat this with another lever of the block using a black jumper cable
- Repeat the above steps with the Power and Data wires.
- Connect the jumper cables into the Stemma connector cable.
- Plug the Stemma Connector cable into the FunHouse A1 stemma port
Altogether it should look like this!
Page last edited March 08, 2024
Text editor powered by tinymce.
Set Up the FunHouse
The next step is to get your Funhouse set up in the Adafruit IO WipperSnapper page. Follow the instructions in the Quickstart guide to do this.
- Name the sensor
- Choose A1 from the drop-down list.
- choose the "On Change" option for the return interval. This means that the sensor will ping out data only when it is triggered.
- Do not use the PIR sensor option as this does not work for the sensor used in this guide (which requires 5V).
Test the PIR Sensor
Next, test out the PIR sensor to verify it's working properly.
- Move your hand in front of the sensor.
- Check the WipperSnapper device page to see if the value changes from open (no movement detected) to closed (movement detected) for your sensor.
Page last edited March 08, 2024
Text editor powered by tinymce.
Configure Dashboard
Now that you have verified that the sensor is working, it's time to create a visual dashboard that represents the room's occupancy status via the sensor's output.
Step 1: Create a New Feed
Before you create the dashboard with the icons that represent the room's occupancy, you will need to create a feed to give the dashboard. This feed will eventually contain the values icon names that will appear in the dashboard.
- In the top pane, click "Feeds"
- Then click "view all"
- Create a new feed group and call it "WipperSnapper" or whatever you'd like
Step 2: Set Up the Actions and Choose Icons
Now that there's a home for the icon values, you'll need to point those values to the Dashboard when certain events happen. You'll define those events with actions. Here are the actions to create:
- When the sensor detects motion (value is 1), send the message "close"
- When the sensor detects no motion (value is 0), send the message "circle-o"
- These will be icons used for the project.
- "circle-o" is a simple circle icon and represents a vacant room
- "close" is an "X" icon and represents an occupied room
- To see other symbols to choose head to
- In the top pane, click "Actions"
- Then click "view all"
- Click "New Action" in the top left of the page
- Choose "Reactive Action"
First, create a action for when motion is detected.
- If
movement detectedisequal toComparison Value1 - Then
publish a message tofeedRoom Occupancyfeed withclose - Hit save
Next, create a trigger for when no motion is detected.
- If
movement detectedisequal toComparison Value0 - Then
publish a message tofeedRoom Occupancyfeed withcircle-o - Hit save
Step 3: Create a Dashboard
Now that the feed and triggers are set up. You can create a dashboard to view the status of the room occupancy based via the icons in the feed.
- In the top pane, click "Dashboards"
- Next click "view all"
- Click "New Dashboard"
- Enter the title and description for the dashboard
- Click the gear icon then click the "create new block" option
- These are all the different blocks available.
- From the different blocks, click on the one entitled "Icon"
- From your WipperSnapper feeds, select "Room Occupancy" for the icon feed. This is the feed you just created.
- Name the block and hit "create block"
Test it Out
The block is created now, try moving your hand over the sensor and see if the Dashboard block responds.
Lastly, if you'd like other people in your organization or building to have access to the room's occupancy status, you can make the dashboard public.
- Click on the dashboard settings gear
- Click the "Dashboard Privacy" button to make the Dashboard public and confirm you'd like to make it public when asked.
- Click the "Share Links" button that is now available in the Dashboard settings.
- Copy either of these links and share with whomever.
Dashboard Sharing Link Options
There are two types of links to share a Dashboard for others to view.
Option 1: This is the main URL for the dashboard, anyone that has an Adafruit IO account can view and edit the Dashboard.
Option 2: Kiosk Mode. This link will only allow others to view the data from the dashboard and does not require the user to have an AdafruitIO account. For the purposes of this guide, this link is the better option of the two for sharing with those who will want access to the room occupancy status.
Page last edited March 08, 2024
Text editor powered by tinymce.
Mount and Calibrate the Sensor
You can use a piece of cardboard from any old box to mount the sensor. Check out the below guide for some great tips on cutting cardboard and more.
- Cut out a piece of cardboard to be roughly a 2" x 7" (5cm x 18cm) rectangle.
- On the right side of the rectangle, using a ruler, draw a square to be sized exactly 7/8" x 7/8" (22mm x 22mm).
- Take the PIR sensor and pop it into the cardboard hole you just cut out.
- The sensor should be as close to flush as possible with the PCB of the sensor.
- Fold the cardboard in half along the midpoint.
- Add some tape to the back of the sensor to secure it in place.
- Place a few pieces of double-sided tape on the back of the cardboard on the other side of the sensor.
- If you don't have double-sided tape you can also use thumb tacks
- Pick a spot in a corner of the room you are monitoring and mount the sensor with double-sided tape or with thumbtacks.
- Use the fold in the cardboard to angle the sensor such that it is facing at about a 45-degree angle inward towards the room.
- Make sure the sensor is placed about 3 - 4 feet above the ground and not obstructed in any major way.
- Find a good spot close to a power outlet and the mounted sensor to place the FunHouse
- Power up the FunHouse using the USB-C cable and the 5V power adapter.
- Plug the sensor in, making sure the red wire from the JST cable goes to the 5V side of the sensor.
That's it! You're ready to track the room's occupancy status! Give the sensor a minute or two to acclimate and calibrate before trusting its accuracy. You can adjust the sensitivity and the length of time the sensor is triggered by adjusting the potentiometers on the back of the sensor with a Philips head screwdriver.
Page last edited March 08, 2024
Text editor powered by tinymce.
BONUS: Status Light
Follow this bonus section to add a status light to your project. The purpose of the light is to see visually if the room is occupied without needing to check online on the dashboard page.
- First, cut two pieces of the solid core wire, preferably red-colored roughly 6" long.*
- Next use some wire strippers to strip away the ends of the wire wrap to expose the wire.
*You can swap out the solid core wire for male to male jumper cables if you wish.
- Take the two wires and gently push them into the COM and NO ports of the stemma relay controller.
- Next, connect one end of the stemma cable to the stemma connector end of the relay.
- Connect both red alligator clips from the DC barrel plug and jack cables to the red wires from the relay.
- Then, plug the light into the barrel plug and the 9V power source into the barrel jack.
- Lastly, plug the other end of the stemma cable in the A2 port of the FunHouse. Make sure to keep the PIR sensor plugged into A1 (not shown)
Here are all the parts connected.
For more info on the Stemma relay and how it works, peep the below guide.
- Navigate back to the WipperSnapper page for your FunHouse.
- Click "create component".
- Select "Relay".
- Name the component and select A2 as the pin.
Creating the following triggers will turn the light on when movement is detected from the PIR sensor.
- Create two new reactive triggers from the triggers page.
- Trigger one: If Movement detected is equal to 0 publish a message to Occupancy Light Status to be 0
- Trigger two: If Movement detected is equal to 1 publish a message to Occupancy Light Status to be 1
Test and Mount
Test out the light and relay. Plug in the 9V power for the relay. Make sure the PIR sensor is still connected to A1 of the FunHouse. Wave your hand in front of the sensor and verify that the light turns on when movement is sensed.
Once it's working properly, pick a spot for the light. This light has special mounting screws. You may want to have the light outside of the room or at least facing away from the room so it does not distract those inside of the room.
If you made it this far, congrats. You have built the project in its entirety including the bonus section! Take some pride in knowing if your desired room is occupied without leaving your seat :D
Page last edited March 08, 2024
Text editor powered by tinymce.