I'm using four of these load cells wired in parallel and connected to an ADS1232. Overall the device (scale) is working well, but I am seeing a strange signal over a period of a few minutes after I turn the scale on. I have the ADS1232 hooked as in this schematic:
I have the ADS1232 wired to output 10 sps which go to a MCU that does a moving average over 32 samples (3.2 s window). When I start the scale and record the output from this filter I see the following signal (purple line):
I have seen the same signal a few times now. It seems to go away after appearing once on startup.
Does anyone have any ideas as to what could be causing this signal?
Edit: Here is the code for the moving average filter (N = 32 in this case). The Input
method is passed a new sample every 0.1 s.
**
template<size_t N>
class MovingAverageFilter {
double samples_[N];
size_t write_;
double sum_;
double average_;
public:
/*initialize a filter with the necessary parameters*/
MovingAverageFilter(double init = 0)
: samples_{0}, write_(0), sum_(init * N), average_(init) {
Reset(init);
}
/*clear buffers*/
void Reset(double init = 0) {
for (auto &i : samples_) {
i = init;
}
sum_ = init * N;
average_ = init;
}
/*input a new value*/
double Input(double input) {
auto oldest = samples_[write_];
sum_ -= oldest;
sum_ += input;
samples_[write_] = input;
write_++;
write_ %= N;
average_ = sum_ / N;
return average_;
}
/*get the last output*/
double LastOutput() const {
return average_;
}
/*get the last input*/
double LastInput() const {
auto index = (write_ - 1) % N;
return samples_[index];
}
};
**