Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Sensor filtering

2005-09-11 by Russell Shaw

Gustavo Goretkin wrote:
> I have kind of had this problem for a little while, I am assuming your 
> accelerometer is on from Analog Devices and also outputs a PWM wave just 
> like the analog signal. I haven't figured out a way to measure like 4 
> PWM waves, out of phase (possibly) in my application. I am afraid that 
> when I do the counting, an interrupt might occur and I will have obscure 
> results. I cannot disable the interrupts temporarily because the 
> interrupts are needed, all the time (one of them generates PWM signals 
> for servos, the other counts encoder clicks, etc) I am implementing this 
> on an ATmega16. Does anyone have a clue as to how I would go about it?

You could make your other interrupts reentrant by the pwm interrupt.
Do the minimum stuff in interrupts to minimize jitter problems.
With multiple pulse sources, you really need external hardwired
logic or a cpld/fpga.

> Is there a way to filter the noise from the motors out of the Accel
> signal through CodevisionAVR?

Feed the pulses thru an RC lowpass filter with the lowest cutoff
sensible, then feed thru a comparator with hysteresis.

> I think you could average your results, do you need to have a high 
> sample rate? It also might be the AVR's internal ADC, the motor migth be 
> generating a lot of noise on the power supply
> 
> michaelsteinbach wrote:
> 
>>I have a circuit with an Accelerometer connected to an ATmega32.  The
>>Accel measures 2.5V at rest and goes to .5v or up to 4.5v when tilted.
>>The motors I am using on this bot cause vibrations when running and I
>>can't get a clean signal fromt he Accel.

Mount the sensor assembly on a lead weight, then fasten that
with a soft rubber block with adequate damping coefficient.

>>Is there a way to filter the noise from the motors out of the Accel
>>signal through CodevisionAVR?

You can do box or exponential averaging.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.