PocketMagic

PocketMagic

Where Technology meets magic


Android
53 Posts
BlackBerry
6 Posts
Electronics
84 Posts
Hardware
142 Posts
High Voltage
57 Posts
Image processing
5 Posts
iPhone
4 Posts
Linux
2 Posts
Nuclear
27 Posts
Optics
11 Posts
Photography
7 Posts
Photoshop
3 Posts
Research
21 Posts
Reviews
19 Posts
Robotics
9 Posts
Security
9 Posts
Software
90 Posts
Symbian
2 Posts
Tubes
23 Posts
Windows Mobile
11 Posts

Sponsored Links


   

Top Articles!


Single Chip Computer | 258 Views | Rate 86
Single Chip Computer
AVR SDCard FAT support with FatFS | 13363 Views | Rate 30.1
AVR SDCard FAT support with FatFS
3V to 400V regulated inverter for Geiger counters | 1144 Views | Rate 12.17
3V to 400V regulated inverter for Geiger counters
Electric Fence - 20KV pulses for perimeter defense | 10035 Views | Rate 8.82
Electric Fence - 20KV pulses for perimeter defense

   

News & Updates


2014-10-17, Single Chip Computer

2014-07-23, High Voltage Power supply - 140KV

2014-07-20, 3V to 400V regulated inverter for Geiger counters

2014-07-20, uRADMonitor - Unusual Background Radiation Reports - Explained

 

  

Atmega8 with Bluetooth radio module


By Radu Motisan Posted on May 27th, 2009 , 1728 Views (Rate 0.88)



Microcontrollers do a great job for allowing the simple user to gain access to advanced electronics applications.

For one of the robots I've built, I had to find a way of connecting an Atmega8 running at 16MHz with a Windows Mobile Smartphone. The idea was that the microcontroller handles some basic sensor data and controls some motors, and the smartphone runs an advanced application that controls the robot.

So how to do it? I've tried Infrared, since the Smartphone had an infrared port, but had little success with that. No way of connecting the two via serial port, since the Smartphone only had an USB connector.

The final solution was a bluetooth radio link.

We all know that connecting an Atmega8 to a computer's serial port is easy, by using the famous MAX232 module:

Using Bluetooth was even easier, since no electrolytic capacitors were needed as in the case of the max 232:

Here's the module's datasheetfor details regarding voltage and other parameters.



The Atmega8 needed a 16MHz crystal to assure reliable UART functionality at 9600bps (to sync with the BT Module). After putting everything together, I could establish a conneciton from my Bluetooth enabled PC, to the Atmega8+BtModule, and serial port service was available and connected as COM4. Using Hyperterminal, exchanging data worked flawlessly.

See my bluetooth enabled Atmega8 as used in my latest robot, Perseus 3.

Wireless Bluetooth connectivity offers a large number of possible applications. Good thing it is so easy to use!

Radu Motisan



More on PocketMagic:

How to set the AVR Fusebits | 3522 Views | Rate 5.99
How to set the AVR Fusebits
Simple Switched power Supplies | 4934 Views | Rate 5.47
Simple Switched power Supplies
Atmega8 and Nokia 5110 LCD  | 2968 Views | Rate 5.3
Atmega8 and Nokia 5110 LCD
uRADMonitor - Online Radiation monitoring station | 3620 Views | Rate 4.97
uRADMonitor - Online Radiation monitoring station
Coil Winding machine counter with Atmega8 and Reed relay | 2251 Views | Rate 4.39
Coil Winding machine counter with Atmega8 and Reed relay
Relaxation oscillator using a Hydrogen Thyratron | 4792 Views | Rate 4.33
Relaxation oscillator using a Hydrogen Thyratron

