Main Content

Vehicle Detection With D1 Mini and Magnetometer

Detect vehicles using QMC5883L and actuate swinging gate using relay to allow exit

My folks have a swinging gate at the entrance of their driveway with a keypad on the outside. Guests can come easily, but due to an auto close but it is an unfortunately manual process to let them exit either by push button on the inside of the gate controller box itself or a garage remote with frustratingly limited range. They were interested in a vehicle detection induction loop but after finding consumer offerings for no less than $150+ USD, I knew I could do it for cheaper and have it be smarter. I originally considered an ultrasonic sensor to detect vehicle presence but decided not to in order to have have a cleaner and hopefully more accurate detection. After some basic research I came up mostly empty handed but stumbled on a forum suggesting the use of a QMC5883L magnetometer. $7 and a manual build of ESPHome later I had a working prototype!!”

Link to article