ESP8266 WiFi people counter project

With ESP8266 WiFi people counter project you can track and count people near a defined zone using the WiFi capabilities of the ESP8266 microcontroller. Then you can send anonymous data from the ESP8266 to your own MQTT broker, store it using influxDB server and show the information online in real-time using grafana.

The project step by step:

  • Setup and configure the ESP8266 program code located at WiFiPeopleCounter directory. You need to put your config data (WiFi SSID / WiFi Password / MQTT data) at credentials.h file.
ESP8266 configuration file
  • Upload the code to your ESP8266 device.
  • Install and configure MQTT server (communications), influxDB (data store) and grafana (data visualization) on your server.
  • Setup the Python script ( You will need to setup the MQTT and influxDB data ( file) and load the proper Python modules (using apt-get, pip, …)
Python configuration file
  • Open grafana with your browser (usually at port 3000) and configure the connection with the influxDB as datasource.
  • Create a dashboard and queries from grafana.
grafana – influxDB query
Grafana showing information from ESP8266

Script options:

debug (True / False) enables information output

log (True / False) enables creation of data csv file

mac_randomizer_mode (True / False) enables mac randomizer mode detection to (try to) avoid privacy settings of some WiFi devices*

*Recent versions of mobile operatig systems like Android 10 uses a new privacy setting to avoid tracking, randomizing the last 3 bytes of the device MAC address.

To override this, a new mac_randomizer_mode option has been added to the MQTT script. This mode marks as the same MAC address if the first 3 bytes of the MAC address appears in the last 15 minutes (you can change the threshold). It’s not a perfect solution, but the chances to get the same first 3 bytes (often related to a brand specific model series) in a short time window within a few meters distance from the detector device are very few indeed.

Check lastest updates at site