element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Bluetooth Unleashed Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Bluetooth Unleashed Design Challenge
  • More
  • Cancel
Bluetooth Unleashed Design Challenge
Blog Bluetooth Unleashed : AAPSAD #9 : Light and Ventilation
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: sakthi.1260
  • Date Created: 30 Jun 2018 2:01 PM Date Created
  • Views 1103 views
  • Likes 7 likes
  • Comments 7 comments
Related
Recommended

Bluetooth Unleashed : AAPSAD #9 : Light and Ventilation

sakthi.1260
sakthi.1260
30 Jun 2018

Hello guys,

 

On the last update we added the room freshener. Soldering part is done.

 

Things to be done to complete the challenge:

1) Ventilation & Lighting

2) Bluetooth Communication between the Arduino and Raspberry Pi

3) UI design (I've never worked on UI, but I'm spending time over it) and program integration

 

This week on Bluetooth unleashed, we are gonna add a relay module and test it.

I'm strictly not allowed to keep my hands on the building wiring, since the power outage we caused last time.

 

Somehow I've managed and got permission to test it for a single day and I'm gonna save it for my final demonstration.

image

A simple connection nothing much, 2 digital pins drive the relays, on addition I've attached a light sensor to analog pin A0.

image

 

 

image

This light sensor helps to switch on the light under low light condition while running on the automatic mode and DHT11 provides the room temperature.

Yep I've planned both emotion based and manual control and its time to complete the Arduino program.

 

#include <TroykaDHT.h>
#define ROOM_SUM 11
#define ROOM_CIT 12
#define HUMIDIFIER 9
#define FAN 4
#define LIGHT 5
#define LIGHT_SENSE A0

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);
  pinMode(FAN, OUTPUT);
  pinMode(LIGHT, OUTPUT);
  digitalWrite(FAN,HIGH);
  digitalWrite(LIGHT,HIGH);
  Serial.begin(9600);
  dht.begin();
}

void loop()
{ digitalWrite(HUMIDIFIER,LOW);
  dht.read();
  delay(100);
  int hum = dht.getHumidity();
  float temperature = dht.getTemperatureC();
  char c = Serial.read();
  int lux = analogRead(LIGHT_SENSE);
  switch(c){
     case 'a' : //Auto
      
      if (lux < 100)
         {
          digitalWrite(LIGHT,LOW);
         }
      break;

     case 'b': //ANGER
         digitalWrite(LIGHT,HIGH);
         if (hum<80)
            {
              digitalWrite(HUMIDIFIER,HIGH);
            }
         if (temperature>26)
            {
              digitalWrite(FAN,LOW);
            }
         freshner(ROOM_CIT);
         break;
       
     
      case 'c':             //SAD
        digitalWrite(LIGHT,HIGH);
        if (hum<60)
          {
              digitalWrite(HUMIDIFIER,HIGH); 
          }
        if (temperature>26)
            {
              digitalWrite(FAN,LOW);
            }
        freshner(ROOM_SUM);
        break;

       case 'd':             //JOY
         digitalWrite(LIGHT,LOW);
         if (hum<60)
          {
              digitalWrite(HUMIDIFIER,HIGH); 
          }
         if (temperature>26)
            {
              digitalWrite(FAN,HIGH);
            }
         freshner(ROOM_CIT);
         break;
       
       case 'f':
          digitalWrite(LIGHT,LOW);
          break;
       case 'g':
          digitalWrite(LIGHT,HIGH);
          break;
       case 'h':
          digitalWrite(FAN,LOW);
          break;
       case 'i':
          digitalWrite(FAN,HIGH);
          break;
  }
}

 

Since the Bluetooth part is on progress I ain't providing the complete code in this post.

Here's a sneak peek of the UI, its my first attempt with GUIs kindly bear with me!

image

 

