I have a simple script that listens on pin 0 for input, and if it gets anything, it Serial.prints it. But I cannot make sense of the results. I have a basic app that sends text over Bluetooth (in the code I see utf8.encode(message) if that helps), and I'm able to validate that the message is not corrupted by the module, by simply touching the RX and TX pins together, the app receives the same message it sent. But the Arduino cannot understand it.

Here's my code:

void setup() {

void loop() {
    if (Serial.available() > 0) {
        Serial.print("New value: ");

The TX on the HC-01 is connected to pin 0, and the RX is connected to pin 1. Power and ground are connected to the Arduino's (and I even tried different grounds just in case that one was fried). The Arduino is powered by USB and I'm using the Serial moniter. Here is some sample input-output:

Me through the app: a. Arduino: 255
Me through the app: a. Arduino: 254
Me through the app: a. Arduino: 254
Me through the app: a. Arduino: 254
Me through the app: a. Arduino: 254
Me through the app: a. Arduino: 255
Me through the app: aa. Arduino: 254
Me through the app: aaa. Arduino: 252
Me through the app: aaaa. Arduino: 252

I just don't understand any of it. Please help me out.

  • What is the model if the arduino you are using? On some pins 0 and 1 are also connected to the USB port connected to your PC. If this is the case you may have a conflicted usage of the port. – GMc Aug 7 at 22:14
  • So should I take out the USB and just power with a battery? I can also have like an LCD print the value. Would that work? – Levi Lesches Aug 7 at 22:21
  • And for reference, I'm using the latest UNO and kept pin 1 disconnected for that reason – Levi Lesches Aug 7 at 22:21
  • So how did you disconnect pin 0 from the USB? Remeber the PC will be sending a signal on this connection which will likely interfere with the signal coming in from the HC-01. Even if there is no USB activity it will still be LOW or HIGH electrically. FWIW, in your question you imply both TX and RX on the HC-01 are connected to pins 0 and 1 on the arduino. Did you try using a mega or leonardo (Serial1 for the HC-01) if you have them? Or possibly SoftwareSerial on Uno (again FWIW I have never successfully got s/w serial to work reliably but it should be ok for testing) – GMc Aug 7 at 22:34
  • You may have better luck with the LCD Approach, but it will be harder to debug (no serial monitor). If you have a mega (or something else with two serial ports) life might be easier at least in the "WTF is going on here? phase you are in right now! In my case I always use my leonardo to test bluetooth, xbee and similar "Serial devices" then if appropriate move it over to Uno (cos I've got lots of them) for "production". – GMc Aug 7 at 22:36

Your Answer

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

Browse other questions tagged or ask your own question.