soft-UART problems reciving data from HC-05 device

Hi every one.

Info:
Arduino ATmega2560
HC-05 Device (slave) - Default Baud: 9600

I need to be able to send data from my phone (android) via bluetooth. I use an app on the phone called: Simple Bluetooth terminal.
But i can’t recive anything…

I know that the module is correctly set up and configured.
Since I can send and receive data in Arduino IDE via serial monitor
see the pictures below:


I’ve tried copying someone else’s setup from a post on the same forum:


Link to the forum: HC-05 UART Communication

Here is the setup I made in XOD, however I can’t get it to work:

I have also tried this way, but without success:

I hope someone can help me further. It is to be used for a school project.
If you need more information, I will try to answer as soon as possible.

Thanks in advance

Hi @gamerse,

The Arduino Mega has four serial ports, so there is no need to use software serial (soft-uart). In any case, pins D18 and D19 on the Arduino Mega cannot be used for software serial (see: https://docs.arduino.cc/learn/built-in-libraries/software-serial).

Replace the soft-uart node with the uart-1 node. The uart-1 node corresponds to the 2nd serial port on your Arduino Mega (D18=TX1, D19=RX1). I don’t have a HC-05 device, so I can’t test your patch.

Hope this helps!

Hello @wayland and thanks for the fast response!

I have tested it as you suggested:


Now I can at least see that I am receiving a signal from my phone to the arduino.

When I send the number 50. The number changes from 0 to 10 in the Watch node. But the value always shows 10. even if I send other values ​​from my phone se pictures.

Any idea what could be the problem?
Many many thanks for the help

I just tested it both ways.

Using Read-line I can only receive the value if it is sent twice.

Any idea what could be causing this?

How many bytes are being sent? If more than one byte is sent, one read-byte node isn’t going to clear the is-available to cause it to pulse again.

I don’t see read-line built-in to XOD. It implies reading until a newline character, which may or may not get sent (maybe it just reads available bytes and returns string).

You could look into using read-bytes, even if only as a test to verify what is being sent. You could use clock to pulse read-bytes-READ every few seconds and see how many times output updates for a single message you are sending.

I will try it out.

Thank you for the input

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.