# Binary Buffer to Strings while using serial port

**URL:** <https://discourse.nodered.org/t/binary-buffer-to-strings-while-using-serial-port/42908>\
**Category:** General\
**Created:** [19 March 2021 23:02 UTC](https://discourse.nodered.org/t/binary-buffer-to-strings-while-using-serial-port/42908 "2021-03-19T23:02:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathur27](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Mathur27](https://discourse.nodered.org/u/Mathur27)\
**Post date:** [19 March 2021 23:02 UTC](https://discourse.nodered.org/t/binary-buffer-to-strings-while-using-serial-port/42908/1 "2021-03-19T23:02:12Z")

</div>

Hello,  
I am trying to get input from the "Serial in" node.

The correct output is : "aa a1 41 0b 63 01 40 2d 93 d1 cc 00"

I have tried transmitting the input as a normal "ASCII string", but the result is "�h-c@��t �h-c@��t".

I have now trying to get it in the form of a "binary buffer". I do get a result, which is :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/ca612bf9c14b644a157fb08f3684578525a23d2d.png)

I am not sure how I can convert this buffer to a regular string which I can format and then send as a payload to my other nodes.  
I have already tried some functions like "payload.toString()" and  
"Buffer.from(msg.payload, "hex").toString().  
But both these functions also give me output "�h-c@��t �h-c@��t".

How can I get the correct output?

Can anybody help me?

Thanks

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [19 March 2021 23:17 UTC](https://discourse.nodered.org/t/binary-buffer-to-strings-while-using-serial-port/42908/2 "2021-03-19T23:17:40Z")

</div>

Hi normally I would suggest using buffer parser node but I can't make sense of your data. What is sending it? And what is it supposed to be telling you?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [20 March 2021 07:40 UTC](https://discourse.nodered.org/t/binary-buffer-to-strings-while-using-serial-port/42908/3 "2021-03-20T07:40:19Z")

</div>

They look like 8 bytes packets separated by a byte 'aa' so I would set it to wait for that and then length 8

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [19 May 2021 07:40 UTC](https://discourse.nodered.org/t/binary-buffer-to-strings-while-using-serial-port/42908/4 "2021-05-19T07:40:20Z")

</div>

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