# Removing certain frequencies from data

**URL:** https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742
**Category:** General
**Created:** [20 April 2023 13:38 UTC](https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742 "2023-04-20T13:38:42Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![madeline](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@madeline](https://discourse.nodered.org/u/madeline)
#### Post date: [20 April 2023 13:38 UTC](https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742/1 "2023-04-20T13:38:43Z")

</div>

Hello everyone,

I am collecting data from a load cell, but it is being corrupted due to an unfixable hardware issue.

The corruption comes in the form of turning the data into a baseline sine wave, but it still increases/decreases with force applied to the cell.

Is there a node I can use to detect the frequency of the sine wave and flatten the data to just the useful stuff?

Thanks in advance for your help,  
Maddie

---

<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: [20 April 2023 14:15 UTC](https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742/2 "2023-04-20T14:15:23Z")

</div>

> [@madeline](#):
>
> Is there a node I can use to detect the frequency of the sine wave

You could try importing [pitchfinder](https://www.npmjs.com/package/pitchfinder) in a function node and use it to detect the frequency. Never tried!

---

<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: [20 April 2023 14:39 UTC](https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742/3 "2023-04-20T14:39:55Z")

</div>

> [@madeline](#):
>
> Is there a node I can use to detect the frequency of the sine wave and flatten the data to just the useful stuff?

Do you mean you want to smooth the data so that it shows the average of the sine wave? If so then possibly node-red-node-smooth will help.

---

<div class="post-metadata">

### Author: ![madeline](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@madeline](https://discourse.nodered.org/u/madeline)
#### Post date: [20 April 2023 15:26 UTC](https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742/4 "2023-04-20T15:26:04Z")

</div>

Hi Colin,

I want to smooth out the general noise so i will, but there is an around 10second sine wave along all of the data. When there are spikes of force this just gets added to the sine wave, as if it is a baseline. therefore i would just like to remove the sine wave and bring it back to the data it should be .

---

<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: [20 April 2023 15:36 UTC](https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742/5 "2023-04-20T15:36:40Z")

</div>

That is incredibly difficult to do, it is just down to the maths, not a node-red problem. If you know exactly the frequency of the signal you might be able to us some sort of notch filter, but I don't hold out much hope of success.  
Is the frequency of the sine wave known exactly, and constant? Is it of constant amplitude? If so then you might be able to use a generated compensation signal to subtract from the data. Alternatively you could record significant periods and then analyse the data retrospectively to determine the sine wave parameters and then subtract it. It is a pretty complex data analyses problem, that is above my maths knowledge. I think you might have to consult an expert in such things if this is critical to you. As I said, the problem isn't how to do it in node-red, but how to do it at all.

---

<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 June 2023 15:36 UTC](https://discourse.nodered.org/t/removing-certain-frequencies-from-data/77742/6 "2023-06-19T15:36:47Z")

</div>

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