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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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 #10 : The Super Power
  • 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: 3 Jul 2018 1:17 AM Date Created
  • Views 641 views
  • Likes 6 likes
  • Comments 0 comments
  • raspberry_pi_3_model_b_plus
  • bluetooth unleashed
  • arduino
Related
Recommended

Bluetooth Unleashed : AAPSAD #10 : The Super Power

sakthi.1260
sakthi.1260
3 Jul 2018

Hello guys,

This week on Bluetooth Unleashed...

 

We are done with the control unit! A few small things are pending for now and GUI is complete now.

 

One big thing we've been waiting for...

 

Unleashing the power of Bluetooth....

Although I had multiple options with Bluetooth to be used on the Arduino side (choices were HM11, Ti CC2650, nRF51822)

but I found a lot of HC-05 laying around (once we used to add this to everything) so thought of putting them to use.

image

Initially there was a lot of trouble with serial port emulation over Bluetooth, it was discoverable, got paired but it always ended up a connection failure.. and finally

image

something happened

Blueman bluetooth manager and pyserial made life easy, a few clicks and everything was smooth.

imageimage

and this time I brought the Arduino Micro into the scene and everything worked like a charm.

A set of charterers and a switch case on the arduino side will controll the GPIOs

image

The completed Arduino code:

#include <TroykaDHT.h>
#include <SoftwareSerial.h>

#define ROOM_SUM 11
#define ROOM_CIT 12
#define HUMIDIFIER 2
#define FAN 4
#define LIGHT 5
#define BRX 9
#define BTX 10
#define LIGHT_SENSE A0

void off_all()
{
  digitalWrite(HUMIDIFIER,LOW);
  digitalWrite(FAN,HIGH);
  digitalWrite(LIGHT,HIGH);
}

void freshner (int fresh)
  { 
    digitalWrite(fresh,HIGH);
    delay(750);
    digitalWrite(fresh,LOW); 
  }

DHT dht(8, DHT11);
SoftwareSerial btserial(BRX, BTX);
int hum;
float temperature;
char bdata;

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);
   btserial.begin(9600);
   dht.begin();
 }

void loop()
{ 
  dht.read();
  delay(100);
  hum = dht.getHumidity();
  temperature = dht.getTemperatureC();
  int lux;
  if (btserial.available()){
   bdata=btserial.read();
   Serial.println(bdata);
  
   switch(bdata){
    case 'a' : //Auto
      off_all();
      lux = analogRead(LIGHT_SENSE);
      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);
         //delay(480000);
         break;
       
     
      case 'c':             //SAD
        digitalWrite(LIGHT,HIGH);
        if (hum<60)
          {
              digitalWrite(HUMIDIFIER,HIGH); 
          }
        if (temperature>26)
            {
              digitalWrite(FAN,LOW);
            }
        freshner(ROOM_SUM);
        //delay(480000);
        break;

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

       case 'e': //MANUAL
          off_all();
          break;
       case 'f':
          digitalWrite(LIGHT,HIGH);
          break;
       case 'g':
          digitalWrite(LIGHT,LOW);
          break;
       case 'h':
          digitalWrite(FAN,HIGH);
          break;
       case 'i':
          digitalWrite(FAN,LOW);
          break;
       case 'j':
          digitalWrite(HUMIDIFIER,LOW);
          break;
       case 'k':
          digitalWrite(HUMIDIFIER,HIGH);
          break;
       case 'l':
          freshner(ROOM_SUM);
          break;
       case 'm':
          freshner(ROOM_CIT);
          break;
       default:
          break;
  }
 }
}

 

to be continued....

 

Cheers image

  • Sign in to reply
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