DEV Community

Pavan Kumar
Pavan Kumar

Posted on

Final project 🥳

My Final Project

As part of my bachelor's degree project, we spend the final semester working on a project. We were a team of 3. We worked on developing an analytics platform specifically targeted at in-store shopping, by using wifi-enabled devices (Probe requests) and also by using cameras placed at the stores. We first pushed ourselves to get a POC and then got feedback on the same and got an MVP out before the final review.

Demo Link

Our app is live but data on it depends on whether the hardware is set up at the facility or not. (Also we'd be experimenting on the same!)
Shop Analytics

Link to Code

GitHub logo itspa1 / shop-analytics-pi

Raspberry-pi script to capture in-store people data and send them to a server

Shop-Analytics-Pi

This can run multiple types of collection of people data

  • By MAC address identification i.e Capturing probe-requests nearby
  • By Camera using people detection

How Each of them works

  • Capturing probe-requests
    • This is done by either putting the wifi-card of the device on monitor mode and running a tcpdump with appropriate flags.
    • If the native wifi-card does not support monitor-mode, you could plug an esp8266 microcontroller to run as a wifi-sniffer.
  • People Detection
    • Several models can be run using the tf module present in this, you just need to swap out the appropriate tensorflow models by downloading from their Github repo.
    • YOLO is also supported to run on this by using the native CV2 library.

Steps to Run this on a raspberry pi

  • Ensure the pi's wifi card supports monitor mode (if using Native Sniffer module)

  • Clone this repo onto the raspberry pi

  • add gitignored files

    • env.json
    {
    "main": {
    …

GitHub logo itspa1 / shop-analytics-backend

The backend service to store the captured probes from the pi.

Pi Sniffer Backend

The Backend server code to store all the frames coming from the raspberry pi and also enable api's interaction for the same.

Steps to run this backend
  • clone this repo

  • ensure node.js is installed (used version: lts(12.14.0))

  • run npm install

  • add main.js in config directory

  •   module.exports = {
          clientUrl: "frontend service",
          port: 3000,
          mqttUsername: "mqtt service username",
          mqttPassword: "mqtt service password ",
          mqttHost: "mqtt service host",
          mqttPort: mqtt service port,
          mqttTopics: ["frame_topic","cache_frame_topic"]
      };
    
  • add config.js in config directory

  •   module.exports = {
      development: {
        username: "someUser",
        password: "somePassword",
        database: "someDatabase",
        host: "someHose",
        dialect: "postgres",
        logging: false,
        pool: {
          max: 5,
          idle: 10000,
        },
      }
    };
    
  • run node index.js





GitHub logo itspa1 / shop-analytics-frontend

The Frontend service to display the captured probes from the pi.

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool…

How I built it (what's the stack? did I run into issues or discover something new along the way?)

  • We used Python to write scripts for the Raspberry-pi.
  • We enabled a connection between the devices via the MQTT Protocol which enables a lightweight data transfer between IoT devices.
  • We used Tensorflow and also YOLO to enable the people detection which has several models which have the capability to run on embedded devices with low computing power. (I personally like YOLO!😅)
  • We chose to use Node.Js for the backend because of the asynchronous, event-based actions that it enables us to work with.
  • We used react for the frontend (cause why not!🚀)
  • Also, we used ZMQ for low-latency streaming of frames between the hardware and the backend server.
  • Finally, we also used Grafana for the analytics part of it, where it was capable of querying and displaying graphs, and mostly because it has a lot of functionality as such.

Additional Thoughts

We're actually proud of the work that we've done till now. There is also a lot more than can be done on the project(De-anonymization of MAC address). Also, we're shocked by the fact that we collected almost close to 20 Million Probe request packets in the span of 4 months. (Also, a lot of data to deal with TBH!😂).

Top comments (0)