AtMega16 + HC-05 + Android Phone

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have two general questions. I have to connect an ATMega16 with and Android phone using bluetooth. The most used bluetooth module (and cheapest) seems to be the HC-05.

 

1.Is it necessary to configure the bluetooth module (with the AT commands) or can I just use it with it's default settings?

 

2. After settings and wirings are done, how does the communication between ATMega and Android phone works?

    (for example: If I send a byte through USART, does the Android phone receive it without doing anything else?)

 

Last Edited: Wed. Mar 25, 2015 - 06:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Claigodi wrote:
I have two general questions

So they should be in the General forum;  they have nothing specifically to do with megaAVR and tinyAVR - or any other particular microcontroller

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Mar 25, 2015 - 04:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok...i did a similar project to control my tank robot using bluetooth....no need to configure the HC05....By default,it will be in serial mode with 9600 baud....Just go ahead

 

Rgds//Sharanya

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For your second query....Just download a serial communication software via bluetooth like..."BLUETERM" into your phone....then you have to pair with the HC05 and send data...thats it.On the avr side,you have to receive the data from the HC05 via it's Tx pin,connected to atmega's Rx pin.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Claigodi wrote:

I have two general questions

 

So they should be in the General forum;  they have nothing specifically to do with megaAVR and tinyAVR - or any other particular microcontroller

 

The OP is asking about connecting the HC-05 to the Mega16, and then how to get the AVR communicating.

 

I'll leave this  for now.

 

JIm

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jgmdesign wrote:

Claigodi wrote:

I have two general questions

 

So they should be in the General forum;  they have nothing specifically to do with megaAVR and tinyAVR - or any other particular microcontroller

 

The OP is asking about connecting the HC-05 to the Mega16, and then how to get the AVR communicating.

 

I'll leave this  for now.

 

JIm

 

I'm really sorry. It seemed the right section...

 

Anyway, it's just simple as it seems?

TX enable -> Put data in UDR -> The communication starts -> the phone (with the app mentioned before) receives exactly what i put on UDR

Is it correct?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

exactly....first of all,connect avr Tx to HC05 Rx and avr Rx to HC05 Tx.Set up for 9600-8-n-1-n.Now write data to UDR for transmit to phone via HC05.Read UDR for data received via HC05 from phone.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SHARANYADAS wrote:

exactly....first of all,connect avr Tx to HC05 Rx and avr Rx to HC05 Tx.Set up for 9600-8-n-1-n.Now write data to UDR for transmit to phone via HC05.Read UDR for data received via HC05 from phone.

What does 9600-8-n-1-n means?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

9600 = baud rate;

8 = number of data bits;

n = NO parity bit;

1 = number of stop bits

 

Fairly standard notation for describing serial port settings.

 

(Don't know why the 'n' is repeated)

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ha ha...thanks for watching....the last 'n' stands for no flow control...although it has no relation while setting up on avr.....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SHARANYADAS wrote:
the last 'n' stands for no flow control

I see.

 

Quote:
although it has no relation while setting up on avr

Well, if the HC05 requires it, then the connected device - whatever it may be - must provide it.

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When i communicated with the HC05,it was not needed....without flow control,it will work properly........

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now it's all clear. Thanks everybody