Smart Door Foot Traffic Analyzer Tutorial



This tutorial uses the Renesas S3A7 board with the Renesas IoT Sandbox to measure and analyze foot traffic through a door.

In this Smart Door Foot Traffic Analyzer Tutorial, you will:

  • Measure door vibration with sensor
  • Send vibration data to Medium One
  • Use Medium One workflows to analyze vibration data

Here’s what you need to get started:

  • Renesas S3A7 Fast Prototyping Kit
  • WiFi Internet Access

Estimated Time to Complete: 30 mins for setup, + however long you want to do testing!

Smart Chef Demo

EDIT: Added a short video to show the full setup installed on a door and uploading data to the Renesas IoT Sandbox


Click here to activate the kit.
Since you already have a Renesas IoT Sandbox account from the Smart Chef Demo, a new project will be added to your account for this demo.

Once activation is completed, you will receive an email with your account credentials needed to provision the kit and access the cloud portal.


Power up the board and touch the screen within 10 seconds of powering up the board to boot it up in provisioning mode. The board will become a WiFi Access Point.

Connect to the board from a computer via the WiFi network printed at the top of the screen.
Once connected, click on the link at the bottom of the activation email you received in step one. This autofills the following form with the configuration details specific to your project.

Alternatively, you can open the provisioning page served by the board by going to on your browser and manually enter the information yourself.

On the provisioning page, enter your WiFi information. You will need to specify the router’s WiFi authentication mode. If you’re not sure, most Wifi routers use WPA2, so try that first.

After entering the information, click Connect. You will see an error message on your browser, but this is ok! You will see a “Provisioning Complete” screen on the board.

Log into your Renesas Sandbox Account and power down the board.


The only sensor you need is the BOSCH BMC150 module, pictured below.


Now it’s time to get creative and figure out how to get your board on the door. My setup was inspired by Craig’s fish tank project. I mounted the board to a piece of cardboard, using thumbtacks to keep the board on the cardboard. I then attached the cardboard to the door using the thumbtacks as well as some heavy duty double-sided tape.

I also attached the battery to the door using the double-sided tape.

Unfortunately, I don’t have a way to keep my battery charged and have this run continuously, but ideally you would be able to give the board a constant power supply for the best data.


Many of the Smart Chef workflows are not needed for this project.
In your Renesas Sandbox Account, in the Workflow Studio (left sidebar), deactivate all of the workflows except:

  • Set Vibration Aggregate Window
  • Process Sensor Rules
  • Vibration Processing
  • Detect Vibration Impact


Open the Set Vibration Aggregate Window workflow, double click on the “Base Python” module, and set aggregation_window to a smaller number, for testing. I set mine to 10000, so that I get vibration data every 10 seconds.

Click “Save and Activate”.

Power up your board and go to the Dashboard. In the Real Time Events Log, you’ll see vibration information appear.


Now it’s the fun part where you get to mess around with your door. Do some tests to see how the vibration and location (x_max, x_min, etc) variables change when you open the door.
In order to do this, just power up your board and watch the Real Time Events Log on the Dashboard while opening the door occasionally.
For example, this is the information for my door when it’s resting:

Of course, these numbers will fluctuate even when the door is in rest, but the values were all similar to these.

If the door is opened or closed, my x_min and/or z_min become negative, and my vibration is at least in the tenths place.


Now we need to decide how often we should really get vibration data.
Follow Step 6 again, but set aggregation_window to a higher number. I set mine to 60000 so that I get data every 60 seconds, but depending on your expected traffic, you might want your value higher or lower.


Open the Vibration Processing workflow, double click on the “Base Python” module, and replace the code with the following:

import math

def get_input(name, default=0):
    return IONode.get_input(name)['event_data']['value'] or default

x_min = get_input('in1')
x_max = get_input('in2')
y_min = get_input('in3')
y_max = get_input('in4')
z_min = get_input('in5')
z_max = get_input('in6')

vibration = math.sqrt((x_max - x_min)**2 + (y_max - y_min)**2 + (z_max - z_min)**2)

if vibration >= 0.1 and (x_min < 0 or z_min < 0): # CHANGE THIS LINE IF NEEDED
    IONode.set_output('out1', {"open": 1})
    IONode.set_output('out1', {"open": 0})

Click “Save and Activate”.

The line that says # CHANGE THIS LINE IF NEEDED should be modified according to your tests.
Since my door is opened/closed when the vibration is at least 0.1 and either x_min or z_min are negative, this is what I am testing for.
I’m assuming that there won’t be an instance where someone opens the door in one of the 60 second blocks and doesn’t close it until the next 60 second block. However, if this happens, there will just be a false opening recorded, which isn’t too problematic.


Now you just power up the board and let it track some data!
If it’s working, you should see something similar to the picture below in your Real Time Events Log after the time interval you specified in step 8!


Scroll down to the bottom of the Dashboard and select the “Single User Line Chart” widget.

Click “Select user” and choose “device”, click the date range and choose “Today”, and click “Select Tag”, start typing “open”, and choose “processed: open”.

Now you’ll see the door activity for the day. You can play with the date range to see door activity over a few days, over the week, etc.

Every time the value is 1, the door was open within that minute. When the value is 0, the door was closed. You’ll notice that I also have some 0.5 values. This is from when I was playing around with the vibration aggregate window and sent data multiple times during a minute. If the door was opened for one of the measurements but not open for the other, then the average value for “open” was 0.5.

The parts where you can see an actual slope are from my battery dying, meaning no data was sent for a while :slight_smile:

Congrats, you made it through the tutorial! I hope you had as much fun with this as I did.

Learn IoT MeetUp - Apr 19 in San Jose
SK-S3A7 Tutorials

This is great. Thanks for putting this together. I learned quite a bit from reading your tutorial. I liked that you deactivated the unused workflows. It really helps me to focus on the bare-minimum workflows needed. I’m glad you carved out four.

Also, I had not used the “Single User Line Chart” before. I’ll give it a try.

In this section, did you have any problems with false-positives?

if vibration >= 0.1 and (x_min < 0 or z_min < 0): # CHANGE THIS LINE IF NEEDED
    IONode.set_output('out1', {"open": 1})
    IONode.set_output('out1', {"open": 0})

I’m just wondering if the threshold was effective at filtering out door knocks. I’m also not sure what is happening, due to my lack of familiarity with the Sandbox. Why do you need to also check for x_min or y_min as negative? Is this to detect the swing of the door in only one direction (which it opens inward toward the room)?

I want to improve my fishtank. Right now, I’m only looking for a 1.5G impact detection, but your method seems like it would be more effective.

I’m also highly interested in getting a working notification by email or mobile under these conditions:

  • door was NOT opened at least once a day during a time period
  • door was NOT opened for three consecutive days
  • door was opened more than X number of times in one day

In my case, I want these alerts because I can use it to gauge the fish feeding schedule:

  1. no one fed the fish today, but I’m not so worried because someone will eventually feed them
  2. people forgot to feed for three days in a row. No one is paying attention to the fish
  3. fish are getting overfed and it may lead to poor fish health

In the case of a smart door, you could use it to monitor and optimize cleaning or heating schedules


I didn’t have problems with false-positives because I was checking for vibration and position, which is why I checked for x_min and z_min, and not just vibration.
If I just looked at the vibration number, then the knocks definitely would have been confused as door openings.
And yes, my door only swings in one direction, and through my testing I found that x_min and z_min became negative when the door was opened.

Also, your notification idea sounds great! Maybe that will be my next tutorial :slight_smile:


That’s smart. I’m going to copy your technique and check for both. I was just using the Detect Vibration Impact workflow and adjusting the threshold in G-force.

What I really need is to create a log and email alerts for my fishtank when the fish are NOT fed. I hope they don’t die when my son goes off to college.

I was just thinking that your custom email report could simulate a scenario. For example, the logic could recommend increased room cleaning or decreased room cleaning based on foot traffic. here’s a concept. I’m thinking that the report has a line graph below the table and possibly an area to recommend time of day to clean (when the foot traffic is lower)

Just one idea for commerical usage of the Smart Door Foot Traffic Analyzer


This is an awesome project!. I’m new to the embedded world. I definitely need to learn the IOT sandbox and connecting sensors. You just gave me more motivation. Thanks!!

Robinson Paniagua


Kaylee is a full-time student like you are. She’s written three tutorials. Her other two are:

Are three of her tutorials focus on learning the IoT Sandbox.


Thanks so much Robinson!! I hope you have fun learning this stuff, you should definitely check out the other tutorials of mine that Craig shared if you want to learn more :slight_smile: