Share on facebook
Share on twitter
Share on linkedin
Share on whatsapp

Interfacing android with pic microcontroller via Bluetooth

To forward our first step in the field of wireless communication, by interfacing android with pic microcontroller via Bluetooth, open lots of way to work on. Once we can send and receive data between a microcontroller and android mobile then use of android mobile. Then we can control other peripheral device attach with microcontroller very easily. By interfacing android with pic microcontroller via Bluetooth I did my project “Auto Pilot Car”.

Project Objective:

The main objective of my project is to control steering of a car, blow horn, On/Off head light of a car. That means complete auto pilot car can be produce by implementing Interfacing android with pic microcontroller via Bluetooth. Now see the block diagram of my project in bellow

 

Interfacing android with pic microcontroller via Bluetooth

To complete my project interfacing android with pic microcontroller via Bluetooth (Auto pilot car), I used

1>     Android Mobile

2>     Microcontroller PIC16F877

3>     Servo Motor

4>     LED

5>     Buzzer

6>     Bluetooth module

7>     Android apps “Blue control”

 Bluetooth connectivity with Microcontroller:

Now it is another important question come to our mind that how to connect Bluetooth Module with microcontroller ?

Answer is you have to connect Bluetooth module with UART port like we connect comports. If you have any confusion on “How to interface UART port with microcontroller?“ see my previous post “Serial communication with Pic 16f877 using UART”. In bellow you will find simple block diagram of interfacing Bluetooth module with microcontroller.

pic16f877

Project Description:

In my project interfacing android with pic microcontroller via Bluetooth “Auto Pilot Car”. I used servo motor as a Steering of a car, Led as a head light of a car, Buzzer as a horn. Now in my android mobile I download Bluetooth control apps from google play store. From this apps you can send some character like “a;b;c;d;e;f;g;h;U;D;L;R. Using This facility I write my program accordingly to control the total system.

 In bellow you will find the code to run my project “Interfacing android with pic microcontroller via Bluetooth”


pic microcontroller via Bluetooth
// Author : Subham Dutta
// Date : 21-01-14
// Website : www.nbcafe.in
unsigned int uart_rd;
main(){
int i;
trisb=0;
portb=0;
PWM1_Init(500);
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
while (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read();
UART1_Write(uart_rd);
}
if (uart_rd == ‘a’){
i=21;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘b’){
i=42;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘c’){
i=63;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘d’){
portb=0b00000010;
}if (uart_rd == ‘e’){
i=165;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘f’){
i=187;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘g’){
i=207;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘h’){
portb=0b00000000;}
if (uart_rd == ‘R’){
i=255;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘L’){
i=0;
PWM1_Set_Duty(i);
PWM1_Start();
}
if (uart_rd == ‘C’){
portb=0b00000001;
delay_ms(10);
portb=0b00000000;
PWM1_Start();
}
}
}

And see the video for simulation of my project in Proteus.

Not Enough, Need More

E-Mail Subscription





