Different sensors on one arduino (reliability)

Hi there,

I'm using and going to use different sensors on my arduino, such as the Sharp infrared and the Maxbotix EZ0/1 sonic. Both work a charm with code floating on the 'web.

I recently loaded my Arduino with Firmata to allow processing to handle all the code. This works just fine as well.

However, I might've been a bit overzealous trying to get the maxbotix as well as the sharp running on the same board. Sure, i get readings from both plugged into 5v via breadboard and analog pins 0 and 5, but they seem to spike alot when testing.

After some testing and turning off one of the sensors in the code (commenting out the function for infrared for instance), the spiking still occured. My guess is that both sensors want 5v for themselves, or something. When i cut off power to either sensor on itself, the reading of the left-over sensor become very accurate. I've tried reading with digitalPins, but i think arduino doesn't supply enough power to ensure stable readings.

So my question is: should i look for external powersources for either my arduino or the sensors - or am i missing something here? Mind you, more sensor will be added (such as the thermistor and LDR), and I need to be sure that the readings are reliable.

I've got the 5v pin connected to the maxbotix and the sharp via the breadboard. the analogpins are read via the analog output of each sensor. ground speaks for itself. If you need code or anything else i forgot to mention, feel free to swear at me for being noob. ::)

EDIT


Found this at http://www.maxbotix.com/MaxSonar-EZ1__FAQ.html#New_Flash_UAV_and_Mobile_Robotic_Users

When electrical noise is introduced on the line, it can cause the MaxSonar sensors to output unstable readings. Known items that cause excessive power supply noise are Sharp infrared range sensors, XBee radios, some wireless control systems, some switching power supplies, some servos, etc.

There is a simple solution that eliminates the effects of a dirty power supply to the sensor. By placing a resistor in series with the V+, along with a 100uF capacitor (Digi-Key part number: P803-ND or equivalent) to ground, you create an effective filter (i.e. almost a placebo battery) for the sensor. This ensures that almost any noise introduced onto the line is captured and only clean stable power is supplied to the sensor.

Just to clarify: the suggested MAXBOTIX solution didn’t work. A friend of mine suggested an Elco instead of a normal capacitor, but i haven’t tried that yet.

I've tried reading with digitalPins, but i think arduino doesn't supply enough power to ensure stable readings.

You tried reading an analog sensor on a digital pin, and you think the Arduino is at fault?

Sure, i get readings from both plugged into 5v via breadboard and analog pins 0 and 5, but they seem to spike alot when testing.

You want to post some code?

Are you allowing adequate time for the ADC to stabilize between readings of different kinds of sensors?

When i cut off power to either sensor on itself, the reading of the left-over sensor become very accurate.

It has nothing to do with how much current either sensor requires, since you should only be supplying that current when reading that sensor.

You need to post some links to the sensors you have, and a picture of how it is connected (using Fritzing, maybe), as well as your code.

If the Maxbotix solution didn't work, the problem that it addresses is not the problem you are having. Or you implemented it incorrectly, but I'll assume that you did, for the moment. When you do this, you eliminate the need for the ADC to stabilize.

You tried reading an analog sensor on a digital pin, and you think the Arduino is at fault?

no, I tried the PulseIn variant of reading the maxbotix via digital pin 7, and that way works, but does not elimate the problem. (option two @ here: http://www.arduino.cc/playground/Main/MaxSonar)

Are you allowing adequate time for the ADC to stabilize between readings of different kinds of sensors?

I think that might be the problem. However, i think you might be right that the maxbotix solution is for another problem.

Anyhow, i changed my concept to 'toggle sensor via a button' - so that should elimate the problem i'm having with sensors functioning simultaniously. I think. You're helping me with that pushbutton problem in another thread. ;)