Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: emmannuel on June 21, 2008, 04:27:23 PM

Title: Sensors and RC Circuits
Post by: emmannuel on June 21, 2008, 04:27:23 PM
So I'm finally done with the construction of my robot and working with the final bits and ends making sure everything works before I move on to strictly software.

I noticed when I designed my sensors circuits I didn't pay attention to noise on the ADC outputs.  So I am seeing values that are changing often when they shouldn't be.

My sensors are 3 Sharp IR Range Finders and a temp sensor, and a AD22100 Temp sensor.

After some research I found the documentation I needed but I'm not 100% clear on it.

For the temp sensor I want to use a 1k ohm resistor with a 0.1uF cap as a low pass filter.
For the Range Finder I want to use a 530 resistor and a 10uf cap in parallel? From http://www.societyofrobots.com/robotforum/index.php?topic=2712.msg32989#msg32989
Could someone explain me this cause I thought to remove noise the best option was to have a low pass filter.

Thanks!
Title: Re: Sensors and RC Circuits
Post by: izua on June 21, 2008, 07:00:35 PM
It really depends on your noise source.
Keep analog traces away from digital ones, have a very, very clean analog reference (caps, chokes), and remember to take several samples before offering a value to the higher layers.
Also, remember to have caps on the supply pins of all devices, I header the sharps are picky with current when it comes to the first pulse (not sure if IR or sonar, though)

by the way, I don't know that filter frequency, but it must be calculated. a low pass filter will also limit the available frequency of your sensor (you won't be able to take 1000 samples per second, but only 10. Even if you take 1000, only 10 times they will be updated. In theory, at least).
Title: Re: Sensors and RC Circuits
Post by: emmannuel on June 21, 2008, 07:13:57 PM
Thanks izua, and I just got done thanking you on another post :P

The low pass filter should be fine with slow refresh because its going to be temp readings, I don't expect them to change much/frequently.

I made sure to cap the input voltage for the supply pins just didn't think about the outputs :P
Title: Re: Sensors and RC Circuits
Post by: izua on June 21, 2008, 07:22:20 PM
What noise figures are you getting, anyway? Rail to rail?
Title: Re: Sensors and RC Circuits
Post by: emmannuel on June 21, 2008, 07:39:59 PM
I don't have an Oscope to be really accurate I've just polled the sensors a few times and noticed the numbers changing when they shouldn't.

I also wonder if maybe I've set something wrong on my getADC code on the AVR.  I need to do some more research on what the ADC clock frequency should be set to maybe.
Title: Re: Sensors and RC Circuits
Post by: izua on June 21, 2008, 07:45:32 PM
well yes, but how much?
don't expect a completly linear output from your sensor. maybe it is accurate and your body senses data slower than them.
also, remember that those IR sensors have a range, IIRC.
Title: Re: Sensors and RC Circuits
Post by: emmannuel on June 21, 2008, 08:11:55 PM
I'm getting numbers that jump +/- 0-40 of the digital value it should be.

Title: Re: Sensors and RC Circuits
Post by: izua on June 21, 2008, 11:36:46 PM
ouch. 8bits or 10bits ADC?
that shouldn't be happening anyway. are you sure your uc is not resetting?
Title: Re: Sensors and RC Circuits
Post by: ALZ on June 22, 2008, 01:15:41 AM
If you don't have a scope the best thing you can do is put a pot across your power rails and one leg to the ADC and see what happens to your reading. If the reading stay ok then put the IR senser to the power and see what happens. This way you can see if the IR senser is putting noise on the power rails.


I'm getting numbers that jump +/- 0-40 of the digital value it should be.


Title: Re: Sensors and RC Circuits
Post by: emmannuel on June 22, 2008, 02:38:17 AM
Yeah cause the values I was getting were so off I decided to look into the code I was using for the ADC conversion.

I believe it wasn't working right cause it was for a mega16 I was using before and I have since switched to mega8.

Now getting a more reasonable +/- 4 :D

Thanks for the help izua.

So like it was mentioned on the post post I linked I'm going to get a few samples and average them.

Thats a cool idea ALZ I will make sure to use that.
Title: Re: Sensors and RC Circuits
Post by: bens on June 22, 2008, 03:19:10 AM
Don't put a resistor in parallel with your Sharp sensor.  Put at least a 10 uF capacitor across power and ground somewhere near each of your sensors (the closer the better).  This is recommended in the Sharp sensor's datasheet as these sensors pull a lot of current while they are pulsing, which adds a lot of noise to your system.  When reading data from the Sharp sensors, my recommendation is that you always average at least a few values (my rule of thumb is to never use a single ADC conversion value--I always average at least four to make sure I'm not catching a noise spike, and I average more if I can spare the time).

I know others here disagree with this approach, but it's the one I use and I have gotten great, fairly noise free results from my Sharp sensors by doing this.

- Ben
Title: Re: Sensors and RC Circuits
Post by: emmannuel on June 22, 2008, 04:44:50 AM
Don't put a resistor in parallel with your Sharp sensor.  Put at least a 10 uF capacitor across power and ground somewhere near each of your sensors (the closer the better).  This is recommended in the Sharp sensor's datasheet as these sensors pull a lot of current while they are pulsing, which adds a lot of noise to your system.  When reading data from the Sharp sensors, my recommendation is that you always average at least a few values (my rule of thumb is to never use a single ADC conversion value--I always average at least four to make sure I'm not catching a noise spike, and I average more if I can spare the time).

I know others here disagree with this approach, but it's the one I use and I have gotten great, fairly noise free results from my Sharp sensors by doing this.

- Ben

Yeah I have a few 22uF caps on hand I'm going to put I currently have 0.1uF. Thanks