Vehicle detection with D1 Mini and magnetometer for gate actuation

You’re very welcome, I’m glad you enjoyed it. The voltage divider is necessary because the D1 mini’s A0 (analog read) max voltage input is 3.2V. The 12V from the battery would fry (or do something bad) to the D1 mini, thus is is necessary to divide this voltage down to a more acceptable level. I hope that explanation helps!

1 Like

Hello, It’s been a long time. Is it still working ?
That’s a great idea and I’m about to reproduce it :slight_smile:

I built a system inspired by yours.
I have an ESP8266pro (with antenna) hidden in my gate motor control.
Then I use 2 sensors:

  • QMC5883L
  • MMC5603
    Why 2 different sensors? simply because each model come with its own I2C address that you can not change, so to have 2 sensors on the same bus, I needed different models but they are basicaly the same.
    Then thoses sensors are on the side of my car road to the gate so I can identify the direction.
    It’s working fine I just have an issue with the cable lenght. I’ll try to reduce it a bit. It’s working with one sensor and 10m, but become unstable with 2 sensors.

Also I wonder if I should add a pullup resistor in the I2C bus even if the ESP activate its internal 10k resistors on I2C bus. I read that I should put a 4.7K resistor to 5V on the sda and scl lines.
→ Do you think that could help ??