34 Responses to “Atmega8 with Bluetooth radio module”

  1. 1
    YONATHAN:

    ESTA INTERESANTE TU TRABAJO PERO QUISIERA SAVER SI ME PUEDES DAR UANA MANO COM UN PROYECTO QUE QUIERO HACER SE TRATA DE UNA PANEL ELCTRONICO HACIONADO VIA BLUETOOTH SI PUDIERAS DARME UNA AYUDA TE LO AGRADECERIA

  2. 2
    Radu Motisan:

    Ola YONATHAN,

    I’ll do my best to help you, so let me know what you need.

  3. 3
    Zsolt:

    Could you send me a link or something about how to write the program or a program itself to atmega8 and bluetooth module connection ( mine is a rayson BTM 222 ). I mean program for the atmega microcontroller to handle the module. ( Basic would be the best,but anything would be a good help. )
    Thanks

  4. 4
    Radu Motisan:

    Szia Zsolt,

    I’m simply using the RX/TX to send/recieve serial data via UART. It worked from the first try

    Let me know if you need an UART sample.

  5. 5
    yonathan:

    en si estioy en nada sobre ek proyecto no se por donde empesar pero no seria mas facil utilizar el usar antes que el uart bueno
    lo que estoy buscando haorita es un simulador para lo que va ser la tx y rx si tu vieras un simulador o algo que me ayude te lo agradeseria

  6. 6
    Razvan:

    Salut,

    De unde ai cumparat modulul BT ?

  7. 7
    Radu Motisan:

    @razvan: ebay.

  8. 8
    Manas Paul:

    Dear Radu,
    I have needed the Bluetooth serial converter.I am in Kolkata.I dnt get this device in here market.So plz give me any site or address about this device.It too much important for me.So plz give me the site.I will buy in limited cost.So plz help me.
    Thank You.And nice Job.

  9. 9
    Radu Motisan:

    Paul, are you referring to the UART Bluetooth Module?

  10. 10
    Radu Motisan:

    You can purchase the module online from: http://cgi.ebay.com/Bluetooth-serial-converter-UART-interface_W0QQitemZ350323499668QQcmdZViewItemQQptZLH_DefaultDomain_0?hash=item5190e86294

  11. 11
    gyfzsolt:

    Salut! Poti sa ma ajuti un pic? Am un modul BT foarte asemanator, si nu stiu cum ar fi bine sa-l montez pe PCB.

  12. 12
    Radu Motisan:

    ce modul e? poti pune niste poze?

  13. 13
    Diego:

    Hi, first of all I have to thank you for share your work whit everyone, and second I have a question, I have an Atmega48P, can I use this mricrocontroller or do I need to get one different?

  14. 14
    Radu Motisan:

    Hello Diego, thanks.

    Yes you can use the Atmega48, to interface the bluetooth module you will only need the two uart pins tx and rx.

    Good luck, and feel free to post pictures with your project when completed.

  15. 15
    Jorge:

    Did you have any interference problem using bluetooth? I’m using a roving networks rn-41 bt module with an atmega328 and a gyro (via ADC), and i get interference from bt module. If i try the board via serial cable, it works just fine, accurate and stable. When I change te cable for the rn-41 some kind of RF noise shows up, and it just never get stable, it’s always sending little variations (as if the gyro was being rotated, wich is not). I tried changing the supply of bt module just in case it would be a matter of high current consumption of BT, but it didn’t solve the problem. Later i tried to get the BT module away from atmega328 via cable extension (about 10 inches), and altough the noise still existed, it starter to show up in bigger intervals of time (there was more time between noise and noise). Sorry about my english, i’m not to good at it yet. Then i restored the bt to the board and extenden the gyro via cable to get it far away from BT, but the problem persisted. So i think the noise problem it’s between BT module and atmega328 … any hint on how to solve this? The size of the board it’s pretty important on my project, so getting the BT away it’s not really a solution since distance its huge (the entire board it’s 4 inches lenght)

  16. 16
    Radu Motisan:

    Hi Jorge,

    I didn’t get such issues, but,

    let’s not forget we are talking about digital transmissions, where information is digitally encoded, it also comes with checksums and error correction mechanisms, it is unlikely for a RF interference to corrupt the data at Bluetooth serial port profile protocol level.

    So I suspect there is a software bug somewhere, you might want to double check the Bluetooth code part , or post it here.

    Hope this helps,
    Radu

  17. 17
    Jorge:

    It’s not that the data sended by the bluetooth get corrupted. In a steady position, gyro shouldn’t send any data towards the MCU, since there is no angular velocity being applied to it. Therefore, MCU shouldn’t send any data towards the computer via BT module. But when in a steady position (i.e. laying in a table) the MCU sends constant data at the computer, as if the gyro was detecting constant movement being applied to him, wich is not. My first tought was that the gyro was being afected by the RN-41 (let’s remember that via cable, this doesn’t happen). Now after several tests (described above) i think the problem its somewhere between the RN-41 and the atmega MCU. I’m trying filters to see if i can get it stable.

    I know that gyro has an error range, that makes him detect angular velocitys even when there is none (or maybe some “natural” oscillations of the floor because of traffic or something), but according to datasheet, and to the tests i made via cable, these variations are a lot smaller than the ones i detect via Bluetooth. Lets say after ADC in range of 0-1023, normal variaton of gyro goes from +-3 of the “zero” reference (wich is 500), and when i connect via Bluettoth i detect variations from +-30. That’s a lot if you consider that moving the gyro really fast you’ll get aproximately +- 120 (so +-30 it’s actually a 25% noise signal).

    Thanks four your fast reply!

  18. 18
    Klein:

    Jorge, what are you building?

  19. 19
    Jorge:

    I manage myself to find the cause of the problem. After re-cheking the complete pcb i found that one of the Power supply tracks that I was cutted in order to separate BT supply from MCU supply was not completley cutted. So i re-cutted it, test different Power Supplies for each part of the board and it worked just fine. So it was a problem of noise being generated by the RN-42 in the supply line, because of dramatic changes from low to high current consumption during TX.

    Klein: I’m trying to build a sort of stability control for my robot. The idea it’s to carry things in a container that is keept paralell to horizon all the time (so things don’t fall when climbing or descending).

  20. 20
    feng:

    you mentioned that you connect your smartphone with atmega via BT. But you said connect with computer.Recently some people succeed in connect atmega with phone via BT.there is a library by mit on android.But i’m looking for ios.

  21. 21
    Radu Motisan:

    @feng, you don’t need any fancy library! Just some basic programming skills. Have a look here: http://www.pocketmagic.net/?p=869

  22. 22
    feng:

    @Radu Motisan,yes.And I see your Android controlled robot ,that is what i’m serching for on ios.Sometimes i just do without PC.

  23. 23
    feng:

    @Radu Motisan,see work by someone else.you both have well program skill

  24. 24
    Radu Motisan:

    Sorry feng, that would take time to develop.

  25. 25
    feng:

    this make me consider to buy an android or flash android to itouch later

  26. 26
    Titus:

    hi…this is Titus
    i hv one doubt from bluetooth link
    can i do bluetooth link betwn android mobile to PIC controller(16F877A) ???
    if it is “yes”
    tel me hw
    give some idea to start and examples
    plzz help me

    this is my email id
    titusece@yahoo.com

    thanx

  27. 27
    Radu Motisan:

    yes titus you can.

    the best example is this article, read it and see the schematics.

    what you need to do is connect the BT module to PIC’s UART pins.

  28. 28
    Darrin:

    Radu, over on http://www.slideshare.net/erinyueh/android-bluetooth-introduction you mentioned “Using Bluetooth, I managed to control a 4×4 Robot (Drone) remotely, using my Android G1. I’m using a serial connection over bluetooth”.

    Is that code available for review somewhere? I would like to have a look at it if so.

    Thanks!

    Darrin

  29. 29
    Radu Motisan:

    Hi Darrin, see the code here : http://www.pocketmagic.net/?p=1398

  30. 30
    Android controlled robot (via Bluetooth) – Part 1 « PocketMagic:

    [...] a previous article, I've shown that it is possible to connect a bluetooth module to an ATMega micro controller via the [...]

  31. 31
    walid:

    Hi Radu,
    I have to make in my last year project a rectifier controlled by microcontroller PIC16F887, how can i use this rectifier to make my robot?

  32. 32
    Shree:

    Hello Radu, Do we need to use MAX232 if we are not using RS232 ? I wanna send data to my AtMega32 via android. So all I need is Atmega32 and Bluetooth Module, right ? Also suggest me Bluetooth Module for this

  33. 33
    Radu Motisan:

    @Shree: you are correct, the MAX232 is not needed for your purpose. You can use HC-05 Bluetooth modules, also available on Ebay.

  34. 34
    Shree:

    Hi Radu, Thanks for the Response. I see many HC-05 Bluetooth modules there, which one you suggest for ATmega32 ?

Thank you for commenting. Your comment won't show until approved, which can take some time.

Please copy the string IBRnVi to the field below: