| 
View
 

WiFi Air Freshener

Page history last edited by Franc Carter 9 years, 8 months ago

 

Background

Some months ago I had temporarily run out of things to hook in to my Home Automation, so for some reason lost in the depths of time I decided to automate an Aldi Air Freshener.  While it was amusing, I was never particularly happy with the result as there was too kludges involved.

 

Now, with the magic of the ESP-01 I can make one that is much simpler and and has a clean HTTP interface.

 

Hack The Air Freshener

 

The air freshener has:-

  • A couple of batteries
  • A chip for the timing and control
  • Some LEDs for status
  • A motor and gears that do the actual work

 

The only thing I kept was the motor and gears that are used to 'press' the spray can

 

Remove the plastic face covering the electronics, motor and gears by removing the highlighted screws.

 

 

 

Undo the screws holding the motor and gears in.

 

 

At this point you have access to all the internals. I removed everything and re-soldered two wires onto the motor. Note the hot-glue as strain relief on the wires of the motor, this was one of the reasons I re-soldered, the originals tended to break.

 

 

Make sure that you colour code your wires (or have a good memory), he motor needs to wired so that it is driven in the correct direction. The red wire goes to the red side of the motor connection. There is a red marking on the motor that can just be seen under the hot-glue

 

once you have removed (or disabled) the in-built circuit, put it all back together with the two motor wires coming out the hole in the back. If you wanted to go to more effort then you could run them down the inside of the case and out the bottom through a small hole.

 

The Circuit

 

The circuit is fairly similar to the one I made for the room sensor, however I removed the pullup resistors to reduce parts count, as a result I can't use GPIO0 or GPIO2. Using the RXD line just requires being a bit more careful with the code/debug cycle, something I'm comfortable with. In hindsight, I should have put a SMD pulldown on the RXD pin to prevent an initial spray when the board powers up.

 

The eagle file can be found here

 

The  only annoying issue I came across was with the mosfet (a 2n7000), the orientation of the part in the Eagle Library seems to be incorrect which resulted in a couple of hours of debugging;-(

 

Here's the finished board when I had it setup for testing. The red pieces of paper have been glued in so that I remember which cable goes where.

 

 

Caveats

 

There are several things I've done in my circuit which I suspect are Bad(tm) but I'm out of my depth on these:-

 

  • The motor might be 3v, I'm running it at 5v
  • I suspect I should have a diode across the motor for protection
  • It's possible the mosfet is being driven over  it's current limit 

 

The Stand

 

The last part was to print a stand so that the board could go underneath the Air Freshener in a neat manner. I had originally considered putting the board on the back of the air freshener case, but was concerned that the metal spray can may kill interfere with the wireless.

 

Alibre File

STL File

 

Software

 

Thanks to the ESP Arduino Library, the software is really easy.

 

ESP-Spray

 

Note: I'm being bad and not doing a proper REST interface - I have know excuse this time other than being lazy.

 

Home Automation

 

All of this allows me to hook the Air Freshener into my Home Automation and get better some nice behaviour:-

 

  • Spray when I enter the room
  • Spray every 15 minutes, if I am in the room
  • The spray lasts longer, because  it's not wasted when I am not in the room

 

The code to do this in FHEM is a bit convoluted, but here it for interest:-

 

define Study_Spray dummy

 

define force_StudySpray notify force_StudySpray "\

    curl http://192.168.2.146/spray\

"

 

define DoStudySpray notify DoStudySpray { \

    my $now = time();; \

    my $last_spray = ReadingsVal("Study_Spray","last_spray",0);; \

    if ($now > $last_spray+900) { \

        my $count = ReadingsVal("Study_Spray","count",0)+1;; \

        fhem("setreading Study_Spray last_spray $now");; \

        fhem("setreading Study_Spray count $count");; \

        fhem("trigger force_StudySpray");; \

    } \

}

 

define Regular_StudySpray at +*00:05:00 \

    IF ([LatestMotion] eq "Study_PIR") \

        (trigger DoStudySpray);;

 

define StudySprayMotion notify Study_PIR:motion \

    trigger DoStudySpray;;

 

Done

 

 

Comments (0)

You don't have permission to comment on this page.