68 thoughts on “Interfacing android with pic microcontroller via Bluetooth”

  1. Hi Subham. Thanks for posting that. I have a car that I can successfully control with a laptop via Bluetooth. The PIC is a 16F628A and has all of the I/O I need for UART, motor outputs, a servo for steering and even an encoder read interface for speed. I made a VB interface for the GUI and now I want to make one in Android. I am interested in your comment “I download Bluetooth control apps from Google play store”. Was this an “off the shelf” option or did you write it yourself?

    Thanks, and keep up the good work.

    1. Thanks Ian for your comment. Yes you can make your android apps for your own just only you have to send ascii code for controlling the output device via micro controller.

  2. goodafternoon;
    please if its possible to send me the program with details, i’m not understanding, and i want to understand beacuse i’ve project: transfer temperature from sensor ds1775 to pc via bluetooth with microcontroler 16f877.
    cordialement

  3. which UART DB9 coonector model you have used in proteus,plz explain or tell the model no.
    my email id is “akgarg007@gmail.com”

  4. hi,the code is giving so much error,when i add the device line at starting of the code like dat: #include
    ,plz give the solution,or send the c code file to my email id (akgarg007@gmail.com)
    Your help will be appreciable
    Thanks
    Ashwani

    1. hi code is fine you just concentration on when you copy or paste then you have to change invited comma because when you copy paste some format of character not supported in Microc find and changed those it will running no problem.

  5. Hello Sir. I am just wondering if this code was created on MPLAB or MicroC or any other software? I don’t think I can use this code for MPLAB because it doesn’t even have a header file.

  6. 10q very much, i wonder if u give me the schematic with source code to make on/off light or any home appliance by using phone/android.

  7. i have tried the door lock with sms alert project, when i compile it there is no error but the simulation on proteus will be reset automaticaly it says reset by watchdog timer.what is the problem.

  8. Is there a way to convert this code to MPLAB code? I don’t know how to open peripherals etc in MPLAB like for example for ADC OPENADC(ADC_OFF etc etc ..)

  9. Hi
    I’m transmitting keys pressed on a 4×4 keypad using pic16f877a, i’m having a problem with the Bluetooth transnissiion.
    i’m using the HC 06 Buetooth Module

  10. hi Subham Dutta can u give me c code to read sms by interfacing mobile with pic please! help me please! 10q

  11. i am trying to control a stepper motor connected to pic16f877a by android phone via bluetooth.
    i am trying to communicate with pic sending and receiving characters. Simulation in proteus is perfect but when it comes to actual implementation, its not working. Some are correctand some char are wrong.instead of a i am getting y , r instead of b, s inst of c, ~ inst of x and remaining are almost same. Please help me asap..please..

    please help me to program my pic so that if i send s15 it should decode ‘s’ and understand its ‘s’.. pls help

  12. hi, i really interesting in make something like you have done.

    i want to start programing something to interact between Android cellphone and PIC microcontroller,

    i have done alot of programing before with the PIC 16f877a and 16f628, but i have never usea any bluetooth device or comunication.

    if you can send me more infromation beside what you have put here, will really help.

    my email : rodolfo_vz@hotmail.com

    thanks , sorry for my bad english , i’m from mexico.

    regards

  13. I am very much interested in Android-PIC projects.Can you send me the Circuit Diagram of this project and …..It will be Very Helpful.Also specify the Bluetooth module used..
    Email id : jigu1997@gmail.com
    Thank You………

  14. Good morning sir..
    I am a regular visitor in ur website from past so many years. I am intrested in your pilot car project but i am finding difficulties in circuit diagram and pcb designing so please provide me the useful information regarding this project soon.
    Thanks . . . .

  15. sir i am interfacing temperature IC and pressure IC with PIC 16F877A and displayed these parameter information on LCD. Now if i want to display these information on mobile using bluetooth. what are the step i have to follow.which type 0f programming i have to do for displaying the data on mobile.?

  16. Hi Subham,
    Subho Bijaya to you and your family !

    I have few doubt. Can you please clarify.

    1. do you have complete circuit diagram. If yes then please post the same or mail me (abhijit2683@gmail.com).
    2. In the C code given above, PWM1_init() function is user defined function or it is inbuilt.

    Thanks & Regards,
    Abhijit
    9831493210

  17. For the bluetooth module, is it just the RX-TX pins on PIC16F877 to the COM port connection you describe here (http://www.nbcafe.in/serial-communication-with-pic-16f877-using-uart/) and then using a USB BT dongle on your computer and having the computer program take in the bluetooth signal from the phone? Is it possible to use a bluetooth chip (http://www.st.com/web/en/resource/technical/document/datasheet/DM00048919.pdf) to directly connect to the phone?

    Thanks Subham!

  18. Good day sir!
    Do you have circuit diagram of bluetooth and microcontroller? can you send me sir? here’s my e.add. “azrat000@gmail.com” tnx sir!!

  19. Everything is clear about your project expect that bluetooth module which you are using. I am stuck with my project in the same are. I need some bluetooth module which sends digital data from a micro controller through bluetooth. If you suggest some it would really help. Thanks

  20. I want to connect my laptop Bluetooth adapter to my android Bluetooth for simulation of DC motor. I am simulating it using Proteus software. What needs to be done. Please guide…

  21. nice project u have here. .
    can you help me here. .im trying to do ur project. .i copy ur code and paste it on mikroC. .

    can i have ur proteus schematic. .i dunno if servo motor setting is wrong or bluetooth problem. .but i cant control servomotor through my android phone like u did. .

    my email is bajrai92@gmail.com

  22. Can this be implemented with arduino uno and if possible please help me in this project I m making a robowar bot please help can it be controlled via Bluetooth

  23. hi shubham I am doing this project would you send me the schematic n other details of the the project and the code u have given will it be directly compiled in mickro c or I need to add header file as I have worked on mplab for programming pic 18f n 24f . my email I’d is rahul_kumar938@yahoo.com

  24. hi. i am doing project in final year – wireless speed control of Dc motor using microcontroller and bluetooth module using Android app.
    so plz can u help in programming.?
    how to programming or interfacing in microcontroller (philips ) with bluetooth module Hc-06 or HC-05 ? can u give me that program in c or assembly language. plz help me.
    email- ariwalapalak@gmail.com

  25. respected sir i am i want to do “controlling home appliance by Bluetooth android app” plz help on this project plzzzz sir…….. my mail is smchagan415@gmail.com plz share your knowledge with me plzzz….

  26. vaishali masal

    Hi, I want to implement this project using Simulator. Pls suggest me what software is needed . If possible mail me to masal.vaishali18@gmail.com plz help me sir. OR if you have project which are completely software base especially in MATLAB or other also fine.

  27. Hai I am planning to develop my own app to interface via the bluetooth module to the robot. Do you have any idea how to interface the app with the PIC microcontroller?

  28. Hi … I am developing a project to control car direction by bluetooth using PIC …can you help me by the basic circuit diagram of this project

  29. sir, i am new in this project…. can u please give me the circuit design of this project? n i am having a problem connecting this app to my pc bluetooth… um running windows 8.1…

  30. hi shubham I am doing a similar project. would you send me the schematic and other details of the project. i am also trying to control 4 motors through my phone so it would be a great help if u can send me ur project and schematic plus any other sources about building my own Bluetooth module(Hardware) i mean.

    My email: nour.el-dien@hotmail.com

    thanks alot in advance

    Best Regards,
    Nour

  31. hey, i want to make a project on home automation using pic16f877a and bluetooth module. Would u please help me out by sending the circuit diagram to assemble hardware. i have already developed an android app as i belong to cse background. thankyou

  32. Hi Sir,
    Im an undergraduate student . currently doing a project on home automation can you please send me the Proteus file and c code
    Thank you

Comments are closed.

E-Mail Subscription





Table of Contents
Subham Dutta

Subham Dutta

Hi myself Subham Dutta, having 15+ years experience in filed of Engineering. I love to teach and try to build foundation of students. Try to make them imagine what they learn.

Need more this type of content in your E-Mail?



NBCAFE