loading

The HC-05 Bluetooth module is an excellent interface for communicating with your mobile. It has a great data transfer rate and very easy to implement.

In order to try this tutorial out you will need the following:

- Any Arduino board you like and if you don’t already have one check this out

- Grab a breadboard similar to any one of these

- Get yourself one of the HC-05 Bluetooth Modules, if you don’t already have one then grab one from here

- 2 Resistors, 2K Ohm and 4.6K Ohm

- Finally grab some Dupont jumper wires or use normal wires if you are comfortable with that

It is worth noting that the HC-05 power in (Vcc) uses 5V, while the transmit and receive (TXD and RXD) logic signal uses 3.3V. Accordingly sending signals from the HC-05 module to Arduino is ok as the Arduino I/O pins can safely receive up to 5V but the issue is when Arduino tries to send the data to the HC-05 with signal level 5V, in this case it is required to use a voltage divider as we will see during the tutorial.

Also, it worth noting that the above links are for those of you guys living in Egypt, still, for those of you living abroad and want to get the components you can either drop us an e-mail to see if we can ship the components out to you or try Amazon.com:

- For Arduino OSOYOO Mini USB Nano V3.0 ATMEGA328P Module CH340G 5V 16M Micro-controller board for Arduino

- For Breadboard Solderless Plug-in BreadBoard, 830 tie-points, 2 Power lanes, 200PTS, 16.5 x 5.4 x 0.85 cm

- For HC-05 JY-MCU Arduino Bluetooth Wireless Serial Port Module

- For Dupont Gikfun 3 x 40P 20cm Dupont Wire Jumper Cable 2.54 1P-1P Male-Male/Female-Female/Female-Male EK8403

Step 1: Check breadboard power rail consistent connectivity

Get 2 dupont jumper cables, connect 1 at the rail start and one at the rail end. Now grab your voltmeter and set it on Ohm or connectivity measuring mode then connect the tips to the end of the jumper cables. Make sure that the rail is consistent.

