Get the SoR Robotics Android App on Android Market for FREE. See this forum post for details.
0 Members and 2 Guests are viewing this topic.
Just an idea: Place a smaller capacitor ( 22pF or something), this will cause the sensor to react much faster.
hey stt585,you have probably tried this already buthave you tried testing your setup with a voltage divider in place of your sensor to test all the other components in your circuit?there are a lot of places noise can creep in and it's worth ruling them out before you blame the sensor.making sure i'm leaving enough time for my microcontrolers ADC to stabilise before taking a reading has caused me problems in the past.shielding (or shortening) sensor wires is worth trying as well.dunk.
you can also use the sensor stand alone for a quick test setup, and then see if the spikes are still present. If they aren't, the problem isn't your sensor.
a microcontroller could simply take multiple readings and discard the highest value to eliminate spikes.
So this led me to believe that there are short lived spikes going on. So oscoping it, I got the attached image. I took this reading right from the sensor output bypassing the wires. Those spikes happened no matter what was in front of the sensor. My oscope autoset couldn't find a pattern in the spikes.Odd . . .
I don't know how to explain those larger sporadic spikes . . . maybe ambient IR noise?
But those smaller ones closer to the signal--do they occur at intervals of approximately 40 ms?
Is that what DIV does, or does it change the A/D conversion clock…
// A2D clock prescaler select// *selects how much the CPU clock frequency is divided// to create the A2D clock frequency// *lower division ratios make conversion go faster// *higher division ratios make conversions more accurate#define ADC_PRESCALE_DIV2 0x00 ///< 0x01,0x00 -> CPU clk/2#define ADC_PRESCALE_DIV4 0x02 ///< 0x02 -> CPU clk/4#define ADC_PRESCALE_DIV8 0x03 ///< 0x03 -> CPU clk/8#define ADC_PRESCALE_DIV16 0x04 ///< 0x04 -> CPU clk/16#define ADC_PRESCALE_DIV32 0x05 ///< 0x05 -> CPU clk/32#define ADC_PRESCALE_DIV64 0x06 ///< 0x06 -> CPU clk/64#define ADC_PRESCALE_DIV128 0x07 ///< 0x07 -> CPU clk/128
1) The reference voltage used by the ADC. On my board (Baby Orangutan AVR board) the reference voltage is 5V. But the max signal range is from 0v to 2.45V, so top 2 bits are wasted.
what about this 5usecs? is it after the 50usecs of setteling or before the things settels?
loop ~6 times:take_readingdelay(1 ms)store valuecompare valuesdelete spike value(s)average remaining values
i suppose the sensor is moved
Admin, I recommend putting this on the IR sensor page.