Jan 01, 2015 Using Software Serial I have only ever obtained 100% accurate communication when using 9600. You can confirm if the software serials are the issue by setting up a test sketch that uses the hardware serial. If this works you know the software serial is the culprit. If hardware serial gives the same errors then the problem lies elsewhere. This code is working for me on an Arduino Mini Pro (should be the same as UNO) with an HC-05. I have the HC-05 paired with my laptop. Using HyperTerminal on the COM port associated with the HC-05 and the Arduino serial console, I can send messages bidirectionally. The Serial.println statements show up in the Hyperterminal window like they should. Software Serial is a library that is part of the standard Arduino IDE. To use it you need to add the library to the sketch and them tell it the pins you want to use. Here it is being initialised with pins 2 and 3. Simple ESP8266 Arduino Uno Software Serial Integration: Our goal was to create an ESP8266 AT command library (based on the ITEAD library), that would work well on software serial on most ESP8266 devices, provided they have firmware that responds to AT commands (which is usually the manufacturer default.
Active2 years, 11 months ago
My purpose is to use Arduino to set up communication between a PC and an Android device using an HC-05 bluetooth module.
I use the USB communication between the PC and the Arduino (Serial Monitor) and a SoftwareSerial to connect to the HC-05.
My problem is that the communication works well from BT to the PC, but doesn't work as expected in the other way. When sending from the PC to BT all the characters sent are received by the BT device only when I close the Serial Monitor on the PC or when I reset the Arduino.
I've excluded a problem with the BT Module or the Android application because if in Arduino I implement an 'ECHO' code (write in Android and the send in Android) everything works fine.
With the Arduino code posted below the expected behaviour is: Arduino reset-> Hello word sent, Serial monitor opened-> nothing happens, character written on serial monitor-> character received on BT, character written on BT-> character received on Serial Monitor, Serial monitor closed-> nothing happens.
The real behaviour is: Arduino reset-> Hello word sent, Serial monitor opened-> 2 Hello word on BT and 1 ('goodnight') on PC, character written on serial monitor-> nothing, character written on BT-> character received on Serial Monitor, Serial monitor closed-> previous written character(s) in serial monitor received + Hello Word.
How can I fix this problem?
Code:
claj3,38422 gold badges2121 silver badges2828 bronze badges
user2706612user2706612
6 Answers
This code is working for me on an Arduino Mini Pro (should be the same as UNO) with an HC-05. I have the HC-05 paired with my laptop. Using HyperTerminal on the COM port associated with the HC-05 and the Arduino serial console, I can send messages bidirectionally. The Serial.println statements show up in the Hyperterminal window like they should.
imjoshimjoshArduino Software Serial Commands
3,46911 gold badge1313 silver badges2020 bronze badges
I have implemented a serial communication between Arduino Uno and PC and this was my code, hope it can help:
ddaArduino Software Serial Inverse_logic
5,53422 gold badges2020 silver badges3333 bronze badges
STiLLeNSTiLLeN9822 gold badges33 silver badges1515 bronze badges
You could try this. It's about the simplest code you can use when testing Arduino bluetooth <-> C# communication. Note: the code was tested by connecting PIN1(TX) <-> MODULE RX, PIN2(RX) <-> MODULE TX and dividing the PIN1(TX) 5V to 2,5V before feeding it to the module.
Hope this helps all that are trying this!
Community♦
jaolhojaolho
Use this serial setup. With this code I can receive and send date to bluetooth from Serial Monitor
For more information, visithttp://www.circuitmagic.com/arduino/arduino-and-bluetooth-hc-06-to-control-the-led-with-android-device/
dda5,53422 gold badges2020 silver badges3333 bronze badges
MandyMandy
I recommend to use this app for testing:
It let you see and send bytes as bytes(number from 0b00000000 to 0b11111111 (0 to 255 in decimal))so you can make a simple echo firmware to test if your baudrate is correct and with that working, begin sending commands to turn on/off some LEDs
this is an echo code example:
I hope it helps you
SebasuSebasu
Had the same problem, you have to view the BT module as 2 different baud rates on the wired side and the radio side. The radio side is set by whatever you connect at through putty, the wired side is programmed via AT commands. HC-05 defaults at 38400.
DaveeDavee