loading
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 !
<p>dear sir.<br>i am interest with this article.<br>if i make interface bluetooth HC-05 with Atmega16 and lcd connect to android. how listing diagram?<br>and how simple code with bascom avr?<br>u can share me? for my school home work<br>my email njebluk69@gmail.com<br><br>this my listing circuit and program. but still not work.<br>thanks before</p>
<p>can u please share the Embedded C code u made for above project???</p>
<p>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 &quot;burn&quot; in microcontroller...</p><p>And senda.jar file needed to write (after modify address... see here : <iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/Wu6jLYzmKnk" width="500"></iframe></p><p>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)</p>
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
<p>I don't understand! you want comunicate by mobile phone via bluetooth with pc or microcontroller?</p>
<p>mobile phone via bluetooth with microcontroller atmega8 to be specific.</p>
<p>void setup()</p><p>{</p><p> // start serial port at 9600 bps:</p><p>//This code is for arduino write by costycnc</p><p> Serial.begin(9600);</p><p> pinMode(13, OUTPUT); // LED on ARDUINO</p><p>}</p><p>void loop()</p><p>{</p><p> // if we get a valid byte, read analog ins:</p><p> if (Serial.available() &gt; 0) {</p><p> // get incoming byte:</p><p> inByte = Serial.read();</p><p>if inByte==65 // character &quot;A&quot;</p><p>{</p><p> digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)</p><p> delay(1000); // wait for a second</p><p>}</p><p>else</p><p>{</p><p> digitalWrite(13, LOW); // turn the LED on (HIGH is the voltage level)</p><p> delay(1000); // wait for a second</p><p>}</p><p> }</p><p>}</p>
<p>if modyfy file by my variant , you don't needed install huge programs ( sdk )in your computer for compile j2me source file</p>

About This Instructable

5,550views

40favorites

License:

Bio: I love programming win32 and avr,and all beautifuls thinghs and girls!!!
More by costy35:Home automation with bluetooth! Light controlled mixer blender,project for arduino! Atmega8 arduino compatible bootloader 
Add instructable to: