How to control DC motor connected to D1 mini with motor shield?

I’m trying to modify glade air freshener by attaching d1 mini on it.
However, it looks like I need to replace the original board (motor driver) with d1 mini
motor shield.

With esphome, how do you control this kind of motor driver? I tried the following config but it doesn’t work:

output:
 - platform: gpio
   pin: D2
   id: direction_pin
 - platform: esp8266_pwm  # or ledc if on ESP32
   pin: D3
   id: speed_pin
switch:
  - platform: template
    name: "Kitchen Glade"
    turn_on_action:
     - output.turn_on: direction_pin
     - output.set_level:
        id: speed_pin
        level: 100%
     - delay: 1000ms
     - output.turn_off: speed_pin
     - output.turn_off: direction_pin
     - output.set_level:
        id: speed_pin
        level: 100%
     - delay: 1000ms
     - output.turn_off: speed_pin

Hello,
did you find answer to your question? I have wemos motor shield as well and cannot find any useful info.
Thanks.

no, https://github.com/esphome/feature-requests/issues/567

Hi did you get this working? Ive been trying the same thing but had to use a custom code and drive it off mqtt. Not pretty but it works. Would have loved to get it integrated with tasmota or esphome. Please let me know how your getting on with it. Regards

Which glade air freshener do you have? I just got this one and slap a switchbot bot over the button and automate it to press the button if motion is on for 4 minutes. It works, however; I am trying to figure out how the stock Glade motion sensor works.

I don’t want it to sense any motion. So, I plug up the sensor hole ( right next to the button) with cotton. The Glade is out of sight in the toilet room. I have place it inside the service pipe access hole. It is dark and no motion should Glade ever detect.

So my question is, what does Glade do when you manually press the button? I think it presses again when switchbot press the button. When I enter the room after I know switchbot has press the button, I can smell a strong freshness even though it should have tapered down by now.

Update: Was searching the net for more info about this product and came across this tear-down blog. Not exactly like mine, but very similar guts. This commenter may have answer my question.

1 Like

I use this one, I have replaced the control board with motor Sheild with a custom program ( mash up of examples). Perhaps you could use a relay to break the battery circuit of the glade spray. mine fire once you put batteries in

mine fire once you put batteries in

I just tested it and mine does the same. Since I don’t need the motion sensor, I can use a rely to turn off/on power whenever I want to spray.

I am thinking of using a single relay and an esp8266 D1 mini. Though all will need to mount outside since there isn’t any room inside (have not opened it yet).