<p>Hello to everyone.I have make a bleutooth robot which i can control it via android(tablet) and i have a problem with the code.I want from the robot to stop when connection lost or bluetooth disconnected.Now when the connection lost the robot go ahead and falls on the objects.How to add this line on the code?Can you help me please?The STATE pin of HC-05 when is HIGH is connected and when is LOW is disconnected.I put this on my code but it doesn't stop.Thank you for your time</p><p><br>The bluetooth that i use is HC-05<br><br>My code:<br><br>#include &lt;Servo.h&gt;<br><br>Servo SERVO_1; // Initialize Servo1<br><br>// Motor Control Variables<br>int PWM1 = 9;<br>int ENABLE1 = 8;<br>int PWM2 = 5;<br>int ENABLE2 = 7;<br>int PWM3 = 3;<br>int ENABLE3 = 4;<br>int PWM4 = 6;<br>int ENABLE4 = 12;<br>int STATE=2;<br><br><br>void setup() {<br> SERVO_1.attach(10);<br> Serial.begin(9600);<br> pinMode(ENABLE1, OUTPUT); //&Delta;ή&lambda;&omega;&sigma;&eta; ό&lambda;&omega;&nu; &tau;&omega;&nu; &mu;&epsilon;&tau;&alpha;&beta;&lambda;&eta;&tau;ώ&nu; &omega;&sigmaf; έ&xi;&omicron;&delta;&omicron;&sigmaf;<br> pinMode(ENABLE2, OUTPUT); //&Delta;ή&lambda;&omega;&sigma;&eta; ό&lambda;&omega;&nu; &tau;&omega;&nu; &mu;&epsilon;&tau;&alpha;&beta;&lambda;&eta;&tau;ώ&nu; &omega;&sigmaf; έ&xi;&omicron;&delta;&omicron;&sigmaf;<br> pinMode(ENABLE3, OUTPUT); //&Delta;ή&lambda;&omega;&sigma;&eta; ό&lambda;&omega;&nu; &tau;&omega;&nu; &mu;&epsilon;&tau;&alpha;&beta;&lambda;&eta;&tau;ώ&nu; &omega;&sigmaf; έ&xi;&omicron;&delta;&omicron;&sigmaf;<br> pinMode(ENABLE4, OUTPUT); //&Delta;ή&lambda;&omega;&sigma;&eta; ό&lambda;&omega;&nu; &tau;&omega;&nu; &mu;&epsilon;&tau;&alpha;&beta;&lambda;&eta;&tau;ώ&nu; &omega;&sigmaf; έ&xi;&omicron;&delta;&omicron;&sigmaf;<br> pinMode(STATE, INPUT);<br>}<br><br>void loop() {<br><br> if(digitalRead(STATE)== HIGH)<br><br> // see if there's incoming serial data:<br> if (Serial.available() &gt; 0) {<br> // read the oldest byte in the serial buffer:<br> int incomingByte = Serial.read();<br> // action depending on the instruction<br> // as well as sending a confirmation back to the app<br> switch (incomingByte) {<br> case 'F':<br> moveForward();<br> Serial.println(&quot;Going forward&quot;);<br> break;<br> case 'L' : // Case 'L' is received,<br> SERVO_1.write (180); // &Sigma;&tau;&rho;ί&psi;&epsilon; &Alpha;&rho;&iota;&sigma;&tau;&epsilon;&rho;ά.<br> SERVO_1.attach(10);<br> break;<br> case 'N':<br> turnright();<br> Serial.println(&quot;Turning right&quot;);<br> break;<br> case 'M':<br> turnleft();<br> Serial.println(&quot;Turning left&quot;);<br> break;<br> case 'O' : // Case 'L' is received,<br> SERVO_1.write (0); // &Sigma;&tau;&rho;ί&psi;&epsilon; &Alpha;&rho;&iota;&sigma;&tau;&epsilon;&rho;ά.<br> SERVO_1.attach(10);<br> break;<br> case 'B':<br> moveBackward();<br> Serial.println(&quot;Going forward&quot;);<br> break;<br> case 'P':<br> SERVO_1.write(90); // &Sigma;&tau;&rho;ί&psi;&epsilon; &Alpha;&rho;&iota;&sigma;&tau;&epsilon;&rho;ά.<br> SERVO_1.attach(10);<br> break;<br> case 'S':<br> moveNone();<br> Serial.println(&quot;Stopping&quot;);<br> break;<br> default:<br> // if nothing matches, do nothing<br> break;<br> }<br> }<br>}<br><br>void moveForward() {<br> // turn the driving motor on to go forwards at set speed<br> digitalWrite(ENABLE1, HIGH);<br> digitalWrite(ENABLE2, HIGH);<br> digitalWrite(ENABLE3, HIGH);<br> digitalWrite(ENABLE4, HIGH);<br> analogWrite(PWM1, 255);<br> analogWrite(PWM2, 255);<br> analogWrite(PWM3, 255);<br> analogWrite(PWM4, 255);<br><br>}<br><br>void moveBackward() {<br> // turn the driving motor on to go backwards at set speed<br> digitalWrite(ENABLE1, LOW);<br> digitalWrite(ENABLE2, LOW);<br> digitalWrite(ENABLE3, LOW);<br> digitalWrite(ENABLE4, LOW);<br> analogWrite(PWM1, 255);<br> analogWrite(PWM2, 255);<br> analogWrite(PWM3, 255);<br> analogWrite(PWM4, 255);<br>}<br>void turnright() {<br> digitalWrite(ENABLE1, HIGH);<br> digitalWrite(ENABLE2, HIGH);<br> digitalWrite(ENABLE3, LOW);<br> digitalWrite(ENABLE4, LOW);<br> analogWrite(PWM1, 255);<br> analogWrite(PWM2, 255);<br> analogWrite(PWM3, 255);<br> analogWrite(PWM4, 255);<br>}<br><br>void turnleft() {<br> digitalWrite(ENABLE1, LOW);<br> digitalWrite(ENABLE2, LOW);<br> digitalWrite(ENABLE3, HIGH);<br> digitalWrite(ENABLE4, HIGH);<br> analogWrite(PWM1, 255);<br> analogWrite(PWM2, 255);<br> analogWrite(PWM3, 255);<br> analogWrite(PWM4, 255);<br>}<br>void moveNone() {<br> // turn the driving motor off<br> digitalWrite(ENABLE1, 0);<br> digitalWrite(ENABLE2, 0);<br> digitalWrite(ENABLE3, 0);<br> digitalWrite(ENABLE4, 0);<br> analogWrite(PWM1, 0);<br> analogWrite(PWM2, 0);<br> analogWrite(PWM3, 0);<br> analogWrite(PWM4, 0);<br> SERVO_1.detach();<br>}</p>
<p>Cool project!</p>
Thanks bro!

About This Instructable

3,012views

36favorites

License:

Bio: TechDepot Egypt is an online retail store that sells the components to bring your electronics projects ideas to life. We are not just components sellers ... More »
More by TechDepot Egypt:Receive alerts and messages from your Arduino Mega Very Simple HC-SR04 Connection to Arduino Example Connecting HC-05 Bluetooth Module to Arduino 
Add instructable to: