Introduction: LinkIt One Auto Air Freshner

About: I started this hobby when I was in 5th grade and since then I have gained a lot of knowledge I would love to help anyone who has questions. I look forward to pursue this field as my career as it is both my pas…

Hello Builders! Have you ever been in your room and felt like it should smell good most of the time? Then bought an air freshener but ended up keeping it in some corner from where you would never use it or just be too bored to. Then I have a solution for you, this project will allow you to not worry about your room smelling good, as it will automatically on timed intervals do the job for you. The brain of this project is a powerful micro-controller called the LinkIt One Board by Mediatek. This Microcontroller has built in wifi, GSM and Bluetooth meaning that you can go a step further and control how fresh your room smells with your phone through Bluetooth or wifi. As of this 'Ible I'll be showing you how to get the basic version started and spraying the Air Freshener in time intervals. Let's get started

Step 1: Parts

1. LinkIt One Board
2.Push Button
3. 1k Resistor
4. Servo 5v
5. Led / 330ohm resistor
6. Perf Board
7. Air Freshner ( with a trigger)
8. Metal wire for servo
9. Case for the Microcontroller( small box)

Tools:
1. Hot glue gun
2. Soldering Iron
3. Wires / wire cutter

Step 2: Solder the Circuit

In his step we will solder the button circuit and the led on the perf board. We need a button for this project because it's important for us to be able to turn the Smart Air Freshener off. Think about when your sleeping and suddenly the Air Freshener is sprayed:). So let's add a button that when pressed turns on and keeps on the cycle of spraying until it's pressed once more, this action will turn it off. The led is present to tell us which state the Air Freshener is in. You could also use red and green LEDs to indicate it but in this example the green led being off will tell us that the Air Freshener is off.

1. Start by taking a small piece of a perf board and then insert the pushbutton.

Solder the buttons pins

2. Then solder a wire to one of the pins( this will be your signal pin)

3. Then on the opposite pin solder a 1k Resistor, the second end will go to the GND. (solder a wire )

4. On the same side as the resistor's pin on the switch solder a wire. This will be your 5v pin.

5. Now your done with the switch, cut the led's legs short and insert it in the perf board.

6. Solder it down to the board.

7. Solder wires to the led.

Now you're all done with the Perf Board check all connections and follow the pictures.

Step 3: Mount the Servo

In this part we will mount the servo and attach a metal wire from the trigger to the servo such that servo pulls the trigger far back enough so that the Air Freshener Liquid is released.

1. Make a small hole in the trigger with the help of a solder iron( be sure to work in a well ventilated area.)

2. Put the metal wire through it and twist it tightly.( this should be good enough for the trigger)

3. Position your servo and apply a dab of hot glue in the area your going to mount it.

4. Firmly hold the servo in place until the glue dries, ( if your trigger feels hard you can wrap tape around the servo to ensure a tight fix.

5. Now put the metal wire through the servo's head and make a knot such that it doesn't come out.

6. Hot glue the circuit on to our servo or any place on the Air Freshener that seems good.

Step 4: Case

Since are going to leave the Air Freshener in random places we should put the LinkIt One board in a case.

1. Hot glue the case on to the Air Freshener.

2. Make 4 holes in the case of getting the wires through and be connected to the board.

3. Put all the wires through and make sure each of them reaches the board correctly.

Your done with most of it, just two steps away from a equally fragrance spreading Air Freshener. :)

Step 5: Code It

Plug in the LinkIt One Board into your computer.

Open the Arduino Environment and test the project with the code below. This is a simple code designed to spray within every 20mins, It'll do 2 sprays each time. Also if the button is pressed once the Freshener will turn on the led indicating that the action is running in a cycle now and if you press it again the led will go off indicating that the Freshener is off.

#include

int button = 10;

int led = 13;

int powerservo= 8;

Servo TrigServo;

boolean lastButton = LOW;

boolean currentButton = LOW;

boolean ledOn = false;

void setup() {

digitalWrite(powerservo, HIGH);

TrigServo.attach(9);

TrigServo.write(90);

pinMode(button, INPUT);

pinMode(led, OUTPUT);

}

boolean debounce(boolean last) { boolean current = digitalRead(button);

if (last != current)

{ delay(5);

current = digitalRead(button); }

return current; }

void loop() {

currentButton = debounce(lastButton);

if (lastButton == LOW && currentButton == HIGH)

{ ledOn = !ledOn; }

lastButton = currentButton;

digitalWrite(led, ledOn);

digitalWrite(powerservo, ledOn);

if(powerservo == HIGH)

{

CyclePull();

} }

void CyclePull() {

delay(3000); // time after starting

TrigServo.write(10);// pull back

TrigServo.write(90);// release

delay(1000); //small delay

TrigServo.write(10);// pull back release repeat

TrigServo.write(90);

delay(1200000); // delay for 20 mins

}

Step 6: Wire It and Test It

Once the sketch has uploaded all you have to do is plug all the wires in and start it.

So heres a guide to connect the wires

1. Connect all the GNDs to GND ( get rid of the simple ones)

2. Connect the led positive to pin 13

3. Connect the servo data to pin 9

4. Connect the power of servo to pin 8

5. Connect the button power to 5v

6. Connect the button data to pin 10

And thats it your done:)

Once you power it up and press the button in 3 secs the servo should move causing the Air Freshener to spray. If so then you have successfully built a LinkIt One Air Freshener. :)

Step 7: Conclusion and Improvements

To conclude this build I would like to say that building this was fun and let me see just how much could be controlled by a tiny yet powerful tool. This inspires me to control the most simplest of things with a Microcontroller because... we can:) . As of the improvements, this could have been built in a much more compact design where the Air Freshener would have been controlled through wifi or bluetooth thats built in to this board. But all in all it was a great project and hope you builders like it to, remember to tweak the code according to your requirement. If you have any questions let me know and Ill get back to you.