# soft-UART problems reciving data from HC-05 device

**URL:** <https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709>\
**Category:** XOD Programming Questions\
**Created:** [November 11, 2023, 9:40pm UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709 "2023-11-11T21:40:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gamerse](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@gamerse](https://forum.xod.io/u/gamerse)\
**Post date:** [November 11, 2023, 9:40pm UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709/1 "2023-11-11T21:40:28Z")

</div>

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:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/f/f6acfcc52e5c0dcb210774300ea7405544443f06.png)  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/4/4040687821dc47cc81e704ae5343cf6ae5f1e803.jpeg)

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/d/d654dc520111a939aa8392d61f446a4afd95cbff.png)  
Link to the forum: [HC-05 UART Communication](https://forum.xod.io/t/hc-05-uart-communication/4210)

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/0/092d6709989e34715d8b8f06e7c7a99afe4c002c.png)

I have also tried this way, but without success:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/9/94c21e07a211f7e76faae14fa366adac3141e006.png)

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

---

<div class="post-metadata">

**Author:** ![wayland](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/wayland/32/1590_2.png) [@wayland](https://forum.xod.io/u/wayland)\
**Post date:** [November 11, 2023, 11:42pm UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709/2 "2023-11-11T23:42:47Z")

</div>

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](https://docs.arduino.cc/learn/built-in-libraries/software-serial)).

Replace the **soft-uart** node with the [uart-1](https://xod.io/libs/xod/uart/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!

---

<div class="post-metadata">

**Author:** ![gamerse](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@gamerse](https://forum.xod.io/u/gamerse)\
**Post date:** [November 12, 2023, 9:02am UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709/3 "2023-11-12T09:02:27Z")

</div>

Hello @wayland and thanks for the fast response!

I have tested it as you suggested:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/7/73c53b9bcdcd03caed3554f52223e2ddcd9beac5.png)  
 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/0/05da60f7d903015bb29ee02355fa222f1c42eaa3.jpeg)

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

---

<div class="post-metadata">

**Author:** ![gamerse](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@gamerse](https://forum.xod.io/u/gamerse)\
**Post date:** [November 12, 2023, 9:11am UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709/4 "2023-11-12T09:11:31Z")

</div>

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?

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/1/11bf6cab1138cfc45fada7b18513c998dd08a320.png)

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/2X/2/247415760be1a155e08fd6c68a68df27a0733640.jpeg)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [November 13, 2023, 7:39pm UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709/5 "2023-11-13T19:39:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gamerse](https://avatars.discourse-cdn.com/v4/letter/g/dfb087/32.png) [@gamerse](https://forum.xod.io/u/gamerse)\
**Post date:** [November 18, 2023, 8:48pm UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709/6 "2023-11-18T20:48:54Z")

</div>

I will try it out.

Thank you for the input

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [December 18, 2023, 8:49pm UTC](https://forum.xod.io/t/soft-uart-problems-reciving-data-from-hc-05-device/6709/7 "2023-12-18T20:49:24Z")

</div>

Closed on December 18, 2023, 8:49pm UTC

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