# Extract voltage value only from ADS1x15

**URL:** https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647
**Category:** General
**Created:** [10 November 2020 05:09 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647 "2020-11-10T05:09:49Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [10 November 2020 05:09 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647/1 "2020-11-10T05:09:49Z")

</div>

So i have the a/d outputing this: { ADS1115 • I2C\_ADDRESS\_0x48 • Channel A0-GND • Voltage: 3.2901004058961765 }  
But i just want the message.payload to be the numerical voltage value so i can drive a guage with it, how?

---

<div class="post-metadata">

### Author: ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)
#### Post date: [10 November 2020 05:31 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647/2 "2020-11-10T05:31:15Z")

</div>

That can be achieved by the `change` node, as documented here: [https://nodered.org/docs/user-guide/messages#changing-message-properties](https://nodered.org/docs/user-guide/messages#changing-message-properties)

Something like `msg.payload.Voltage` in the "to" line should do the trick. Be aware that object properties are case-sensitive.

---

<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: [10 November 2020 09:08 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647/3 "2020-11-10T09:08:47Z")

</div>

If that doesn't work then feed the message into a debug node and show us exactly what it shows.

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [11 November 2020 01:54 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647/4 "2020-11-11T01:54:29Z")

</div>

Here is the debug result

{"ADS1115 • I2C\_ADDRESS\_0x48 • Channel A0-GND • Voltage":3.2901004058961765}

---

<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: [11 November 2020 09:18 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647/5 "2020-11-11T09:18:27Z")

</div>

If you look in the node-red docs [Working with Messages](https://nodered.org/docs/user-guide/messages) (as @kuema suggested) it shows you how you can use the buttons in the debug pane get the path to a property. In this case the path will be something like  
`msg.payload["ADS1115 • I2C_ADDRESS_0x48 • Channel A0-GND • Voltage"]`

I would first attempt to persuade whatever node or device you are getting that from to give you a more useful property name such as "voltage". Then you would be able to use `msg.payload.voltage` which is much easier to type. If you want to include information about what the value refers to then the convention is to use the topic for that, and I wouldn't use special characters in there if you can avoid it, it just makes life more difficult.

---

<div class="post-metadata">

### Author: ![rmystique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rmystique/32/84365_2.png) [@rmystique](https://discourse.nodered.org/u/rmystique)
#### Post date: [12 November 2020 04:32 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647/6 "2020-11-12T04:32:05Z")

</div>

> [@Colin](#):
>
> msg.payload["ADS1115 • I2C\_ADDRESS\_0x48 • Channel A0-GND • Voltage"]

That did the trick , thank you

---

<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 January 2021 04:32 UTC](https://discourse.nodered.org/t/extract-voltage-value-only-from-ads1x15/35647/7 "2021-01-11T04:32:06Z")

</div>

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