Cheers,
Sakthi

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 7 years ago +3
    I'm strictly not allowed to keep my hands on the building wiring, since the power outage we caused last time. Please tell me that all the appropriate Electrical Safety requirements are going to be shown…
  • genebren
    genebren over 7 years ago +1
    Nice update on your design challenge project. It looks like a lot of things are coming to together. Your almost there! Keep up the good work. Gene
  • genebren
    genebren over 7 years ago in reply to mcb1 +1
    What a great safety resource. These links are invaluable. Gene
Parents
  • mcb1
    mcb1 over 7 years ago
    I'm strictly not allowed to keep my hands on the building wiring, since the power outage we caused last time.

    Please tell me that all the appropriate Electrical Safety requirements are going to be shown.

    Robert Peter Oakes and I (and some others) are very active in ensuring that unsafe electrical practices are not shown here on the element14 community in case someone else copies it.

     

    For your final demonstration, you could provide a warning that it is a test, or doesn't meet all the electrical safety requirements.

     

     

    Luckily element14 has been excellent in removing the content if our discussions have failed to persuade the writer, and we'd rather see it done safely than simply removed.

     

    I showed a few examples of what not to do here

    Forget Me Not :  eLDERmon  Electrical

     

     

    Without adding anything to your already busy Challenge, these are some methods where you can switch mains without interfering with the wiring.

    These all assume the item is plugged in, but there are options to install in place of the switch/control.

     

    sometimes a few tweaks to the design makes the difference, and we (and a few of the real electricians) are more than willing to help out with advice.

     

    Mains power control

    Home Automation in the UK Simplified, Part 1: Energenie MiHome

    Energenie Experiments – Remote Power Control for the Home

     

    Kas Lewis wrote this but Robert Peter Oakes has also written up about the work of Peter Scargill in making these independent of ITEAD's app.

    Home Automation Using the Sonoff TH & SV - Review

     

    An alternative using a RF transmitter was discussed here

    Forget Me Not :  eLDERmon  Outlets

     

     

    Not every commercial product is safe either

    Forget Me Not :  eLDERmon  Outlets

     

     

    cheers

    Mark

     

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 7 years ago in reply to mcb1

    What a great safety resource.  These links are invaluable.

    Gene

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 7 years ago in reply to genebren
    These links are invaluable.

    Thanks ... we had some others somewhere.

     

    We've had a few 'unsafe' mains control posts here on element14 but we've been able to persuade the poster to modify or hide the bits that are unsafe.

    While the internet is full of dubious methods, there is no place for unsafe practices to be here.

     

    Those alternative controls linked above are safe, and in many cases cheaper than the alternative, hence we like promoting them.

     

    What most people miss is the isolation between the Mains and the low voltage control side.

    Many of the cheap asian sourced relay boards don't have the pcb board cut to increase the isolation gap and stop tracking.

     

    While the opto-coupled boards are close, they still share the same power supply, so they aren't fully isolated from the mains.

     

     

    Mark

     

     

     

     

     

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 7 years ago in reply to mcb1

    Again, sage advice.  Having worked on high voltage systems (mains and above) I have learned a lot about safe practices.  I do cringe when I hear of beginners jumping in and playing at the 'main' voltages level.  It is good to know that there are monitors in place here to help and advise those who need help.

     

    Safety first, second, third.... and so on.

    Gene

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mcb1
    mcb1 over 7 years ago in reply to genebren
    It is good to know that there are monitors in place here to help and advise those who need help

    haha ... we simply decided one day that it was our "chosen path" .... image

     

    Feel free to add me or peter into the conversation.

    I'm pretty sure that there are others ...  three-phase perhaps

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • mcb1
    mcb1 over 7 years ago in reply to genebren
    It is good to know that there are monitors in place here to help and advise those who need help

    haha ... we simply decided one day that it was our "chosen path" .... image

     

    Feel free to add me or peter into the conversation.

    I'm pretty sure that there are others ...  three-phase perhaps

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube