As part of our series on Easy IoT, we’re creating simple but effective solutions with Gravio that enable non-technical teams to create simple experiences for their office, retail or other work environments. And this article is special because it can be done using the Free edition of Gravio!
Here we’re using Gravio's free people counting feature to see how busy your office or retail space waiting room gets over time, and even let you know when it’s getting too busy!
This solution helps answer and solve questions like:
How you use this information may also vary e.g. with Offices you may mostly be interested in the early to mid-morning rush, whereas for waiting areas it’s more about spacing out appointments throughout the day.
The above helps you gain insights into your environment in ways that you couldn’t before, and more easily than with other solutions that require technical skills, as well as the time to build a solution and keep it working.
Reminder: for your Gravio environment to work throughout the day for the period you're interested in, your computer will need to stay switched on so that Gravio can capture and process all the data from the camera(s).
Note: we use macOS for this article, but you should be able to follow along with Windows too.
Whether using a USB (or built-in) or Network (ONVIF) cameras, Gravio Studio will show the camera options just the same. Just make sure they're either plugged into your computer or are set up and accessible from the same network.
1. Open Gravio Studio and select your local HubKit environment
2. Go to the Device tab, then click the Device List button
3. In the Device List modal, in the left-hand column Camera section, you should see your camera(s), like a USB or ONVIF camera. Select the Camera you want to use, and update the settings as below:
If you want to see the Images captured along with frames around the faces, tick Save Image and Draw Detected Area Frame.
Click Settings > Image Inference Model in the left-hand menu > Click Deploy for NumberOfPeopleTensorFlow
Note: This will take a moment to download the model, depending on your internet speed.
1. Create an Area, named after your environment, like Smart Shop / Store, Office, Waiting Room, we’ll use Smart Store.
2. The dialog should then ask you to create a Layer, call it People Counter, then scroll to the bottom of the list and select 'NumberOfPeopleTensorFlow' and click Add
3. Select your new Smart Store layer on the right-hand side, click (+) button and select your Camera and click Bind, click Close.
4. Then click On in the list Device list next to your People Counter layer - this starts the capture interval for the camera.
1. Open the Actions panel, and create a new Action called PeopleCountCSV
2. Click Add Step, select a File Write step, and enter the following info:
3. Add a Sensor Data DB step, and enter the following info:
4. Add a File Write step, and enter the following info:
Tip: If you want to test an Action, simply click the Play button in the top right
Then depending on your computer's operating system the file is in the following location: Windows: C:\ProgramData\HubKit\action\actmgr\data\ or macOS: /Library/Application Support/HubKit/action/scripts/actmgr/data/
5. Add an Exec step, and enter the following:
6. Once you're done you can close the Action (it will save automatically).
The idea with a Trigger is to make an Action happen under certain circumstances e.g. an event happening, like a Button being pushed, or in our case, at a certain time of day we want a snapshot of our data over a period: Today’s hourly People Counts, taken at the end of the working day, so that we can analyse that information separately or against other days.
Then enter the following details into the Trigger:
Note: your HubKit has to be on at the times this Trigger is run, so don’t forget to leave your computer on for the hours you’re interested in!
Your setup is now complete and should start capturing the number of people in your space every hour, and then on a daily basis you will have a file created for the day with those stats.
(As mentioned above, you can always run an action independently to create those files to start analysis sooner!)
We're using Google Sheets to analyse the data here: https://sheets.google.com/
1. Create a new / Blank sheet
2. Click File > Import
3. Click the Upload tab, then Select a file from your device
4. Look for and select the day's .csv file you're interested in analysing (according to your computer's operating system):
macOS: /Library/Application Support/HubKit/action/scripts/actmgr/data/
5. In the modal the comes up, Click Import data
6. Create a new column in the new sheet next to the Timestamp column, and in the first row insert Hour of Day text as a heading
Under the Hour of Day insert the following function =TEXT(A2, "hAM/PM") (we'll use it to label our charts later).
7. This should then show an hour (depending on your data) formatted like the below:
8. Select the bottom right corner of the cell and drag that down to create the Hours of Day for each of your rows, it should look something like the following:
9. Then select one of the Hour of Day cells, and click Insert > Chart
Google Sheets should then do some auto-magic and create the following:
If Google didn't automatically create the chart for you, you can do the following:
You should now have a chart that shows how busy your space is during the different hours of the day.
As a next goal, you could import data for additional days and compare those to see more patterns, like the following:
And another example for comparing data over time to identify patterns for the same day over multiple weeks:
In many environments there’s a lot of data that doesn't get captured and therefore can't be analysed, which in turn can help gain understanding and learnings from our environments so that we can enhance them and more.
Starting to capture information about your environment will help reveal insights that you didn't know were a thing, or didn't know you needed, and wouldn't have been able to capture otherwise. Once you start exploring your environment with IoT, you can discover more and more.