13
\$\begingroup\$

To get full resolution from Arduino ADC when using 3.3V sensors you must do two things.

  1. Connect 3.3V power supply to AREF pin.
  2. Call analogReference(EXTERNAL) in the code.

But what about if I must mix 3.3V and 5V outputting sensors. What are my options?

\$\endgroup\$
10
\$\begingroup\$

A simple solution is to use a resistor divider (ratio approx 1:1.94) and reduce the 5v signal to a peak of 3.3v That way you would retain full resolution whilst not needing to switch reference. Suitable divider would be to use a 18k from the sensor to the analog input and a 33k from the analog input to ground. This would translate the 5v input to a 3.23v input. Use of higher precision resistors would get this closer to 3.3v if needed. You need to ensure that the sensor can supply the current needed for a given value - in this case about 0.1mA. The input resistance of the ATMega analog inputs is about 100M ohms so you could increase these values (reducing the load on the sensor) significantly before worrying about the effect of the input resistance.

\$\endgroup\$
3
\$\begingroup\$

Two things, live with the reduced resolution from the 3.3v sensors and keep your reference at 5V. Thats what I usually do and its good enough.

You can also switch your analogReference on the fly when reading each respective sensor. I do recall reading about mixing external references and internal references and having a series limiting resistor on your AREF, so read that part of the Arduino reference carefully.

\$\endgroup\$
2
\$\begingroup\$

You may also consider looking for newer versions of your sensors. You may be able to acquire sensors that both work with the same voltage limits, or you may find out that newer versions of the sensors are available which will give you digital outputs and can be polled with I2C or other simple serial communication protocols. It would require buying a new chip, of course, but they're not terribly expensive and not only would you eliminate the problem, but you would likely provide your project with a greater level of precision since you don't have to worry about noise in your circuit.

Short of redesigning your entire project to fit new chips, John C and the ham provide excellent, simple solutions. In my experience, I have run a 3v3 sensor with a 5v supply and reference and have had larger issues with noise than with lost resolution for casual projects. This is the easiest way out, but does require you to do some math, and I have voted ka1kjz's post up accordingly (do check the reference sheets).

As far as the voltage divider solution goes, as long as you use higher-precision resistors you get the advantage of having all of your measurements be in the same voltage range and you get the ratiometric correction benefit of using AREF to follow any voltage ripple. In practice, however, I've found that noise and lack of calibration techniques in my projects have contributed more error than a little voltage ripple or 10% resistors could reasonably cause. For that reason I have voted JohnC's solution up as well, since he covers all this in more detail.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.