Hello guys,
All the testing and modules are been done with the Arduino Mega, but I'm gonna use the Arduino Micro as my final board, on the previous blog we successfully
controlled the Humidifier using the Arduino and I started the soldering work in parallel.
The chassis of the humidifier itself is sufficient to hold the Arduino Micro and the Bluetooth module so my work got reduced on designing a separate enclosure.
So this weeks update is the Room freshener,
I've chosen two scents one is little warming great one to rise up the spirit (SummerDelight for SORROW), the other one is smooth and calming(Citrus for ANGER).
Dismantled the machine.
I couldn't find what chip it was using the on part markings and decided to study the circuit, the IC was simply switching a PNP transistor on particular intervals.
after finding the terminals of the PNP tapped wires and added a NPN to control with Arduino GPIO. The motor consumed about 200mA as peak current so a 2N3904 was enough. The only one Issue was timing, 500ms was too short and 1ms was too long. A USB scope came handy and ON timing was 750ms.
Did the same for the other one freshener device too and its action time (I started using gifs its much more convenient than uploading videos hoping it works good on mobile devices too)...
The code of course... I've added a few more lines to the previous code.
#include <TroykaDHT.h> #define ROOM_SUM 11 #define ROOM_CIT 12 #define HUMIDIFIER 9 void freshner (int fresh) {digitalWrite(fresh,HIGH); delay(750); digitalWrite(fresh,LOW); } DHT dht(10, DHT11); void setup() { pinMode(HUMIDIFIER, OUTPUT); pinMode(ROOM_SUM, OUTPUT); pinMode(ROOM_CIT, OUTPUT); Serial.begin(9600); dht.begin(); } void loop() { digitalWrite(HUMIDIFIER,LOW); dht.read(); delay(100); int hum = dht.getHumidity(); char c = Serial.read(); switch(c){ case 'a': //ANGER if (hum<80) { digitalWrite(HUMIDIFIER,HIGH); } freshner(ROOM_CIT); delay(480000); break; case 's': //SAD if (hum<60) { digitalWrite(HUMIDIFIER,HIGH); } freshner(ROOM_SUM); delay(480000); break; } }
Cheers,
Top Comments