PC to Bluetooth (with Arduino) does not work when USB is unplugged

If I use 0,1 pins instead of 2,3 the LED never lights.

RX on HC05 goes to designated TX pin on Arduino.
TX on HC05 goes to designated RX pin on Arduino.
If it’s not hooked up this way; LED never lights.

I’m unable use Serial Monitor in Arduino IDE when Processing app is running. This line of code sends commands back to Processing so we know that whatever was sent actually did get there and was processed:

BTSerial.println(value); // Send back what you received.

Hi
If your Bluetooth 3.3 volt

Need to add a voltage divider to reduce the 5V voltage from Arduino. (resistor 1k between pin3 and Rx; 2k Ohm between Rx and GND).

Some folks say you need a voltage divider and others don’t mention it. I’ve seen Fritzing diagrams without it. As I stated, I have never used one for HC05 and I’m still waiting on it to burn up. The only reason I use HC05 is just so I can answer questions in this forum. Normally I use an Adafruit EZ-Link Bluefruit Shield on an UNO and don’t worry about any of this.

1 Like

Only one application can use the serial port at a time. If you want to run your Processing “sketch”, you’ll have to close the Serial Monitor first, and vice versa.

That does not mean that it should not be implemented.

and vice versa

That makes no sense to me.

That does not mean that it should not be implemented

When it burns up I’ll add it for the next one I buy.
.

I do not understand what you mean.

You can’t use the Serial Monitor while the Processing app is using the Arduino. What would ‘vice versa’ be?

Vice versa would mean that you can’t use the Processing sketch while the Serial Monitor is open.

you can’t use the Processing sketch while the Serial Monitor is open.

What could I learn from opening the Arduino IDE with the code that I posted and starting the Serial Monitor? The code does nothing unless it gets input from the Processing app.

You can simulate your Processing sketch when using the Serial monitor.

The way I usually work when I use text based serial communication.

  1. Write an Arduino sketch in the Arduino IDE.
  2. Debug it using Serial Monitor.
    This includes having test cases with data that you want to send from the Processing sketch to Arduino (your ‘h’ in this case).

Once the above works to my satisfaction, for your scenario I first want to know if I can communicate over Bluetooth.

  1. Hook up the Bluetooth module to pins 0 and 1 of the Uno (1).
  2. In the Arduino IDE, change the serial port to the one that is the Bluetooth connection. Note that you can’t upload via Bluetooth, for that you have to disconnect the module and select the original port in the Arduino IDE.
  3. Repeat the test cases using Serial Monitor…

Only once this is all done with success I concentrate on the PC application (Processing sketch in this case).

Note 1
On Uno / Mega / Pro Mini / Nano, USB communication is done via a TTL-to-USB converter that is connected to pins 0 and 1. On other boards (e.g. Leonardo, Micro, Pro Micro, Nano Every), USB communication does not involve pins 0 and 1

Thanks for outlining your technique. As I mentioned in a previous post adding the following line of code obviates the need for SerialMonitor because the Arduino input is immediately sent back to the Processing app so that we can see what was sent and received.

For some reason only SoftSerial works with HC05 on my system. I don’t know why I’m unable to use pins 0,1 and ‘regular’ Serial. It works fine with SoftSerial and pins 2,3.

Normally I use an Adafruit Bluefruit EZ-Link shield on an UNO for bluetooth communication and there is no need to hook up anything. As far as writing bluetooth classic code that the rest of the world can use, it is using HC05 in most cases. To complicate things further Adafruit has temporarily halted production while they add more improvements so it does me no good to create videos with their product because it is unavailable to the rest of the world. In the meantime I’m stuck trying to use an HC05 which I have far less experience with. It is much easier to slap a shield on an Uno and be ready to go.