Beginners: please read this post and this post before posting to the forum.
0 Members and 2 Guests are viewing this topic.
Actually I did not put a cap on the power line. I powered it with +5V from USB on my computer. I think I posted this somewhere else but the Sharp IR sensors seem to take large bursts of power that causes the microcontroller to reset.
1) Processing time, your microcontroller has to take multiple readings and then figure out which readings to average.
2) Sensor changes, if you take readings while the sensor is changing its output then you will get the wrong data.
Webbot I think the best solution is to use a combination of both. Ben is right ADC should be sampled more then once, but you should also have the cap/resistor combo to prevent the spikes as they will throw your average off. The larger spikes got up to 2V more then the correct reading.
Admin you said your scope could not find a pattern in the spikes. When I set mine to peak detect it found that the spikes happen at around 1KHz. Each spike has the same shape a little spike flowed by a -320mv drop, then the larger spike that has a tail that lasts for about 1.5us. The whole glitch has a length of 1.75us.
It seems to me like the easiest way to deal with noise from the sharp sensors would be to simply average readings over perhaps a 10 ms period.
Request to AdminThere seems to be an endless number of threads covering Sharp IR detectors, noise etc. Some give potential solutions in hardware (with caps and resistors) and others give noise filtering solutions in software. It would be good to try and consolidate all this into "best practice" in the tutorials to try and consolidate all these threads and "head off" new ones with some kinda generic approach.Appreciate your busy - but a holistic solution, that can be referenced in posts, will help us all trying to keep disparate threads up to date and cross referenced. As I understand it - this problem is common to all Sharp I/R devices - so it's not like we need different info for each device.
But the duration of the spikes is miniscule compared to the noise-free portion of the signal, so their effect on the average will pretty much be negligible (assuming your ADC sample rate is around 10 kHz, so you get plenty of samples in your average).
Which one works best for you will depend on whether you'd rather sacrifice a few CPU cycles or modify your hardware/sacrifice prototyping space.
Too processor intensive . . . and if you have a low sample rate, and a large spike gets into your average, it will throw it off.
The capacitor is doing in hardware the exact same thing as a software average (assuming you have enough data points in your average to approximate the continuity of an integral).
My plan was to solder the resistor + cap directly onto the back of the sensor. Probably 10 min of work tops Grin
That is not true at all. It would only be true if you did not have the resistor in parallel with the capacitor. When there is a spike the capacitor absorbs it and there is only a little increase in voltage. Then the capacitor is allowed to discharge the spike though the resistor effectively reducing noise and keeping the original signal.
Bens would that be so hard? You could get a surface mount capacitor and resistor that would fit right between the pins.
Yea but software has a limited sample rate, and takes at least "2%" of processing
Anyway there is another point missed: that noise is going to interfere with other nearby sensors
The mean is the average so that is what you would get with the microcontroller if you manage to get 1GS/s. (thats what the scope is )
You definitely don't want a pull-down resistor on an analog voltage signal.
I know that it is dropping the signal but it makes the fall time a lot shorter.
Is the black case even conductive? I though it was some sort of plastic. How would you go about grounding it?Thanks for the suggestion!