Home Automation With Bluetooth!

About: I love programming win32 and avr,and all beautifuls thinghs and girls!!!

Intro: Home Automation With Bluetooth!

My project is composed of several parts... programs,electronics...
The most important piece is bluetooth module ,this receive data from any bluetooth device(phone,pc,etc)and send to atmega8 microcontroller.
Principle is simple:
A bluetooth device send and character ("A" or "B" or "C" ,etc) and microcontroller read this data an action.
Is very simple!

The code for atmega8 first part:

Bitwait Pind.0 , Reset
Waitus 150

If Pind.0 = 1 Then A.0 = 1
Waitus 100
If Pind.0 = 1 Then A.1 = 1
Waitus 100
If Pind.0 = 1 Then A.2 = 1
Waitus 100
If Pind.0 = 1 Then A.3 = 1
Waitus 100
If Pind.0 = 1 Then A.4 = 1
Waitus 100

Read directly impulses from bluetooth module (tx from bluetooth connect to PD0 from atmega8)...i'm used this variant to understand how functioning serial data...
For 9600 bauds (1/9600=0,00010416666666666666666666666666667 second... bytes have a space of approx. 100 microseconds.
The data start with a bit of start , 8 bits of data ,parity bit and stop bit...
For read first four bits of data should jump first bit (bit of start... 100us) and half byte of data (50us).
In this mode you can get data in personal mode.
Of course you can get data with Inkey() or Ischarwaiting() but this method makes you understand more things about serial data...
Second part:
If A = 1 Then
Portb.0 = Not Portb.0
change state of port every time is accessed...

For control varius consumers like lamps,motors,tv,dvd,etc you can use an led+photoresistor+triac.
Is many types of triacs like tic206 -4ampers,tic126 -12ampers, etc
For example : for tic206 you can control a consumer with 4 ampers... this
means 220volt X 4 ampers = 880 Watt ... This means that you can control with this triac 8 lamps by 100watts !!!
Visit https://sites.google.com/site/atmega8pro/ for another details...
and my ultimate video with this simple principle, no library, no additional data,non complicated !

Share

    Recommendations

    • Furniture Contest 2018

      Furniture Contest 2018
    • Metalworking Contest

      Metalworking Contest
    • Tiny Home Contest

      Tiny Home Contest

    8 Discussions

    0
    None
    wahyud5

    2 years ago

    dear sir.
    i am interest with this article.
    if i make interface bluetooth HC-05 with Atmega16 and lcd connect to android. how listing diagram?
    and how simple code with bascom avr?
    u can share me? for my school home work
    my email njebluk69@gmail.com

    this my listing circuit and program. but still not work.
    thanks before

    Screenshot_5.pngScreenshot_6.png
    0
    None

    code in bascom ( bluetooth.bas) have few lines and cand be write easily in c/c++... but you have buetooth.hex and just needed to "burn" in microcontroller...

    And senda.jar file needed to write (after modify address... see here :

    in your phone... but it's not shure if is compatible with any mobile phone... and run (it's just a j2me executable file by any mobile with java)

    0
    None
    Vaibhav Kaushikcosty35

    Reply 3 years ago

    I appreciate ur help but can u share simple program in C for controlling led according to data recieved from bluetooth.....my email id is vaibhav3521@gmail.com

    0
    None

    void setup()

    {

    // start serial port at 9600 bps:

    //This code is for arduino write by costycnc

    Serial.begin(9600);

    pinMode(13, OUTPUT); // LED on ARDUINO

    }

    void loop()

    {

    // if we get a valid byte, read analog ins:

    if (Serial.available() > 0) {

    // get incoming byte:

    inByte = Serial.read();

    if inByte==65 // character "A"

    {

    digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)

    delay(1000); // wait for a second

    }

    else

    {

    digitalWrite(13, LOW); // turn the LED on (HIGH is the voltage level)

    delay(1000); // wait for a second

    }

    }

    }

    0
    None

    if modyfy file by my variant , you don't needed install huge programs ( sdk )in your computer for compile j2me source file