A Light Triggered Air Freshener
This project was heavily inspired by James Callaghan’s project: Can you IoT an Airwick air freshener?
The default behaviour of this device before you tweak it is to spray once every 15mn. This is wasteful and inconvenient.
I wanted to have the Air Freshener triggered every time I leave the restroom, when I switch the light off. Depending on the sliding switch position, it will spray more or less often:
- ❚ : Off
- ● : Will spray once every 30mn at most, if light was on during at least 5mn.
- ● ● : Will spray once every 5mn at most, if light was on during at least 3mn.
- ● ● ● : Will spray once every 30s at most, if light was on during at least 5s.
I also wanted everything to fit in and to use the default AA batteries.
There are two versions:
- Deodshiot, using a 3V3 Arduino Pro Mini
- DeodshiotIOT, using a NodeMCU / ESP-8266 / LOLIN (WEMOS) D1 mini connecting to a ThingsBoard server, so that you may monitor how long you are spending there and make statistics out of it…
Todo: Test with a MQ-136 gas sensor if the Air Freshener can be triggered when it smells bad.
You will need:
- 2 pieces of bakelite testing plate (0.1in/2.54mm, 6x8 and 6x15)
- 2 resistors ~1KΩ
- 1 photoresistor
- 1 PNP transistor (PN2222 or equivalent)
- 1 diode (1N4007 or equivalent)
- 1 relay (JRC-23F or equivalent)
- 1 microcontroller (Arduino Pro Mini or equivalent / LOLIN WEMOS D1 mini or equivalent for the IOT version)
There is nothing complicated as long as you are cautious.
Have a close look at the schematics and pictures below to see how things work.
- Flash your microcontroller with the suitable program.
- Remove the top cover.
- Remove the 4 screws (you need a long - 4cm long minimum - Philips ⨁ screwdriver).
- Remove the block out of Air Freshener.
- Push gently the part with the motor away from the rest (so that the axes are out), then up.
- Remove the circuit board.
- Un-solder the sliding switch and the two battery connectors. (NB: You need to bend the sliding swicth pins so that they can fit into the 0.1in/2.54mm testing plate.)
- Cut the 2 bakelite testing plates, solder all the components.
- Drill one hole so that the wires can go through.
- Solder the wires to the bakelite testing plates, microcontroller an motor. Double check that the motor turns the right way.
- Put everything back in place.
- Drill one hole in the top cover so that the photoresitor can see the ambiant light.
Schematic is very classic.
- 1 digital output controls the motor. We use a transistor and a relay to avoid frying the microcontroller.
- 1 analog input reads value from the photoresistor.
- 2 digital inputs read value from the sliding switch (position ● / ● ● / ● ● ●). We use the embedded pullup resistors (INPUT_PULLUP).
You may use Arduino Serial Plotter to check if everything is working as intended.