Arduino smell emitting technology hack






For my graduation project, the Happiness Cube, I also wanted something that could be programmed to release fragrance. Unfortunately smell emitting technologies are very expensive, so I decided to make my own by hacking airfresheners. I wanted to use three different fragrances, lavender for the first seven minutes and vanilla and chocolate for the next fourteen minutes. So I hacked three airfresheners.

I unscrewed them.

5030343533_e7fe12bacc_z

And here is how it looks from inside.

5030990264_9661f9047c_z
Basically this airfreshener is operating with one 3V dc motor which is activated by batteries it turns and the gears are pressing the vial down releasing fragrance. In order to connect the airfreshener to the arduino you need an H-bridge driver chip. I used the L293DNE chip. You can find extra information about the chip here
I believe it is easier to understand how everything is connected to the Arduino board by looking at the schematic I made in Fritzing
5030023537_054846f468_z
Another problem was that the vials that come with the airfreshener (left) can not be hacked, since they use compressed air. For that reason I replaced them with small bottles used for naisal sprays (right).

And here is the result.

I wanted the first airfreshener to emit fragrance every 30 seconds for the first 7 minutes. Then this would stop and airfresheners 2 and 3 would emit fragrance every 30 seconds as well for the next 14 minutes. Here is the Arduino code:


// Air freshener pins
int motor_pins[] = {
5,3,9,6,10,11};
int pinStep;
int motorDirection;

// Time variables
int secForMotors;
int curMillisForMotors;
int preMillisForMotors;
int phaseOneCounter;
int phaseTwoCounter;
int currentPhase;
int repetitionCounter;

void setup() {

for (int i= 0; i < 6; i++) { // Prepare Air freshner ports pinMode(motor_pins[i],OUTPUT); } // Set time variables secForMotors = 30; // How often Air fresheners are activated curMillisForMotors = 0; preMillisForMotors = -1; phaseOneCounter = 0; phaseTwoCounter = 0; currentPhase = 0; // 0 - Freshener 1 only // 1 - Freshener 2 & 3 repetitionCounter = 0; } void loop() { time = millis(); curMillisForMotors = time / ((secForMotors * 1000) / 4); if(currentPhase == 0) { // PHASE 1 if(curMillisForMotors != preMillisForMotors) { // Set the Air freshner motors if(motorDirection == 0) { digitalWrite(motor_pins[pinStep],HIGH); motorDirection = 1; } else { digitalWrite(motor_pins[pinStep],LOW); motorDirection = 0; pinStep++; repetitionCounter++; if(repetitionCounter == 2) { repetitionCounter = 0; phaseOneCounter++; } pinStep %= 2; } if(phaseOneCounter == 14) { // 7:00 mins = 14 times currentPhase = 1; pinStep = 0; repetitionCounter = 0; } } } if (currentPhase == 1) { // PHASE 2 if(curMillisForMotors != preMillisForMotors) { // Set the Air freshner motors if(motorDirection == 0) { digitalWrite(motor_pins[pinStep+2],HIGH); motorDirection = 1; } else { digitalWrite(motor_pins[pinStep+2],LOW); motorDirection = 0; pinStep++; repetitionCounter++; if(repetitionCounter == 2) { repetitionCounter = 0; phaseTwoCounter++; } pinStep %= 4; } if(phaseTwoCounter == 27) { // 13:30 secs = 27 times currentPhase = 2; } } } preMillisForMotors = curMillisForMotors; }

Good Luck!

Epilogue

If you found what you read helpful or inspiring, the least you can do out of academic or research courtesy is to refer to my website or my name when using the code or information from here. Intellectual Property licences can also create problems to opensource and the project is all opensource so I would prefer not to get one.


Categories: Projects