Microsmooth is a lighweight signal smoothing library currently being developed by me.
It is still being worked on and the aim is to make it lightweight in terms of memory and fast. The library provides multiple filters for smoothing:
Simple Moving Average
Exponential Moving Average
Cumulative Moving Average
Savitzky Golay Filter
Ramer Douglas Pecker ...
Is PWM really a signal? To me, it looks like an electric current turned on and kept on for a certain time, then off for a while repeatedly. What makes this a "signal"?
At the most basic, it is a signal because we call it such. Even a constant voltage can be a signal, signalling that e.g. a window has not been broken. A PWM signal indicates that we want to ...
I think I see a lot of single-sample noise spikes in your noisy signal.
The median filter does better at getting rid of single-sample noise spikes than any linear filter.
(It is better than any low pass filter, moving average, weighted moving average, etc. in terms of its response time and its ability to ignore such single-sample noise spike outliers).
As far as I know, there is no library for Uno to generate such a
signal (correct me if I'm wrong)
You are wrong, there is Mozzi, the sound synthesis library for
Arduino. It works essentially along the lines sketched by uint128_t.
Take a look at the Sinewave.ino for an example on how to make a
(lookup table-based) sine wave. It can also do much more.
The Atmel ATmega328 datasheet, section 24.6.1, recommends that you drive the analog input pin with an output impedance of 10 KOhm or less. Also, it recommends that you remove high-frequency components with a low-pass filter. (That low-pass is sometimes called an antialiasing filter).
The simplest possible low-pass filter is a resistor and a capacitor.
What you want to do is integrate the flow rate vs time curve. You have to keep track of the current flow rate. You also need to choose some unit of time measurement; this depends on how often you're sampling the flow rate. For instance, if you sample it every second, then you should convert your L/hr flow rate to L/s. This means a flow rate of 10L/hr is ...
Another option is to not save the characters in buffer but instead check each one as they arrive to see if the character is the next in the tag sequence.
This has the advantage that you don't need a buffer to match the tag and you don't have to repeatedly search for the string in the buffer.
const char* TAG_STR="(__BOOK_UPLOAD_START__)";
int tag_pos = 0;
Have you tried a low pass filter? I found an example here an another one here.
Both of these libraries have a list of data being read from the analog sensor of your choice which is averaged. Every new sensor value is added to the list, and the last one is thrown out, like this:
List: 3 4 3 3 4 3 5 3 2 3 4 3
new reading added. old one thrown out
I'm adding another answer, because I don't think the core thing to grasp is mentioned, and others might benefit :)
The noise you are seeing, is actually the result of a feature of the RXB6, KSA6, and similar modules. When they see no signal, they increase gain/sensitivity until they do see a signal. The upside of this is they are very sensitive, and can ...
It's all to do with writing to the SD card.
You have a buffer of 512 bytes which is one "block" of the SD card. When you have written to the card enough to fill that buffer up it has to write that buffer to the SD card and empty the buffer so you can start filling it again.
That writing to the SD card takes time - lots and lots of time (relatively), and ...
Given the time scale of the measurements, performance is not an issue.
And since you are not computing in real-time, as the samples are being
measured, you can apply the definition of cross-correlation as is, and
compute it in a double loop. The only difficulty is figuring out that
cross-correlation may not be the proper tool for the job... and finding
There are two parts to this:
One is the creation/derivation/storage of the digital representation of a sine wave. The other is the conversion of the digital representation of a sine wave to an analog voltage (if I understand what you want).
The easiest way to obtain the digital representation of a sine wave is a lookup table. Precompute the digital values, ...
A float takes 4 bytes. You are allocating 5000 of them which is 20000 bytes. The Uno has 2048 bytes of RAM. Thus you are running out of RAM and overwriting something you shouldn't be.
As pointed out on the Arduino forum, your for loop which tests for:
i < sample2 || i >= sample2
will always be true. Of course ...
This filter library is sensitive to the timing of you calling
FilterOnePole::input(). It assumes that the delays between consecutive
calls are the same as the delays between the samples being measured.
C.f. the first statement in the method, which is a call to
micros(). The pauses between your 20-sample buffers are then
interpreted like long times during ...
If you're ok with starting with square wave signals, this can be done on an Arduino.
You need to do the following:
Configure a 16-bit Timer to CTC mode
Select the right prescaling
Add a RC low pass filter to the output and voltage divider
Configure a 16-bit Timer to CTC mode
Assuming I'm using Timer 1 and OCR1A:
TCCR1A |= (1<<COM1A0); // Toggle ...
After doing some reading here Serial.begin(): Why not always use 28800? and looking at the manual for the 168. You should be able to achieve the baud rate you want by directly programming the USAR.
According to the answer there you should be able to use miniterm to keep up with a high baud rate.
As stated there you might run into problems with computer ...
It probably has enough memory and speed to run basic object recognition software, but I there's a better solution, and that's to do your image capture and your object recognition with another device, and use the Arduino to act on the incoming data in some way. That would give you enough juice to do object tracking or searching. I plan to do this for my ...
First, I have to say I am not familiar with the Zero hardware, so I am
answering in quite general terms. Hopefully you will also get some
answers with hardware-specific information. That being said, here are my
Your approach seems reasonable to me, but you are too optimistic
regarding the achievable sampling rate.
DACs are usually fast. It's ...
No. Your question really is: Can an 8-bit processor, running at 16 MHz, with 8 KB of RAM, do image processing at an acceptable rate? Unless you are talking about 10 pixels by 10 pixels, at a frame rate of 1 frame per second, then I doubt it.
You may want to ask the "real" question. See The X-Y Problem. There are sensors around that detect colours. If you ...
First thing, you must find a way to output the samples at a steady rate.
Your best bet is to use a timer. Ideally, you want to use the same timer
used for the PWM output, in order to have them synchronized. See for
example how it is done in the Mozzi sound synthesis
Then you can lower the frequency by repeatedly outputting the same
value: if you ...
You could filter this digitally using a low pass filter:
int valueFilt = (1-0.99)*value + 0.99*valueFilt;
Change the 0.99 to change the cut off frequency (closer to 1.0 is lower frequency). The actual expression for that value is exp(-2*pi*f/fs) where f is the cutoff frequency you want and fs is the frequency the data is sampled at.
Another type of "...
One possible approach is to go for a completely software side solution.
Microsmooth is a signal processing library that I am working on that is specifically intended for low latency, low memory signal smoothing. It is still in development, but even now, most of the filters work in less than 100 microseconds per call while giving fairly good accuracy and ...
Sounds like your pots are not connected correctly and you pick up noise. The waveform you are seeing could be from the mains, or another source. Stray magnetic fields from transformers etc. can couple and be picked up by your circuit and you will notice them if your input is of high impedance. The atmosphere is also full of electromagnetic radiation from ...
For this application the Arduino YUN is the worst possible solution because
No storage (you can add a microSD card though)
The raspberry Pi 2, UDOO, RADXA, Ordio, pretty much anything with a quad core processor and 1GB of RAM will do a decent job.
Face detection is RAM intensive, so you will need to worry about it ...
There are many algorithms you can use. I would advise you to look carefully at the data and the "idle state" and see what is always different. Try everything you can think of and see what works best, or if one does everything you need just stop there.
It might be that you can just calculate if the accelerometer values go over a certain threshold, but that ...
Recommend to use a VCO PLL as external hardware device to get the wanted variable-frequency signal. The DAC output from Arduino can control the voltage to external VCO PLL module. Here is the link for an app note for VCO PLL from Vectron.
Hope it helps.
The main problem I guess you are suffering from is the good old delay() blockage.
delay() is a terrible function and should be avoided at all costs. Nothing at all can happen while you are running delay() - that means you can't be reading the state of your button - until all your delay() calls have finished.
If you want to queue the pressed of the button ...
Confirm with an oscilloscope
When I connect my function generator I usually always make sure that the output is in the range 0 to 5V, with my oscilloscope. The default is probably more like ±2.5V - but I don't have an Agilent so you would have to check. Press the Ampl button to check. (Mine reads 5VPP).
You can see from the above image that we indeed have ...
You can get a very fast, accurate, and compact sin(theta) function using a simple table of values. Just pull the code you need from the cordic.c here: https://people.sc.fsu.edu/~jburkardt/c_src/cordic/cordic.html. C runs in Arduino sketches almost out of the box. You may or may not need some things from the cordic.h. That's why I said "almost". The ...
In a recent comment, you posted a link to a forum thread with the
code for reading the sensor. You should have provided this information
up front, because it completely changes the problem. It appears that the
flow meter sends pulses at a frequency proportional to the volume flow,
and the code uses an interrupt to count the pulses over a specified