Introduction
Parts Of List
Hardware side
- Arduino Uno
- Bluetooth HC-05
- Servo Motor
- Bread board
- Hook Up wires
Software Side
- Arduino IDE
- Python software
Connection
Part 1: Connect From Bluetooth To Board
| BT | Board |
| TX | RX |
| RX | TX |
| Gnd | Gnd |
| Vcc | 5v |
Part 2: Connect From Servo Motor To Board
| Motor | Board |
| Vin | 09 |
| Gnd | Gnd |
| Vcc | 5v |
Programming
Program For Arduino Part
Programming For Python Part
- #include " Softwareserial.h"
- softwareSerial serial.connection(10, 11);#
- define BUFFER_SIZE 64
- char inData[BUFFER_SIZE];
- char inchar = -1;
- int count = 0;
- int i = 0;
- void setup()
- {
- serial.begin(9600);
- serial_connection.begin(9600);
- serial_connection.println("Ready!!!");
- serial_println("Started");
- }
- Void loop()
- {
- byte byte = Count = serial_connection.available();
- if (byte_ Count) {
- Serial println("Incoming Data");
- Int first_bytes = bytes - Count;
- int remaining_bytes = 0;
- if (first_bytes > +BUFFER_SIZE - 1)
- {
- remaining_bytes = bytes_count = (BUFFER_SIZE - 1);
- }
- for (i = 0; i < first_byte; i++)
- {
- intchar = Serial_connection.read();
- int Data[i] = inchar;
- }
- intData[i] = '\0';
- if (string(inData) == "BOOP 2")
- {
- Serial.println("************* start Motor ********************");
- }
- elseif(string(inData) == "BOOP 4")
- {
- Serial.println("************* stop Motor ********************");
- }
- for (i = 0; i < remaining_bytes; i++)
- {
- inchar = Serial_connection.read();
- }
- Serial_ConnectionPrintln("Hello From Blue" + string(count));
- Count++;
- }
- delay(100)
- }
- import serial
- import time
- Print ("Start")
- port="/dev/tty.HC-06-DevB"
- bluetooth=serial.serial(port,9600)
- print("Connected"
- bluetooth.flushInput()
- for i in range(5)
- print("ping")
- bluetooth.Write(b"Boop"+str.encode(str(i)))
- input-date = bluetooth readline()
- print(input_data.decode())
- time.sleep(0.1)
- bluetooth.close()
- print("Done")
- bluetooth.Write(b"Boop"+str.encode(str(i)))
- input-date = bluetooth readline()
- print(input_data.decode())
- time.sleep(0.1)
- bluetooth.close()
- print("Done")
Output

Figure 1: Output

RajaPosted Aug 17, 2016, 5:25 AM
Nice Share...
Anbu ManiPosted Jul 17, 2016, 2:31 PM
Nice one
kalu singh raoPosted Jul 12, 2016, 1:48 AM
Nice...
Anu VPosted Jul 12, 2016, 12:20 AM
Good article.