ESP-NOW for motion and magnetic switch sensors

I’m part of a research team that is testing the effectiveness of HEPA filters for removing air pollution in classrooms. For the project, we are testing a HEPA filter in a single school classroom, and planning to measure air pollution in the room while also measuring factors that may affect the effectiveness of the HEPA filter, specifically whether there are children in the room and whether doors and windows are open or closed. This project will take place over several months and is designed to allow the classroom to be used as normal and to be as un-intrusive as possible.

To measure when people are in the room and when doors and windows are opened, we were looking into setting up PIR motion sensors and magnetic switch sensors. These sensors would be continuously operating and ideally be connected to wifi so that we were automatically receiving data on motion and the windows and doors in the room. We would likely need about 5 magnetic switch sensors, and 3 motion sensors.

We weren’t sure whether an arduino-style set up was best, or whether we should purchase a more expensive pre-built commercial system for the motion and magnetic switch sensors. We are also aware that wifi could be an issue, as school wifi networks have considerable levels of security which have made connecting to wifi difficult for us in previous projects. We have gotten around this previously by using an old samsung tablet which can connect to the school wifi, and setting up mobile tethering so that the wifi devices can connect to the internet.

One suggestion was to use an ESP-NOW to automatically gather the data from several low-cost motion sensors and magnetic switch sensors attached to ESP32s. Given the settings of the project, could this set-up be best for automatically gathering data remotely and if so, how could we set them up?


Hi Nathan,

I’d take a look at my ESP-NOW project here: 12 day project: ESP32 - LED controller

Since a PIR and magnetic switch sensors are digital handling all of the inputs should be pretty straightforward.

In my setups they were around a relatively small house and were all able to connect to the same ‘gateway’ which printed out the information, this could easily be extended to be stored on a microSD card.
I definitely reckon micropython is the way to go if its a simple project(instructions included in the project above).

1 Like