I am making and robotic arm by using arduino and hc - 05 module and controlling that arm using mobile application now problem what i am facing is the mobile app dose not connect to bluetooth device whenever i run the following code


but when i run different code the bluetooth get connects with the app and runs withoutany error can anyone help me to figure it out



What i have learnt working with HC-05 modules is that communicates through its RX/TX lines at 9600 baud. But, if you need to send/receive AT commands, then the baud rate needs to be 38400 and needs to have the EN pin driven high on startup. I haven't checked the rest of your code, but since you are not programming using AT commands, then the baud rate needs to be set to 9600 with only VCC,GND,RX,TX lines connected to the microcontroller.

HC-05 works best with Arduino's native serial port. My personal experience is that HC-05 struggles to maintain stable connection with SoftwareSerial library. Although HC-06 works with SoftwareSerial with no problems.

  • \$\begingroup\$ i have change to 9600 still it is not working \$\endgroup\$ – Muhammed Aug 16 '20 at 6:58
  • \$\begingroup\$ @Muhammed, what mobile app are you using? Are you on Android or Apple? \$\endgroup\$ – David Norman Aug 16 '20 at 7:03
  • \$\begingroup\$ bluetooth terminal \$\endgroup\$ – Muhammed Aug 16 '20 at 7:04
  • \$\begingroup\$ @Muhammed, what is this different code that makes Bluetooth work? \$\endgroup\$ – David Norman Aug 16 '20 at 7:08
  • \$\begingroup\$ this code pastie.org/p/3OlqQnMR3VE4h4Oqs3iRHs \$\endgroup\$ – Muhammed Aug 16 '20 at 7:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.