# Is there a range limit for node-red-contrib-i2c 'i2c out' node?

**URL:** <https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458>\
**Category:** General\
**Created:** [12 August 2020 07:29 UTC](https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458 "2020-08-12T07:29:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 August 2020 07:29 UTC](https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458/1 "2020-08-12T07:29:41Z")

</div>

Is there a range limit for node-red-contrib-i2c 'i2c out' node payload value? Looking at the NR module node code I don't any defined limit for a single byte value to be defined as signed? It should be unsigned 0-255. for example, using a tsl2591 sensor, to fully power up the sensor, you have to send a byte value of 147. However, this generates the following error:

```auto
"RangeError: The value of "value" is out of range. It must be >= -128 and <= 127. Received 147"

```

This appears to be a limitation from the underlying node module 'i2c-bus' right?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 August 2020 07:56 UTC](https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458/2 "2020-08-12T07:56:51Z")

</div>

I don't know the answer to the question but if you need a workaround you can use  
`msg.payload = msg.payload > 127 ? msg.payload - 256 : msg.payload`

---

<div class="post-metadata">

**Author:** ![rei\_vilo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rei_vilo/32/162_2.png) [@rei\_vilo](https://discourse.nodered.org/u/rei_vilo)\
**Post date:** [12 August 2020 10:00 UTC](https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458/3 "2020-08-12T10:00:11Z")

</div>

Some time ago, I opened an issue [Signed integer only as payload for I²C out node? #26](https://github.com/nielsnl68/node-red-contrib-i2c/issues/26) at the GitHub repository and suggested the same temporary workaround.

As of today, the issue remains unanswered.

It seems that Dceejay is the [new maintainer](https://github.com/nielsnl68/node-red-contrib-i2c/issues/31) of the node.

---

<div class="post-metadata">

**Author:** ![Nodi.Rubrum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nodi.rubrum/32/107482_2.png) [@Nodi.Rubrum](https://discourse.nodered.org/u/Nodi.Rubrum)\
**Post date:** [12 August 2020 13:39 UTC](https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458/4 "2020-08-12T13:39:27Z")

</div>

Thanks for the work around. Will try it of course. I contacted the code maintainer of i2c-bus library and he believes this is within the NR node, not the base library, and I walked most of the code of the i2c-bus base library, and did not find any comparable limit either.

---

<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:** [12 August 2020 14:37 UTC](https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458/5 "2020-08-12T14:37:10Z")

</div>

Currently on vacation, but Pull requests can still be submitted

---

<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:** [11 October 2020 14:37 UTC](https://discourse.nodered.org/t/is-there-a-range-limit-for-node-red-contrib-i2c-i2c-out-node/31458/6 "2020-10-11T14:37:18Z")

</div>

Closed on 11 October 2020 14:37 UTC

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